Skip to content

Unsuccessful Datalog checks don't return distinguished error #152

@seh

Description

@seh

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 the time fact bound during evaluation, then the (*authorizer).Authorize method fails with a freshly constructed errors.errorString, not using or wrapping any sentinel error value or type that one could detect with the errors.Is or errors.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, or ErrCheckNotSatisfied? Using a value from errors.New would be a little bit awkward, as we'd have to wrap it in a way that the resulting message produced by the String method is still sensible. We could introduce a new type that satisfies the error 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions