Jonathan Janisch
08/20/2024, 2:22 PMresourcePolicy:
version: default
resource: ticket
scope: tenantA
evaluateParentScope: false # defaults to true
Or conditionally:
resourcePolicy:
version: default
resource: ticket
scope: tenantA
evaluateParentScope:
condition:
match:
expr: R.attr.someAttr in P.attr.someAttrs
I haven't really thought it through 100% and I'm not sure if scoped Principal policies matter. Just throwing this out there! 🙂Charith (Cerbos)
version
of the policy as a tenant identifier in that case.Jonathan Janisch
08/20/2024, 3:31 PMversion
is we need to know ahead of time at the call site (app) if they've decided to ignore the default set of rules for a specific resource.Jonathan Janisch
08/20/2024, 3:34 PMversion
field as a default for that tenant, it means all resources would not be inherited. But they may want some hybrid, e.g. most policies use the default except for these 1 or 2 complicated resourcesCharith (Cerbos)
Jonathan Janisch
08/20/2024, 3:40 PMJonathan Janisch
08/20/2024, 3:41 PMJonathan Janisch
08/20/2024, 3:42 PMCharith (Cerbos)
deny_all.foo
and make sure that the policy for deny_all
scope has a wildcard rule that denies everything.Jonathan Janisch
08/20/2024, 3:51 PMJonathan Janisch
08/20/2024, 3:55 PMJonathan Janisch
08/20/2024, 4:41 PMdeny_all
it means you have a single policy that acts as a filter for all tenants. So all tenant inheritance rules are intermingled in one file. The pro is you have a single file with a clear scope name.
An alternative is to instead create foo
and foo.custom
where the tenant scope (foo
) decides whether to inherit for that specific resource.
---
apiVersion: api.cerbos.dev/v1
resourcePolicy:
version: default
resource: ticket
scope: foo
rules:
# Do not inherit default
- actions: ["*"]
roles: ["*"]
effect: EFFECT_DENY
And then the tenant overrides are defined in foo.custom
.
---
apiVersion: api.cerbos.dev/v1
resourcePolicy:
version: default
resource: ticket
scope: foo.custom
rules:
- actions:
- "update"
effect: EFFECT_ALLOW
roles:
- SENIOR_ASSOCIATE
The call to the PDP would always pass resource scope <tenant>.custom
and lenientScopeSearch must be on. The downside to this is if most clients have overrides, then you have an additional file per client.Jonathan Janisch
08/20/2024, 4:44 PMdeny_all
scope. Seems clearer to me.Charith (Cerbos)