Repository navigation
fix(gateway-worker): serve GraphiQL under a strict CSP, and send nosniff and no referrer everywhere - #35
Merged
Conversation
Hebilicious
added this pull request to stack #37
October 13, 2026 20:10
|
Hebilicious
force-pushed
the
audit/graphiql-csp
branch
from
October 13, 2026 20:12
6e7c106 to
1482b4c
Compare
Hebilicious
force-pushed
the
audit/graphiql-csp
branch
from
October 14, 2026 06:04
1482b4c to
a2057c8
Compare
Hebilicious
removed this pull request from stack #37
October 14, 2026 06:05
Hebilicious
added this pull request to stack #42
October 14, 2026 06:05
Hebilicious
force-pushed
the
audit/graphiql-csp
branch
from
October 14, 2026 06:10
a2057c8 to
c59f785
Compare
Hebilicious
force-pushed
the
audit/graphiql-csp
branch
from
October 14, 2026 07:09
c59f785 to
d1cd991
Compare
…iff and no referrer everywhere GraphiQL is served by default on the API origin and runs third-party code from unpkg with no CSP (audit W1). src/graphiql-page.ts now renders Yoga's page once per isolate (and again after a failed render) with a Content-Security-Policy that allows only its inline scripts, each by its hash whatever its tag's attributes, and the pinned GraphiQL release's dist/ directory; connects only to the gateway and that release; and forbids framing (frame-ancestors 'none', X-Frame-Options DENY). Every public response carries X-Content-Type-Options: nosniff and Referrer-Policy: no-referrer unless it states its own. GraphiQL stays on by default; docs/deploy.md says when to set GRAPHIQL=disabled. public-gateway proves the policy against the served page, the hashing of attributed inline scripts, the render retry and the headers on every query form. Refs #15
Hebilicious
force-pushed
the
audit/graphiql-csp
branch
from
October 14, 2026 08:50
d1cd991 to
1acd6f3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #15
What changed
apps/gateway/src/graphiql-page.tsrenders Yoga's GraphiQL page.RenderedPagesrenders it once per isolate and again after a failed render. The page keeps Agris's icon.graphiqlContentSecurityPolicy:@graphql-yoga/graphiqlrelease'sdist/directory;default-src,base-uri,object-src,form-actionandframe-ancestorsare'none';X-Frame-Options: DENY.X-Content-Type-Options: nosniffandReferrer-Policy: no-referrer, unless the response states its own (SECURITY_HEADERSinpublic-gateway.ts). The 429 response no longer setsnosniffitself.docs/deploy.mdexplains the policy and when to setGRAPHIQL=disabled. The gateway README names the module.public-gatewaygains a policy step inpublic-gateway-graphiqland new scenariospublic-gateway-graphiql-inline-scripts,public-gateway-graphiql-render-retryandpublic-gateway-security-headers.How it was reproduced
I ran this layer's
public-gatewayfeature against the parent's gateway (audit/self-hosted-default-limit), with the bundle built at the parent. I overlaidapps/gateway/src/graphiql-page.ts, the new module two scenarios test directly; the parent's gateway never imports it.public-gateway-graphiqlAssertionError: The response has no Content-Security-Policypublic-gateway-security-headersReferrer-Policyisnull, not'no-referrer'public-gateway-graphiql-inline-scriptspublic-gateway-graphiql-render-retryNot reproduced
public-gateway-graphiql-inline-scriptsandpublic-gateway-graphiql-render-retryare unit tests of the new module, which was overlaid. They pass on the parent and say nothing about it.docs/deploy.mdsays.Refs #21 (security audit tracking issue). Part of stack #42; review bottom-up, each layer shows only its own diff.