8000 enhancement: Role policies parent roles field by Sambigeara · Pull Request #2349 · cerbos/cerbos · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

enhancement: Role policies parent roles field #2349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Sambigeara
Copy link
Contributor
@Sambigeara Sambigeara commented Oct 17, 2024

Introduce a set of parent roles which a role policy assumes.

  • Parent roles can originate from role policies defined from the policy set. Therefore, at role policy set retrieval time, we recursively retrieve and aggregate all possible role policies.
  • Both scopePermissions settings are honoured. "Override parent" inherits the permissions of parent roles and has the authority to return ALLOW early if a resource:action pair exists in any of the policies. "Required parental consent for allows" narrows the scope for the full set of (recursive) parent roles.
  • Role policies with "override parent" now return NO_MATCH (rather than DENY) for resource:action pairs that don't exist. This covers the case where we need to inherit a base (non role policy) role, and evaluate it in the resource policies in the case where a resource:action pair isn't defined in the role policy. It also brings the behaviour in line with resource policy types.
  • This change also introduces parent role support into the query planner.

There is scope for some caching improvements to the recursive lookup, but I don't think this is super straight forward as cache invalidation requires context from a separate area of concern within the PDP (we'd need to be aware of index updates from within the engine). This is doable, but we don't know if it's necessary yet, and we're going to revamp the index at some point anyway so that might come first.

Sambigeara

This comment was marked as resolved.

@Sambigeara Sambigeara force-pushed the enhancement/role-policy-parent-roles branch from 7939d2f to bf39df9 Compare October 17, 2024 13:35
Introduce a discrete set of parent roles which a role policy:
* implicitly assumes
* narrows the permissions of

If a principal has a custom role, and the role policy definition for
that role has one or more parent roles, the principal implicitly assumes
those custom roles.

It also allows role policies to narrow the permissions of more than one
IdP role (rather than just the named role, as was previously the case).

Signed-off-by: Sam Lock <sam@swlock.co.uk>
…n time

Signed-off-by: Sam Lock <sam@swlock.co.uk>
Signed-off-by: Sam Lock <sam@swlock.co.uk>
Signed-off-by: Sam Lock <sam@swlock.co.uk>
@Sambigeara Sambigeara force-pushed the enhancement/role-policy-parent-roles branch from bf39df9 to 6184237 Compare October 25, 2024 13:31
Signed-off-by: Sam Lock <sam@swlock.co.uk>
@Sambigeara Sambigeara marked this pull request as draft October 28, 2024 08:57
Signed-off-by: Sam Lock <sam@swlock.co.uk>
Signed-off-by: Sam Lock <sam@swlock.co.uk>
…source policies. more test cases

Signed-off-by: Sam Lock <sam@swlock.co.uk>
…olicy evaluation (fixes flaky tests)

Signed-off-by: Sam Lock <sam@swlock.co.uk>
@Sambigeara Sambigeara marked this pull request as ready for review October 28, 2024 11:50
Signed-off-by: Sam Lock <sam@swlock.co.uk>
Signed-off-by: Sam Lock <sam@swlock.co.uk>
@Sambigeara Sambigeara merged commit 2fb5853 into cerbos:main Oct 30, 2024
22 checks passed
@Sambigeara Sambigeara deleted the enhancement/role-policy-parent-roles branch October 30, 2024 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0