fix: Session creation endpoint allows overwriting server-generated session fields (GHSA-5v7g-9h8f-8pgg)#10195
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. 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. |
📝 WalkthroughWalkthroughThis PR implements server-side validation for session creation by preventing clients from supplying sensitive session fields. It adds test coverage verifying that sessionToken, expiresAt, and createdWith are ignored during session creation, and modifies the session handling logic to exclude these fields from additionalSessionData. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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/ParseSession.spec.js (1)
216-226: Use returnedobjectIdfor deterministic session verification.Both tests currently infer the new session by
sessionToken !== originalToken; using the POST responseobjectIdwould make these assertions more explicit and less brittle.♻️ Suggested refactor
- await request({ + const createResponse = await request({ method: 'POST', url: 'http://localhost:8378/1/classes/_Session', headers: { 'X-Parse-Application-Id': 'test', 'X-Parse-REST-API-Key': 'rest', 'X-Parse-Session-Token': sessionToken, 'Content-Type': 'application/json', }, body: { expiresAt: { __type: 'Date', iso: farFuture.toISOString() }, }, }); - const sessions = await request({ - method: 'GET', - url: 'http://localhost:8378/1/classes/_Session', + const newSessionResponse = await request({ + method: 'GET', + url: `http://localhost:8378/1/classes/_Session/${createResponse.data.objectId}`, headers: { 'X-Parse-Application-Id': 'test', 'X-Parse-Master-Key': 'test', }, }); - const newSession = sessions.data.results.find(s => s.sessionToken !== sessionToken); + const newSession = newSessionResponse.data;Also applies to: 247-257
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@spec/ParseSession.spec.js` around lines 216 - 226, The test should locate the newly created session using the POST response's objectId instead of filtering by sessionToken; capture the create response (e.g., createRes.data.objectId) when the session is created and then find the session from sessions.data.results by matching objectId (replace the current newSession lookup that uses sessionToken !== sessionToken). Apply the same change to the other occurrence (the block around lines 247-257) so both tests deterministically identify the created session via its objectId.
🤖 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/ParseSession.spec.js`:
- Around line 216-226: The test should locate the newly created session using
the POST response's objectId instead of filtering by sessionToken; capture the
create response (e.g., createRes.data.objectId) when the session is created and
then find the session from sessions.data.results by matching objectId (replace
the current newSession lookup that uses sessionToken !== sessionToken). Apply
the same change to the other occurrence (the block around lines 247-257) so both
tests deterministically identify the created session via its objectId.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 88ccac82-e426-41ca-a808-b553b809d3dc
📒 Files selected for processing (2)
spec/ParseSession.spec.jssrc/RestWrite.js
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## alpha #10195 +/- ##
=======================================
Coverage 92.61% 92.61%
=======================================
Files 192 192
Lines 16259 16259
Branches 190 190
=======================================
Hits 15059 15059
Misses 1187 1187
Partials 13 13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
# [9.6.0-alpha.17](9.6.0-alpha.16...9.6.0-alpha.17) (2026-03-13) ### Bug Fixes * Session creation endpoint allows overwriting server-generated session fields ([GHSA-5v7g-9h8f-8pgg](https://github.com/parse-community/parse-server/security/advisories/GHSA-5v7g-9h8f-8pgg)) ([#10195](#10195)) ([7ccfb97](7ccfb97))
|
🎉 This change has been released in version 9.6.0-alpha.17 |
Issue
Session creation endpoint allows overwriting server-generated session fields (GHSA-5v7g-9h8f-8pgg)