Skip to content

fix: Session creation endpoint allows overwriting server-generated session fields (GHSA-5v7g-9h8f-8pgg)#10195

Merged
mtrezza merged 1 commit intoparse-community:alphafrom
mtrezza:fix/GHSA-5v7g-9h8f-8pgg-v9
Mar 13, 2026
Merged

fix: Session creation endpoint allows overwriting server-generated session fields (GHSA-5v7g-9h8f-8pgg)#10195
mtrezza merged 1 commit intoparse-community:alphafrom
mtrezza:fix/GHSA-5v7g-9h8f-8pgg-v9

Conversation

@mtrezza
Copy link
Member

@mtrezza mtrezza commented Mar 13, 2026

Issue

Session creation endpoint allows overwriting server-generated session fields (GHSA-5v7g-9h8f-8pgg)

@parse-github-assistant
Copy link

parse-github-assistant bot commented Mar 13, 2026

🚀 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.

@parseplatformorg
Copy link
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

📝 Walkthrough

Walkthrough

This 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

Cohort / File(s) Summary
Session field validation tests
spec/ParseSession.spec.js
Adds three new test cases verifying that client-supplied sessionToken, expiresAt, and createdWith are ignored during session creation and that server-generated values are properly set.
Session data handling
src/RestWrite.js
Expands the set of excluded keys in RestWrite.prototype.handleSession to include sessionToken, expiresAt, and createdWith alongside existing objectId and user exclusions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided by the author; the template requires Issue, Approach, and Tasks sections to be completed. Add a detailed description covering the security vulnerability being fixed, the approach taken in RestWrite.js and tests, and indicate which tasks were completed.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title accurately describes the main change: fixing a security vulnerability (GHSA-5v7g-9h8f-8pgg) where session creation allowed overwriting server-generated fields, which is directly addressed by the changes that prevent sessionToken, expiresAt, and createdWith from being included in additionalSessionData.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
spec/ParseSession.spec.js (1)

216-226: Use returned objectId for deterministic session verification.

Both tests currently infer the new session by sessionToken !== originalToken; using the POST response objectId would 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

📥 Commits

Reviewing files that changed from the base of the PR and between fa7d056 and cd13c5c.

📒 Files selected for processing (2)
  • spec/ParseSession.spec.js
  • src/RestWrite.js

@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.61%. Comparing base (a944203) to head (cd13c5c).
⚠️ Report is 3 commits behind head on alpha.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mtrezza mtrezza changed the title fix: GHSA-5v7g-9h8f-8pgg v9 fix: Session creation endpoint allows overwriting server-generated session fields (GHSA-5v7g-9h8f-8pgg) Mar 13, 2026
@mtrezza mtrezza merged commit 7ccfb97 into parse-community:alpha Mar 13, 2026
23 of 24 checks passed
parseplatformorg pushed a commit that referenced this pull request Mar 13, 2026
# [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))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 9.6.0-alpha.17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:released-alpha Released as alpha version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants