Skip to content
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

Support for principal.id resolution in conditions #97

Open
identitymonk opened this issue Mar 24, 2025 · 3 comments
Open

Support for principal.id resolution in conditions #97

identitymonk opened this issue Mar 24, 2025 · 3 comments

Comments

@identitymonk
Copy link

We have done an Interop activity with the OpenID Foundation AuthZEN Working Group and found an interesting case. Due to backward compatibility with other version of the specification, the Principal now has 2 different EntityTypes to describe it: user and identity.

If we want to forbid one principal to perform actions, we are forced to define the following policy:

forbid (
    principal,
    action,
    resource
) when {
 principal == user::"CiRmZDA2MTRkMy1jMzlhLTQ3ODEtYjdiZC04Yjk2ZjVhNTEwMGQSBWxvY2Fs" ||
 principal == identity::"CiRmZDA2MTRkMy1jMzlhLTQ3ODEtYjdiZC04Yjk2ZjVhNTEwMGQSBWxvY2Fs"
};

It will be easier and more natural if we could author the following policy:

forbid (
    principal,
    action,
    resource
) when {
 principal.id == "CiRmZDA2MTRkMy1jMzlhLTQ3ODEtYjdiZC04Yjk2ZjVhNTEwMGQSBWxvY2Fs" 
};

While I can understand the potential for disruptions by not mentioning the EntityType, if we follow the best practices, the ID should be an immutable unique id and therefore should allow to disambiguate any situation.

@identitymonk
Copy link
Author

This can be useful if one has multiple applications that did use multiple schema definitions but want to put guardrails that are applied to the whole ecosystem.

@shaobo-he-aws
Copy link
Contributor

Thank you for your interest in Cedar. IMO, the example is not very convincing if these forbid policies are automatically generated. In other words, we should be able to easily change whatever way used to add disjunctions. Furthermore, having this functionality will make wildcard matching on EntityUIDs possible, which is an anti-pattern.

@cdisselkoen
Copy link
Contributor

For more on the idea of wildcard matching on EntityUIDs and why it's an anti-pattern, see the discussion here. (I recognize that the particular motivating example in this thread doesn't involve wildcard matching on ids, but the proposed fix would enable wildcard matching on ids.)

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

No branches or pull requests

3 participants