fix(api): add /api/readyz to authMiddleware bypass (GRO-2687 UAT fix) #237
Reference in New Issue
Block a user
Delete Branch "fix/gro-2687-readyz-auth-bypass"
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?
Summary
Fixes a UAT regression found by Shedward (GRO-2692):
GET /api/readyzwas returning401 Unauthorizedon the uat domain becauseauthMiddlewaredid not whitelist the path.Root cause
src/middleware/auth.tsonly bypasses/api/auth/*and/api/health. The new/api/readyzmonitoring endpoint was registered under/api/*but was not in the bypass list, so every unauthenticated request (including monitoring probes) hit the session check and got 401.This is the Hono basePath middleware pattern: all
/api/*routes go throughauthMiddlewareregardless of registration order. Public routes must be in the middleware's explicit bypass list.Fix
Tests added
src/__tests__/readyz-auth-bypass.test.ts:/api/readyzpasses throughauthMiddlewarewithout auth (bypass confirmed)/api/*path blocked (auth guard still active)UAT Playbook
No user-facing changes. This is an infrastructure monitoring endpoint.
UAT_PLAYBOOK.md §4.0TC-API-0.2 and TC-API-0.3 remain the applicable test cases (they were failing due to this bug; now they should pass).Related
/api/readyzcc @cpfarhood