Skip to content

Anonymous may call from the API's own origin, for Apollo Sandbox - #88

Merged
swantzter merged 1 commit into
mainfrom
claude/tricktionary-api-access-control-qhkjvy
Sep 24, 2026
Merged

swantzter merged 1 commit into
mainfrom
claude/tricktionary-api-access-control-qhkjvy

Conversation

@swantzter

Copy link
Copy Markdown
Member

The landing page at https://api.the-tricktionary.com/graphql embeds Apollo Sandbox. Sandbox sends its requests from the page, so they carry Origin: https://api.the-tricktionary.com. Since #87 no client allowed that origin, so every Sandbox request, introspection included, got a 403.

  • anonymous gets apiOrigins: the API's own origin, plus localhost for a local API's Sandbox. It was [] before. Anonymous still only holds public.
  • A preflight's origins include anonymous's too, so the registry's union really is every client's origins.
  • Keys are still denied from the API's origin unless their client lists it. The Sandbox is for exploring the public schema anonymously.
  • Mux uploads are unaffected: allowedOrigins still only lists web and admin.

Checked

Against a local API on the Firestore emulator, without a key:

Origin Query Result
https://api.the-tricktionary.com introspection 200
https://api.the-tricktionary.com tricks (public) 200
https://api.the-tricktionary.com globalStats (site) 403 INSUFFICIENT_SCOPE
http://localhost:5077 (the API itself) introspection 200
https://evil.example introspection 403, needs an API key
https://api.the-tricktionary.com.evil.example __typename 403, needs an API key

The first row reproduces the production failure: production answers it with a 403 now. lint, typecheck and schema:check pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QFzXAPK2agUfrXXhH8M9AG


Generated by Claude Code

The landing page's Sandbox sends its requests from the page, so they
carried the API's origin, which no client allowed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QFzXAPK2agUfrXXhH8M9AG
@swantzter
swantzter merged commit 420fe66 into main Sep 24, 2026
5 checks passed
@swantzter
swantzter deleted the claude/tricktionary-api-access-control-qhkjvy branch September 24, 2026 22:52
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.

2 participants