Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svg sanitizing #5120

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

svg sanitizing #5120

wants to merge 2 commits into from

Conversation

robinmolen
Copy link
Contributor

Closes open-formulieren/security-issues#35

Changes

Added svg sanitizing to SVGOrImageField

Checklist

Check off the items that are completed or not relevant.

  • Impact on features

    • Checked copying a form
    • Checked import/export of a form
    • Config checks in the configuration overview admin page
    • Problem detection in the admin email digest is handled
  • Release management

    • I have labelled the PR as "needs-backport" accordingly
  • I have updated the translations assets (you do NOT need to provide translations)

    • Ran ./bin/makemessages_js.sh
    • Ran ./bin/compilemessages_js.sh
  • Dockerfile/scripts

    • Updated the Dockerfile with the necessary scripts from the ./bin folder
  • Commit hygiene

    • Commit messages refer to the relevant Github issue
    • Commit messages explain the "why" of change, not the how

Copy link

codecov bot commented Feb 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.73%. Comparing base (e7e8155) to head (16355a9).
Report is 8 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5120   +/-   ##
=======================================
  Coverage   96.73%   96.73%           
=======================================
  Files         775      776    +1     
  Lines       26662    26681   +19     
  Branches     3468     3469    +1     
=======================================
+ Hits        25792    25811   +19     
  Misses        608      608           
  Partials      262      262           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@viktorvanwijk viktorvanwijk left a comment

Choose a reason for hiding this comment

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

Nice, just a few things keep in mind :)

Added svg sanitation to the SVGOrImageField class, using the bleach library.

The sanitation eliminates script tags, event handlers and non-essential tags and attributes (like Animation stuff, data-*, href)

The allowed tags and attributes are derived from the MDN documentation about SVG content.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants