Benjamin Rupp
12/04/2025, 7:37 PMBenjamin Rupp
12/04/2025, 7:37 PM"rolePolicy": {
"role": "ug_132e420282a146868644925b2c591034",
"parentRoles": [
"inventory_sessions_read",
"monitoring_dashboard_read"
],
"scope": "bcaa9a67-5600-47a8-8bef-006a7105f974.data",
"rules": [
{
"resource": "*",
"allowActions": [
"*"
],
"condition": {
"match": {
"all": {
"of": [
{
"expr": "request.resource.attr.region in [\"west\"]"
}
]
}
}
}
}
]
}
Now I send a plan resources call and the response is
"filterDebug": "(eq request.resource.attr.region \"west\")"
Now if I have a second policy
"rolePolicy": {
"role": "ug_132e420282a146868644925b2c591666",
"parentRoles": [
"inventory_sessions_read",
"monitoring_dashboard_read"
],
"scope": "bcaa9a67-5600-47a8-8bef-006a7105f974.data",
"rules": [
{
"resource": "*",
"allowActions": [
"*"
],
"condition": {
"match": {
"all": {
"of": [
{
"expr": "request.resource.attr.region in [\"east\"]"
}
]
}
}
}
}
]
}
If I send a planresources request with both roles as input, I get a weird double negative response:
"filterDebug": "(not (or (not (eq request.resource.attr.region \"east\")) (not (eq request.resource.attr.region \"west\"))))"
Is that a bug?
My expectation was
"filterDebug": "(or (eq request.resource.attr.region \"east\") (eq request.resource.attr.region \"west\"))"Billy Bolton
12/04/2025, 7:39 PMSam Lock (Cerbos)
12/04/2025, 8:04 PMSam Lock (Cerbos)
12/05/2025, 10:19 AMnot (not (eq FOO))), but I was incorrectly combining those specific rules with all other "normal" ones, hence the or (not (eq FOO)) (not (eq BAR)) (the or being the culprit).
I've made a change to separate this handling. The produced output will now be:
"filterDebug": "(not (and (not (eq request.resource.attr.region \"east\")) (not (eq request.resource.attr.region \"west\"))))"
Note the and rather than the or. This seems a bit convoluted, but is logically equivalent to your expected result of:
"filterDebug": "(or (eq request.resource.attr.region \"east\") (eq request.resource.attr.region \"west\"))"
Not the first time in my life I've been De Morgan'd 🙃. Thanks again.Dennis (Cerbos)
Billy Bolton
12/05/2025, 1:20 PMBilly Bolton
12/08/2025, 3:03 PMSam Lock (Cerbos)
12/08/2025, 5:47 PM<http://ghcr.io/cerbos/cerbos:dev|ghcr.io/cerbos/cerbos:dev> which tracks the main branch in the repo.