Files
iam/test/probe/README.md
zeekayandHanzo Dev 10eefd446b fix(authz): admit the cert id shape the BINARY sends; commit the probe as the gate
Fourth instance of one pattern in a day: verified with the bare id, the client
sends the org-qualified one. ai/internal/iam/cert.go:35 builds
"<IAM_ORG>/<name>" -> hanzo/cert-hanzo, while GetApplication hardcodes admin/ —
same clause, opposite directions, and only the spelling I happened to test worked.

SETTLED THE TRAP BEFORE GRANTING. admin/cert-hanzo and hanzo/cert-hanzo are two
DISTINCT rows, so granting blind risked cloud validating every bearer against the
wrong public key: green boot, total silent auth failure, no stack trace — strictly
worse than the crashloop. Measured instead: a real hanzo-cloud token carries
kid=cert-hanzo, and both rows carry the IDENTICAL 4096-bit modulus
(zE8fZcoJ_u4Uq…), which is the single key /v1/iam/.well-known/jwks publishes for
that kid. So the owner half selects between duplicates of ONE keypair, not between
keys, and the trap cannot fire.

They were seeded 3ms apart (…19.416479 and …19.419119) by the same run — seed
drift, a duplicate signing identity, reported separately. Nothing here depends on
which row wins, which is the point: name == p.AppCert remains the whole gate, so
an app reaches the one cert its own application row names and no other, whichever
owner it spells. Read-only, and Cert.Mask blanks PrivateKey, so this discloses the
PUBLIC key already published at the JWKS endpoint.

The probe manifest is now a committed artifact (test/probe/) with the rule written
down: derive the test id from what the client actually sends, by reading the
client. A green suite has now failed to predict production three times running;
the probe caught all three in seconds.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-26 19:40:58 -07:00

1.3 KiB

In-cluster authz probes

Required gate for any authz change touching the app principal. A green test suite is not sufficient evidence and has now failed to be, four times in one day:

shipped passed tests production
v1.33.17 yes 403 — grant matched applications; the caller sends get-application
v1.33.18 yes 200 with "the entity does not exist" — Scope rewrote the owner
v1.33.20 yes cert 403 — verified the bare id; the binary sends <org>/<name>

Every one exercised a contract no real client uses. app-selfread.yaml issues the requests the real caller issues, as the real principal, with the real secret — read from the hanzo-cloud-iam-creds Secret inside the cluster, so it is never handled outside it.

kubectl -n hanzo apply -f test/probe/app-selfread.yaml
kubectl -n hanzo logs iam-selfread-probe
kubectl -n hanzo delete pod iam-selfread-probe

Deriving the id a test should use

Read the CLIENT and copy the string it builds. Do not write the spelling that reads naturally:

  • ai/internal/iam/cert.go:35 → fmt.Sprintf("%s/%s", c.OrganizationName, name) → hanzo/cert-hanzo
  • GetApplication hardcodes the admin/ owner half → admin/hanzo-cloud

The two differ, and the difference is exactly what the last three fixes missed.