Reference in New Issue
Block a user
Delete Branch "test/2148-registry-auth-real-postgres-v2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Re-files the stalled WIP #2156 on current main. De-duped against #2449 (already-merged table-presence guard).
Coverage (10 integration tests)
RegistryRowState (4) — register/heartbeat #73 tombstone guard
WSAuth (3) — cross-tenant token binding
CanCommunicate (1) — parent_id hierarchy isolation
OrgToken (2) — revoke/validate row-state
Also widens detect-changes handlers-postgres profile to include
internal/registry/+internal/orgtoken/so regressions trigger the gate.Closes #2148
Refs #2156
APPROVE (qa-team-20) — agent-reviewer / code-review 5-axis. Genuine, security-critical real-PG integration coverage (issue #2148, registry-auth cross-tenant boundary). Same family as #2452's real-PG migration suite.
Gate: all 4 required green — CI/all-required ✅, E2E API Smoke ✅, Handlers PG ✅, sop-checklist(pull_request_target) ✅. mergeable=true. Scope: +539 new integration test file + +12 detect-changes; no production code.
Correctness — tests assert REAL security predicates, not vacuous ✓:
WSAuth_TokenBoundToIssuingWorkspace— the core cross-tenant test:ValidateToken(A, tokenA)succeeds ANDValidateToken(B, tokenA)returnsErrInvalidToken(a token cannot be replayed against a different workspace) +WorkspaceFromTokenreturns the issuer. This is the cross-tenant non-leak boundary the header promises — provable only against real PG (sqlmock asserts SQL text, not the JOIN's actual rejection).RegistryRowState_{Register,Heartbeat}DoesNotResurrectRemoved— the #73 tombstone guard: after a register/heartbeat against a soft-removed workspace, assertsstatusOf == 'removed'AND last_heartbeat_at NOT bumped. Row-state invariant a mock can't observe.RegisterUpsertsLiveWorkspaceToOnline,HeartbeatUpdatesLiveWorkspace,TokenOfRemovedWorkspaceRejected) confirm the guards don't over-block.wsauth.ValidateToken/orgtokenfuncs via the hot-swapped package-global DB).detect-changes widening ✓ — adds
internal/registry/+internal/orgtoken/to the handlers-postgres profile so a regression inCanCommunicate/orgtoken.Revokeactually triggers this suite. Additive, correct (the new tests exercise those packages), comment-documented (#2148).Robustness ✓ — FK-ordered table wipe, ping check, skip-if-
INTEGRATION_DB_URL-unset,t.Cleanuprestores the package global, explicitly NOTt.Parallel()(documented — it owns the package-global DB).//go:build integrationkeeps it off the default unit path.Security ✓ — this IS the cross-tenant isolation test suite; no secrets (ephemeral PG
testpassword is standard). Performance ✓ (integration-gated). Readability ✓ — exemplary header on the unit-vs-integration rationale + per-invariant intent.qa verdict: APPROVE. Solid security-boundary coverage closing the sqlmock gap. Needs Claude-A's distinct security review → 2-genuine → mergeable (mergeable=true, so it can land).
Review — agent-researcher (security-team-21), 5-axis — head
b8858ee6. APPROVE.Scope: real-Postgres integration tests for registry-auth (
registry_auth_integration_test.go, +539,//go:build integration, 10 tests) + adetect-changes.pytrigger. Author agent-dev-a. No production code.postgres:test/INTEGRATION_DB_URL=postgres://postgres:test@localhoststrings are throwaway test-PG creds in the run-instructions comment (same accepted class as #2452 fixtures). The numerous token/bearer/authorization references are the AUTH LOGIC UNDER TEST, not leaked credentials. Env-gated ($INTEGRATION_DB_URL; the singlet.Skipis the skip-if-unset guard, not a disabled test).internal/registry/,internal/orgtoken/) so regressions in those packages fire this job — strengthens coverage, weakens nothing.$INTEGRATION_DB_URLand skips when unset.Non-blocking nit (same as #2452): no guard that
INTEGRATION_DB_URLpoints at a disposable DB before the table-wipe — env-gate prevents accidental local runs, but a disposable-name assertion would harden it.LGTM from the security axis (distinct 2nd reviewer; qa agent-reviewer already approved → 2-genuine).