Cloudflare Access was permanently blocking this Worker (500 Cloudflare
Access must be configured in production): Zero Trust was never enabled
on the account and no available credential had Access-write scope.
Instead of waiting on that credential, access control now lives in code
against Scribase (this portfolio's self-hosted, Supabase-compatible
auth backend): a request is let through only if its Scribase access
token resolves to the exact OWNER_EMAIL account.
- workers/lib/scribase-auth.ts: token extraction, remote verification
via GET /auth/v1/user, sign-in/refresh/sign-out via the password and
refresh_token grants, with 25 unit tests.
- workers/lib/login-page.ts: dependency-free HTML sign-in page.
- workers/app.ts: new middleware (fail-closed on missing config, silent
refresh-token retry, uniform 401 for API/MCP callers vs redirect for
HTML), /login (rate-limited via a native Workers ratelimits binding)
and /logout (also revokes the session server-side) routes. Removes
the old jose/JWKS Cloudflare Access check entirely.
- wrangler.jsonc, .dev.vars.example, workers/types.ts, README.md:
SCRIBASE_URL/SCRIBASE_ANON_KEY/OWNER_EMAIL replace
POLICY_AUD/TEAM_DOMAIN; jose dropped from package.json.
Reviewed by code-reviewer and security-reviewer subagents; every
MEDIUM/HIGH finding fixed. Deployed and verified live: the Worker now
fails closed with the new Scribase message instead of the old
Cloudflare one. Provisioning the actual Scribase project is blocked on
a one-time $1 card check on the Scribase org (owner-only payment
action) -- see NOTES.md and ~/products/plans/agentic-inbox.md.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>