refactor(jans-cedarling): handle recoverable errors gracefully in authorization #10589
Labels
comp-jans-cedarling
Touching folder /jans-cedarling
enhancement
kind-enhancement
Issue or PR is an enhancement to an existing functionality
Milestone
Is your feature request related to a problem? Please describe.
Currently, Cedarling returns an error for scenarios like failing to create certain entities or parsing a request, even if these errors are recoverable. While this approach provides clarity in Rust (via explicit error handling), it complicates error management in bindings for other languages where error handling may not be as robust or idiomatic.
Describe the solution you'd like
Update the
authorize
function to handle recoverable errors gracefully. Instead of returning an error, the function should:DENY
decision in cases where recoverable errors occur.ALLOW
orDENY
.Role
that doesn’t block the primary authorization.DENY
decision, e.g., failing to create the primaryUser
entity.An example for a serialized
ALLOW
result might be:Then for a
DENY
result:And for an
ALLOW
but with a warning:Handling Principal Combinations
To be able, to handle returning a decision result that is based on the combination of the authz result of different principals, we also return each of their results.
Describe alternatives you've considered
An alternative approach would be to retain error returns for critical failures while ensuring that recoverable issues generate structured warnings or messages. However, Cedarling currently does not encounter critical errors that justify halting entirely.EDIT: We now identified a potentially non-recoverable error (the logger failing).
Additional context
Here’s the updated function signature stays the same in Rust but the Error should now only be non-recoverable errors.
See #10590 for the proposed improvement on the
"principal_operator"
.The text was updated successfully, but these errors were encountered: