-
Notifications
You must be signed in to change notification settings - Fork 27
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
Sanitizing HTML from component label, tooltip and description #5121
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5121 +/- ##
==========================================
- Coverage 96.75% 96.74% -0.01%
==========================================
Files 778 779 +1
Lines 26741 26774 +33
Branches 3474 3483 +9
==========================================
+ Hits 25873 25903 +30
- Misses 606 607 +1
- Partials 262 264 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
eb578a3
to
fa13953
Compare
eb970b1
to
899fced
Compare
This functionality is only tested on backend api level. We cannot nicely test the frontend sanitizing, because e2e tests will just become bloated/ugly/unreadable. |
334b156
to
5ca577a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice :)
…g the form definition components content Testing the create and update proces of form definitions
5ca577a
to
537876f
Compare
…ng for form definition components When creating or updating a form definition, the components are sanitized on HTML content. Currently only the component tooltip, description and label will be sanitized. The sanitizing is done using bleach, and uses a list of allowed tags and attributes. Any html that isn't defined in these lists, will be removed. The content of such a disallowed html component will remain
…onent data Added a simplistic sanitize function that sanitizes component data when saving the component. This function removes most HTML content from the label, tooltip, description and placeholder component data. Only basic semantic tags (`a`, `b`, `em`, `i`, `string`, `u`) are allowed. Also the allowed attributes has been limited to `href` on `a` tags.
537876f
to
1d1a642
Compare
Closes open-formulieren/security-issues#36
Changes
Added a simplistic sanitize function that sanitizes component label, tooltip and description when saving the component. This function allows a list of HTML tags and attributes, based on what formbuilders are currently using. Any html tags/attributes, that aren't in the allow list, are removed (only their content remains).
Checklist
Check off the items that are completed or not relevant.
Impact on features
Release management
I have updated the translations assets (you do NOT need to provide translations)
./bin/makemessages_js.sh
./bin/compilemessages_js.sh
Dockerfile/scripts
./bin
folderCommit hygiene