fix: Stored XSS filter bypass via Content-Type MIME parameter and missing XML extension blocklist entries (GHSA-42ph-pf9q-cr72)#10191
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. |
📝 WalkthroughWalkthroughExpanded upload-blocklist to include additional XML-related extensions, added three FileUploadOptions boolean flags controlling upload access, improved Content-Type parsing to strip MIME parameters when deriving extensions, and added (duplicate) tests asserting blocking of XML-related uploads including parameterized Content-Types. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## alpha #10191 +/- ##
=======================================
Coverage 92.61% 92.61%
=======================================
Files 192 192
Lines 16255 16255
Branches 190 190
=======================================
Hits 15055 15055
Misses 1187 1187
Partials 13 13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/Options/index.js (1)
660-661: Make the allowlist example regex-safe.The matcher still does
new RegExp(ext)for each entry, so["jpg", "jpeg"]is substring matching rather than exact extension matching, and metacharacters like+need escaping. Consider documenting anchored patterns here (for example["^jpg$", "^jpeg$", "^png$", "^gif$", "^webp$"]) or explicitly stating that entries are regexes.Based on learnings: make changes in
src/Options/index.jsfirst, then runnpm run definitionsto syncsrc/Options/Definitions.jsandsrc/Options/docs.js.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Options/index.js` around lines 660 - 661, Update the Options docs to make the allowlist example regex-safe by either documenting that entries are treated as regular expressions (so users must escape metacharacters) or replacing the plain examples with anchored regex strings (e.g., "^jpg$", "^jpeg$", "^png$", "^gif$", "^webp$") in src/Options/index.js (the DEFAULT comment/description for the allowed file extensions), then run `npm run definitions` to regenerate src/Options/Definitions.js and src/Options/docs.js so the changes propagate.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/Routers/FilesRouter.js`:
- Around line 371-372: The MIME-parameter stripping only removes literal spaces
causing tab or other whitespace to persist; in FilesRouter.js update the
normalization of the extension variable (where extension is set and currently
uses split(' ')...join('')) to remove all whitespace characters (e.g. use a
regex-based replace like replacing /\s+/g) so values like
"application/xhtml+xml\t;charset=utf-8" normalize correctly, and add a
regression test that passes a MIME string with a tab-separated parameter (e.g.
containing "\t") to the handler that checks the denylist matching behavior.
---
Nitpick comments:
In `@src/Options/index.js`:
- Around line 660-661: Update the Options docs to make the allowlist example
regex-safe by either documenting that entries are treated as regular expressions
(so users must escape metacharacters) or replacing the plain examples with
anchored regex strings (e.g., "^jpg$", "^jpeg$", "^png$", "^gif$", "^webp$") in
src/Options/index.js (the DEFAULT comment/description for the allowed file
extensions), then run `npm run definitions` to regenerate
src/Options/Definitions.js and src/Options/docs.js so the changes propagate.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 890ed83b-99a4-4f8b-b6c9-addaf1447b8e
📒 Files selected for processing (5)
spec/vulnerabilities.spec.jssrc/Options/Definitions.jssrc/Options/docs.jssrc/Options/index.jssrc/Routers/FilesRouter.js
# [9.6.0-alpha.15](9.6.0-alpha.14...9.6.0-alpha.15) (2026-03-13) ### Bug Fixes * Stored XSS filter bypass via Content-Type MIME parameter and missing XML extension blocklist entries ([GHSA-42ph-pf9q-cr72](GHSA-42ph-pf9q-cr72)) ([#10191](#10191)) ([4f53ab3](4f53ab3))
|
🎉 This change has been released in version 9.6.0-alpha.15 |
Pull Request
Issue
Stored XSS filter bypass via Content-Type MIME parameter and missing XML extension blocklist entries (GHSA-42ph-pf9q-cr72)
Tasks