Files
fleet/scripts
CatoandClaude Opus 5 82cd576fb5 feat(ci): guard every next-auth app's advertised origin, daily (#40)
Behind Caddy a Next.js app never sees its own public URL, so next-auth builds
sign-in and callback URLs from the INTERNAL origin unless NEXTAUTH_URL (v4) or
AUTH_URL (v5) is pinned in the box env. AUTH_TRUST_HOST=true does NOT cover
this path, which is exactly what makes a broken app look configured.

Nothing 500s when it happens. The site renders, and only Google sign-in and
sign-out are impossible. petvity shipped this, fixed it in petvity#39 around
2026-08-14 with a per-app assertion supposedly added — and on 2026-09-10 was
serving https://localhost:4013/api/auth/callback/google again. The regression
stated itself in public JSON for weeks and nothing read it.

next-auth publishes GET /api/auth/providers unauthenticated, and every entry
carries the app's configured origin, so the detector needs no secret, no login
and no box access: fetch it per site, fail if any signinUrl/callbackUrl origin
is not the origin that served the JSON. 404 is a site without next-auth and
SKIPs; 5xx FAILs, because an auth stack that cannot answer is broken too and
reading "no data" as "no problem" is how this check would certify a dead auth.

Sites come from fleetcrown's footer, the same SSOT ui-defect-audit.mjs reads,
so this adds no second app list and no exclusion list — a repo that is not a
deployment is absent by construction.

Self-tested from captured payloads, both sides pinned: the real localhost
regression is caught, the real repaired payload stays silent. The self-test
runs in this repo's CI and again before each scheduled sweep, because a
detector that has quietly stopped detecting prints a ✓ over a broken fleet.


Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 16:23:03 -07:00
..