Repository navigation
Strip potentially dangerous tags from SVG files - #12687
Conversation
✅ Deploy Preview for inventree-web-pui-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This pull request tightens SVG sanitization by removing SMIL animation elements from the allowed SVG tag/attribute allowlists, and adds a regression test to guard against a known “SMIL sets href to javascript: at render-time” bypass pattern.
Changes:
- Remove SMIL animation-related SVG elements (e.g.
set,animate*) fromALLOWED_ELEMENTS_SVG. - Remove a set of SMIL/animation-related attributes (e.g.
to,from,values,attributeName) fromALLOWED_ATTRIBUTES_SVG. - Add a new unit test covering a SMIL-based
javascript:smuggling technique.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/backend/InvenTree/InvenTree/sanitizer.py | Tightens the SVG allowlist by excluding SMIL animation elements/attributes and documents the security rationale. |
| src/backend/InvenTree/InvenTree/tests.py | Adds a regression test to ensure SMIL elements cannot smuggle javascript: URLs through SVG sanitization. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #12687 +/- ##
=======================================
Coverage 86.79% 86.80%
=======================================
Files 1455 1455
Lines 97521 97520 -1
Branches 11402 11405 +3
=======================================
+ Hits 84640 84648 +8
+ Misses 12815 12806 -9
Partials 66 66
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation and see the Github Action logs for details |
(cherry picked from commit f16fb36) Co-authored-by: Oliver <[email protected]>

No description provided.