-
Notifications
You must be signed in to change notification settings - Fork 10
SVG sanitization for XSS #574
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
Conversation
| ) | ||
|
|
||
| # Escape the title to prevent XSS | ||
| escaped_title = escape(title, quote=True) |
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.
do we have some tests we can run to make sure this works?
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.
Added
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #574 +/- ##
=======================================
Coverage 93.85% 93.85%
=======================================
Files 1284 1284
Lines 46428 46430 +2
Branches 1524 1524
=======================================
+ Hits 43574 43577 +3
+ Misses 2545 2544 -1
Partials 309 309
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
thomasrockhu-codecov
left a comment
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.
I'd probably have Michelle check this and make sure this is how we want to handle (not sure if title is the only attack vector
michelletran-sentry
left a comment
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.
Sanitizing the title will mitigate the reported attack. So this LGTM!
|
The reporter had some other suggestions to mitigate issues:
Can we keep going and escape everything in all the string-templates in this file? Also, the note about CSP policy, sounds like it was removed? We should be including that in all responses. I can get the security team involved there to help figure out what the specific directive values should be, I'd like to see that followup ticket too. edit: ah found some csp stuf completed here: #531 👍 |
|
I checked all the other strings in the svg and they were all numeric strings generated by internal functions so I believe they should be safe. |
kk, cool! lets do it then |
https://linear.app/getsentry/issue/CCMRG-1609/sec-stored-xss-in-svg-graph
Adds some cleaning in the svg to prevent XSS attackes
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.