Skip to content

fix: PagesRouter path traversal allows reading files outside configured pages directory (GHSA-hm3f-q6rw-m6wh)#10104

Merged
mtrezza merged 1 commit intoparse-community:alphafrom
mtrezza:fix/m6wh-9
Mar 5, 2026
Merged

fix: PagesRouter path traversal allows reading files outside configured pages directory (GHSA-hm3f-q6rw-m6wh)#10104
mtrezza merged 1 commit intoparse-community:alphafrom
mtrezza:fix/m6wh-9

Conversation

@mtrezza
Copy link
Member

@mtrezza mtrezza commented Mar 5, 2026

Pull Request

Issue

PagesRouter path traversal allows reading files outside configured pages directory (GHSA-hm3f-q6rw-m6wh)

Tasks

  • Add tests
  • Add changes to documentation (guides, repository pages, code comments)
  • Add security check
  • Add new Parse Error codes to Parse JS SDK

Summary by CodeRabbit

  • Tests

    • Added test cases for encoded path traversal security scenarios.
  • Bug Fixes

    • Fixed a critical security vulnerability in path validation that prevented protection against encoded path traversal attacks attempting to access files outside the configured pages directory. Requests trying to reach sibling directories now properly return 404 errors, preventing unauthorized file exposure.

@parse-github-assistant
Copy link

I will reformat the title to use the proper commit message syntax.

@parse-github-assistant parse-github-assistant bot changed the title fix: m6wh-9 fix: M6wh-9 Mar 5, 2026
@parse-github-assistant
Copy link

parse-github-assistant bot commented Mar 5, 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 Scanner 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 5, 2026

📝 Walkthrough

Walkthrough

These changes add a security test for path traversal attacks and harden the path validation logic in PagesRouter to prevent access to sibling directories with shared name prefixes by requiring an explicit path separator after the pagesPath.

Changes

Cohort / File(s) Summary
Path Traversal Security
spec/PagesRouter.spec.js, src/Routers/PagesRouter.js
Adds test case validating protection against encoded path traversal attacks targeting sibling directories, and updates readFile path anchor to require path separator after pagesPath for stricter directory boundary enforcement.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description is incomplete. While it identifies the issue and references the security advisory, the Approach section is missing and most tasks are unchecked despite the PR containing implementation changes. Add an Approach section explaining the specific path traversal fix (requiring path separator in guard condition), and clarify which remaining tasks are applicable or complete.
✅ 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 clearly and specifically identifies the security vulnerability being fixed (path traversal in PagesRouter) and references the CVE identifier (GHSA-hm3f-q6rw-m6wh), directly matching the main changes in the PR.

✏️ 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

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.

@mtrezza mtrezza changed the title fix: M6wh-9 fix: PagesRouter path traversal allows reading files outside configured pages directory (GHSA-hm3f-q6rw-m6wh) Mar 5, 2026
@mtrezza mtrezza merged commit e772543 into parse-community:alpha Mar 5, 2026
22 checks passed
@mtrezza mtrezza deleted the fix/m6wh-9 branch March 5, 2026 23:50
parseplatformorg pushed a commit that referenced this pull request Mar 5, 2026
# [9.5.0-alpha.8](9.5.0-alpha.7...9.5.0-alpha.8) (2026-03-05)

### Bug Fixes

* `PagesRouter` path traversal allows reading files outside configured pages directory ([GHSA-hm3f-q6rw-m6wh](https://github.com/parse-community/parse-server/security/advisories/GHSA-hm3f-q6rw-m6wh)) ([#10104](#10104)) ([e772543](e772543))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 9.5.0-alpha.8

@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.67%. Comparing base (2ae5db1) to head (89b27fe).
⚠️ Report is 3 commits behind head on alpha.

Additional details and impacted files
@@           Coverage Diff           @@
##            alpha   #10104   +/-   ##
=======================================
  Coverage   92.67%   92.67%           
=======================================
  Files         191      191           
  Lines       15856    15856           
  Branches      180      180           
=======================================
  Hits        14694    14694           
  Misses       1150     1150           
  Partials       12       12           

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

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