Document safe transport contract for /graphql/stream and CORS - #23
Merged
Merged
Conversation
…and CORS allow-list expectations Co-authored-by: charles2ke <6725706+charles2ke@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Restrict GET operations on /graphql/stream to queries and subscriptions
Document safe transport contract for /graphql/stream and CORS
Sep 16, 2026
charles2ke
approved these changes
Sep 16, 2026
charles2ke
marked this pull request as ready for review
September 16, 2026 03:46
charles2ke
approved these changes
Sep 16, 2026
There was a problem hiding this comment.
🟢 Approval recommended
Only a minor documentation nit remains; no blocking issues were identified.
Pull request overview
Documents safe GET streaming behavior, POST-only mutations, and production CORS guidance.
Changes:
- Clarifies
/graphql/streamaccepts only queries and subscriptions over GET. - Documents CSRF-resistant mutation requests.
- Adds explicit CORS allow-list guidance.
File summaries
| File | Summary |
|---|---|
README.md |
Documents safe transport restrictions and CORS expectations. |
Review details
Suppressed comments (1)
README.md:424
X-Requested-Withis not one of the headers recognized by Apollo Server's default CSRF-prevention middleware. With a simple content type, a client following this example can still be rejected by/graphql; document Apollo's supported preflight headers (Apollo-Require-PreflightorX-Apollo-Operation-Name) instead, or omit the custom-header alternative.
custom header (e.g. `X-Requested-With`), matching the CSRF-prevention shape
that Apollo Server enforces by default on `/graphql`. Requests that omit
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
GET /graphql/streamwas documented as accepting the "same payload as/graphql", implying mutations could be triggered from a plain cross-origin GET — a CSRF risk that Apollo Server's defaultcsrfPreventionotherwise guards against on/graphql.README updates
GET /graphql/streamdocumented as read-only streaming: onlyquery/subscriptionoperations are accepted over GET; mutations sent via GET are rejected with405 Method Not Allowed(already enforced bysrc/streaming/sseRouter.js).Content-Typesuch asapplication/jsonand/or a custom header), consistent with Apollo Server's default CSRF prevention on/graphql./graphql" wording for GET, replaced with explicit limitations on what GET accepts./graphql,/graphql/stream, and/exportshould be served behind an explicit origin allow-list, not a wildcard, in production.This is a documentation-only change — no runtime code was modified, since the GET-mutation rejection is already implemented in
sseRouter.js.