-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
fix: Unexpected string on graphql playground page #9858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: alpha
Are you sure you want to change the base?
fix: Unexpected string on graphql playground page #9858
Conversation
I will reformat the title to use the proper commit message syntax. |
🚀 Thanks for opening this pull request! |
📝 WalkthroughWalkthroughAdjusts how JSON-stringified values are embedded in the generated client-side sandbox code within ParseGraphQLServer.js, removing extra quoting so the EmbeddedSandbox receives plain string values for initialEndpoint and specific headers. No server-side logic or public APIs are changed. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks (2 passed, 1 warning)❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal). Please share your feedback with us on this Discord post. 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 |
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/GraphQL/ParseGraphQLServer.js
(1 hunks)
🔇 Additional comments (1)
src/GraphQL/ParseGraphQLServer.js (1)
170-170
: Correct fix for double-quoting; resolves the blank page.Inlining JSON.stringify without surrounding quotes is the right approach here.
'X-Parse-Application-Id': ${JSON.stringify(this.parseServer.config.appId)}, | ||
'X-Parse-Master-Key': ${JSON.stringify(this.parseServer.config.masterKey)}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not inject X-Parse-Master-Key into client HTML — critical secret leak.
This renders the master key into a page any viewer can “View Source” and exfiltrate, granting full admin access. Remove it (or strictly gate behind an explicit opt-in and protect the route with auth/IP allowlist). Also avoid sending an undefined value as a header.
Minimal patch:
headers: {
...options.headers,
- 'X-Parse-Application-Id': ${JSON.stringify(this.parseServer.config.appId)},
- 'X-Parse-Master-Key': ${JSON.stringify(this.parseServer.config.masterKey)},
+ 'X-Parse-Application-Id': ${JSON.stringify(this.parseServer.config.appId)},
},
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
'X-Parse-Application-Id': ${JSON.stringify(this.parseServer.config.appId)}, | |
'X-Parse-Master-Key': ${JSON.stringify(this.parseServer.config.masterKey)}, | |
}, | |
headers: { | |
...options.headers, | |
'X-Parse-Application-Id': ${JSON.stringify(this.parseServer.config.appId)}, | |
}, |
🤖 Prompt for AI Agents
In src/GraphQL/ParseGraphQLServer.js around lines 176 to 178, the code injects
the X-Parse-Master-Key into client-rendered HTML which leaks a critical secret;
remove the master key from any headers sent to clients and only include it for
server-to-server calls behind strict controls. Fix by deleting the
X-Parse-Master-Key header from the client response path (or gate its inclusion
behind an explicit opt-in flag plus auth/IP allowlist), and ensure headers are
only added when values are defined (check for undefined before adding any
header).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are absolutely right, I have this change on my fork, and it seems I forgot to open a PR to parse-server
@cryingraven just a reminder that playground path should only be used in dev/local, not in production (because it expose the master key) |
@mtrezza we should merge this asap |
close: #9057 |
this fixes the error when activating graphql playground and opening it in the browser. the page is blank.
"${JSON.stringify(this.config.graphQLPath)}" the result -> ""/graphql""
by removing the double quotes
${JSON.stringify(this.config.graphQLPath)} the result -> "/graphql"
and the problem fixed
Summary by CodeRabbit