mirror of
https://github.com/hanzoai/iam.git
synced 2026-11-19 18:37:16 +00:00
zip's authorization rule has answered three ways since v1.36.45 — allow, refuse, hold — and this module was still on v1.34.2, one contract behind a released breaking change. Nothing else in the bump needed touching; the seam is one function. Its refusals become Deny rather than a bare 403, so each carries the clause that made it: no principal, or an entity the caller may not reach. The error lane is left for a check that could not be made at all, which is what it is for. The tests asked "did this return an error", and a refusal no longer does. One helper now asks the question they were asking — was this call let through — reading both halves of the answer, so a Deny cannot read as an admission. The SCIM discovery document gained a 202 on every governed path and that is the framework's, not this package's: a held op answers 202, so a governed contract declares one. Our rule never holds. The document states what a governed contract may answer, not what this rule chooses. Co-authored-by: Hanzo Dev <[email protected]>
18 lines
589 B
Go
18 lines
589 B
Go
package authz
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zap-proto/zip"
|
|
)
|
|
|
|
// refused asks the one question these tests ask of the seam: was this call let
|
|
// through. It exists because the seam's answer is now a [zip.Decision] and an
|
|
// error — a refusal is a Deny carrying the clause that made it, while the error
|
|
// lane is for a check that could not be made at all — and a test that read only
|
|
// one of the two would report a refusal as an admission.
|
|
func refused(ctx context.Context, op zip.Op, in any) bool {
|
|
d, err := Authorize(ctx, op, in)
|
|
return err != nil || d.Effect == zip.Deny
|
|
}
|