Files
iam/internal/authz/refused_test.go
zeekayandHanzo Dev 093a85851e Take zip v1.36.46, where a rule may hold as well as allow or refuse
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]>
2026-09-10 17:41:58 -07:00

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
}