fix: GraphQL API endpoint ignores CORS origin restriction (GHSA-q3p6-g7c4-829c)#10334
Conversation
|
🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review. Tip
Note Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect. Caution Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
📝 WalkthroughWalkthroughThe GraphQL server's CORS handling is refactored to use a dedicated Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
spec/vulnerabilities.spec.js (1)
5117-5131: Consider extracting the duplicated GraphQL test bootstrap helper.This setup is very close to the helper used in the earlier GraphQL WebSocket security suite (Line 2736 onward). A shared helper would reduce drift between GraphQL vulnerability tests.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@spec/vulnerabilities.spec.js` around lines 5117 - 5131, The GraphQL test bootstrap in setupGraphQLServer is duplicated from the earlier GraphQL WebSocket suite; extract the shared behavior into a single helper (e.g., createSharedGraphQLTestServer) and have both suites call it. Move the logic that closes existing httpServer, calls reconfigureServer(serverOptions), creates express(), mounts server.app at '/parse', instantiates ParseGraphQLServer, calls parseGraphQLServer.applyGraphQL(expressApp), starts httpServer.listen(gqlPort) and returns the ParseGraphQLServer into that new helper, then replace the current setupGraphQLServer implementation to delegate to the shared helper (preserving use of symbols reconfigureServer, ParseGraphQLServer, applyGraphQL, gqlPort and httpServer).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@spec/vulnerabilities.spec.js`:
- Around line 5117-5131: The GraphQL test bootstrap in setupGraphQLServer is
duplicated from the earlier GraphQL WebSocket suite; extract the shared behavior
into a single helper (e.g., createSharedGraphQLTestServer) and have both suites
call it. Move the logic that closes existing httpServer, calls
reconfigureServer(serverOptions), creates express(), mounts server.app at
'/parse', instantiates ParseGraphQLServer, calls
parseGraphQLServer.applyGraphQL(expressApp), starts httpServer.listen(gqlPort)
and returns the ParseGraphQLServer into that new helper, then replace the
current setupGraphQLServer implementation to delegate to the shared helper
(preserving use of symbols reconfigureServer, ParseGraphQLServer, applyGraphQL,
gqlPort and httpServer).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 88308ea8-1be9-42ef-a3a9-cb059fa0d789
📒 Files selected for processing (3)
spec/ParseGraphQLServer.spec.jsspec/vulnerabilities.spec.jssrc/GraphQL/ParseGraphQLServer.js
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## alpha #10334 +/- ##
=======================================
Coverage 92.54% 92.54%
=======================================
Files 192 192
Lines 16519 16517 -2
Branches 229 229
=======================================
- Hits 15287 15286 -1
+ Misses 1212 1211 -1
Partials 20 20 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
# [9.7.0-alpha.10](9.7.0-alpha.9...9.7.0-alpha.10) (2026-03-27) ### Bug Fixes * GraphQL API endpoint ignores CORS origin restriction ([GHSA-q3p6-g7c4-829c](GHSA-q3p6-g7c4-829c)) ([#10334](#10334)) ([4dd0d3d](4dd0d3d))
|
🎉 This change has been released in version 9.7.0-alpha.10 |
Issue
GraphQL API endpoint ignores CORS origin restriction (GHSA-q3p6-g7c4-829c)