Skip to content

fix(fee-payer): reject admin requests when ADMIN_SECRET is unset - #1098

Open
gordera wants to merge 1 commit into
tempoxyz:mainfrom
gordera:fix/fee-payer-admin-auth-fallback
Open

fix(fee-payer): reject admin requests when ADMIN_SECRET is unset#1098
gordera wants to merge 1 commit into
tempoxyz:mainfrom
gordera:fix/fee-payer-admin-auth-fallback

Conversation

@gordera

@gordera gordera commented Jun 23, 2026

Copy link
Copy Markdown

Harden admin guard against missing ADMIN_SECRET

  • ADMIN_SECRET is optional (env.d.ts: readonly ADMIN_SECRET?: string).
  • Admin guard only hard-requires the KV binding; the secret check was auth !== \Bearer ${env.ADMIN_SECRET}``.
  • If KV is bound but the secret is unset, the comparison becomes "Bearer undefined".
  • Anyone sending Authorization: Bearer undefined is then authenticated.
  • That grants create / list / update / revoke on every sponsorship key.

Fix:

  • Return 503 up front when env.ADMIN_SECRET is falsy — before any header comparison.
  • Configured envs are unchanged; unconfigured envs can no longer be unlocked by guessing.

Notes:

  • Comparison is still not constant-time; out of scope here, flagged for follow-up.

When the KV binding is present but ADMIN_SECRET is not configured, the bearer
comparison degraded to 'Bearer undefined', authenticating anyone who sent it.
Return 503 before comparing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant