Open jeffsec-aws opened 9 months ago
Thank you for your interest, @jeffsec-aws. I have a quick question. Is it possible to preprocess the data before authorization? For instance, the scope
field can be a set of strings instead of a string. So, the policy becomes,
permit(
principal,
action,
resource
) when {
context.token.scope.containsAll(["ScopeA", "ScopeB"])
};
When constructing the context
, you convert the scope
claim into a set of strings (e.g., by calling the string splitting function of the language you like).
Another path forward here might be a "Path" extension, as proposed by @D-McAdams on this thread. The constructor for a "Path" could take the delimiter (in this case a space) as input, and support containsAll/containsAny methods.
@shaobo-he-aws yes pre-processing is an alternative, but it means that the PEP touches the data submitted for authorization.
Having a split operator allows 3rd party Cedar oriented PDP that can consume OAuth2 tokens natively to work with the JWS natively and benefit from the digital signature protection against tampering while evaluating policies.
I understand this is niche.
While dealing with OAuth2 tokens, the
scope
claim (sometimesscp
for some non-compliant OIDC providers) is composed of:Reference: RFC8693
Reference: RFC6749 / Section 3.3
A policy having multiple conditions using the
like
operator can be a solution:It won't be secure if the scope value is
ScopeAScopeB
with no space delimiter.While a policy including the proposed
split(separator)
operator, it will be more secure: