-
Notifications
You must be signed in to change notification settings - Fork 22
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
Unsuccessful Datalog checks don't return distinguished error #152
Comments
Oh, I just noticed that we collect all of these individual errors from unsuccessful checks and join them as strings, rather than combining the errors via the |
I have limited knowledge in the go standard libs and its idioms, so contributions on this front would be great. |
I'm willing to attempt to improve this error reporting, while retaining backward compatibility for existing callers—modulo the exact error message text that would result from these check failures. Do you think that callers should be able to distinguish between unsatisfied checks in the authority block versus checks in following blocks? |
I think that would be useful, yes. For reference, the rust implementation exposes quite detailed information about the failed checks / policies: https://github.com/biscuit-auth/biscuit-rust/blob/main/biscuit-auth/src/error.rs#L174 Having the check code without the block number is not enough in the general case because the authority blocks and attenuation blocks don’t see the same facts. |
At present, we include the block number in the error message, and could continue to do so. What I was asking was whether a caller should be able to use functions like In Rust, you distinguish these with separate types: the I can attempt to adapt some of these ideas into the Go library, with an eye toward maintaining backward compatibility for existing callers. |
If I include an attenuating check in my biscuit such as
check if time($time), $time < {time}
—where the{time}
placeholder is replaced by an expiration horizon that winds up at or later than thetime
fact bound during evaluation, then the(*authorizer).Authorize
method fails with a freshly constructederrors.errorString
, not using or wrapping any sentinel error value or type that one could detect with theerrors.Is
orerrors.As
functions.Callers can't detect when authorization fails due to an unsatisfied check, whereas they can detect when a policy denies authorization via the
ErrPolicyDenied
value.Would you be amenable to introducing a new sentinel error value such as
ErrCheckUnsatisfied
,ErrUnsatisfiedCheck
, orErrCheckNotSatisfied
? Using a value fromerrors.New
would be a little bit awkward, as we'd have to wrap it in a way that the resulting message produced by theString
method is still sensible. We could introduce a new type that satisfies theerror
interface instead.Another question is whether we'd want to allow callers to distinguish between unsatisfied authority checks and other non-authority checks that are unsatisfied.
The text was updated successfully, but these errors were encountered: