Skip to content

fix: Stored XSS via non-standard file extension bypassing file upload extension blocklist (GHSA-v8x7-r927-cc93)#10505

Merged
mtrezza merged 1 commit into
parse-community:alphafrom
mtrezza:fix/GHSA-v8x7-r927-cc93-v9
Jun 16, 2026
Merged

fix: Stored XSS via non-standard file extension bypassing file upload extension blocklist (GHSA-v8x7-r927-cc93)#10505
mtrezza merged 1 commit into
parse-community:alphafrom
mtrezza:fix/GHSA-v8x7-r927-cc93-v9

Conversation

@mtrezza

@mtrezza mtrezza commented Jun 14, 2026

Copy link
Copy Markdown
Member

Issue

Stored XSS via non-standard file extension bypassing file upload extension blocklist (GHSA-v8x7-r927-cc93)

Tasks

  • Add tests

@parse-github-assistant

parse-github-assistant Bot commented Jun 14, 2026

Copy link
Copy Markdown

🚀 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

  • Keep pull requests small. Large PRs will be rejected. Break complex features into smaller, incremental PRs.
  • Use Test Driven Development. Write failing tests before implementing functionality. Ensure tests pass.
  • Group code into logical blocks. Add a short comment before each block to explain its purpose.
  • We offer conceptual guidance. Coding is up to you. PRs must be merge-ready for human review.
  • Our review focuses on concept, not quality. PRs with code issues will be rejected. Use an AI agent.
  • Human review time is precious. Avoid review ping-pong. Inspect and test your AI-generated code.

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. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

FilesRouter.createHandler is refactored to separately derive the filename extension and the Content-Type header subtype, introducing a rejectExtension helper and using mime.getType to determine whether the filename extension is recognized. The blocklist is enforced on the filename extension unconditionally and on the content-type extension only as a fallback. Three new tests verify rejection of non-standard SVG/HTML filename variants and acceptance of a safe non-standard extension.

Changes

File Extension Blocklist Validation

Layer / File(s) Summary
FilesRouter extension parsing and blocklist enforcement
src/Routers/FilesRouter.js
Imports mime at the start of createHandler; adds a rejectExtension helper; separately parses extension from the filename and contentTypeExtension from the Content-Type subtype; applies the disabled-extension blocklist to extension first, then conditionally to contentTypeExtension only when mime does not recognize the filename extension.
Validation tests for non-standard filename extensions
spec/ParseFile.spec.js
Adds three test cases: rejects multiple non-standard SVG filename variants (e.g., file.svg~, file.svg.tmp) with image/svg+xml content type; rejects non-standard HTML variants (e.g., file.html.old, file.html~) with text/html content type; accepts archive.bak with image/png content type.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • parse-community/parse-server#10383: Modifies FilesController.createFile MIME resolution and adds mismatch tests, directly overlapping with this PR's Content-Type vs. filename extension validation changes in the upload path.
  • parse-community/parse-server#10191: Updates FilesRouter.createHandler extension derivation from the Content-Type header including MIME parameter/whitespace handling, which is the same code section refactored in this PR.
  • parse-community/parse-server#10489: Adjusts filename extension/content-type derivation and blocklist enforcement in FilesRouter, with new tests for unusual extension variants — directly parallel to the changes in this PR.
🚥 Pre-merge checks | ✅ 6 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is entirely missing. No content was provided addressing the required sections such as Issue, Approach, or Tasks outlined in the template. Add a comprehensive pull request description following the template, including Issue (link to GHSA-v8x7-r927-cc93), Approach (explain the validation changes), and check completed Tasks.
✅ Passed checks (6 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Security Check ✅ Passed The PR properly fixes XSS vulnerabilities (CVE-2026-30948, CVE-2026-31868) by validating both filename extensions and Content-Type headers. The fix prevents attackers from uploading dangerous files...
Engage In Review Feedback ✅ Passed PR 10505 shows no review feedback comments or resolved discussions in git history. Without feedback to engage with, the requirement to "engage in review feedback" is not applicable.
Title check ✅ Passed The pull request title begins with the required 'fix:' prefix and clearly describes the main security fix addressing a stored XSS vulnerability via non-standard file extensions.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@codecov

codecov Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.62%. Comparing base (30f1612) to head (7885d88).

Additional details and impacted files
@@            Coverage Diff             @@
##            alpha   #10505      +/-   ##
==========================================
- Coverage   92.62%   92.62%   -0.01%     
==========================================
  Files         193      193              
  Lines       16947    16954       +7     
  Branches      240      240              
==========================================
+ Hits        15698    15703       +5     
- Misses       1226     1228       +2     
  Partials       23       23              

☔ View full report in Codecov by Harness.
📢 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-v8x7-r927-cc93 fix: Stored XSS via non-standard file extension bypassing file upload extension blocklist (GHSA-v8x7-r927-cc93) Jun 15, 2026
@mtrezza mtrezza merged commit be12a60 into parse-community:alpha Jun 16, 2026
23 of 24 checks passed
parseplatformorg pushed a commit that referenced this pull request Jun 16, 2026
## [9.9.1-alpha.11](9.9.1-alpha.10...9.9.1-alpha.11) (2026-06-16)

### Bug Fixes

* Stored XSS via non-standard file extension bypassing file upload extension blocklist ([GHSA-v8x7-r927-cc93](GHSA-v8x7-r927-cc93)) ([#10505](#10505)) ([be12a60](be12a60))
@mtrezza mtrezza deleted the fix/GHSA-v8x7-r927-cc93-v9 branch June 16, 2026 00:43
@parseplatformorg

Copy link
Copy Markdown
Contributor

🎉 This change has been released in version 9.9.1-alpha.11

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Jun 16, 2026
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