Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7k
Fix XSS caused by disabled autoescaping in the default DRF Browsable API view templates#6330
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Fix XSS caused by disabled autoescaping in the default DRF Browsable API view templates#6330
Uh oh!
There was an error while loading.Please reload this page.
Conversation
rpkilby commentedNov 21, 2018
Thanks for adding the test case@zyv. |
rpkilby commentedDec 10, 2018
Hi@zyv. I need to dig in to this more fully, but I'm not 100% that the test demonstrates the correct behavior. Basically, this test ensures that I think what we need instead are tests for the browsable API templates. By default, the browsable APIshould escape links once. And from there, we would then need to fix the templates and how/when it autoescapes. Again, I'm not 100% on what the correct answer here is - I'd need to look at the base template and |
zyv commentedDec 14, 2018
Hi@rpkilby, you are right that my test doesn't demonstrate the correct expected behaviour of Anyways, I've now finally managed to find some time to look into it, and have fixed the test, as well as (hopefully) found a solution to the problem. I would appreciate if you could have a look at my new commits. A more detailed explanation of what/why they do follows: I believe that the initial author of I have changed the function to correctly mark final string as safe and also got rid of the crazy escaping logic, so that hopefully it is now clearer what the function does (and what it does not). |
rpkilby commentedDec 14, 2018
👌 nice. I'll take a look at this over the weekend. I really appreciate the effort you put into this. |
carltongibson commentedDec 14, 2018
Thanks for the work@zyv! I will be preparing 3.9.1 next week. A fix here will be part of that. Your efforts are greatly appreciated. |
lovelydinosaur commentedJan 16, 2019
Looks correct to me, yup. |
Details inencode/django-rest-framework#6330Change-Id: Icea25569b92c3559029ae1c93712e746684187f1
This resolves a XSS vulnerability(encode/django-rest-framework#6330).
…API view templates (encode#6330)* Add test that verifies that HTML is correctly escaped in Browsable API views* Fix `urlize_quoted_links` tag to avoid double escaping in autoescape mode* Fix XSS in default DRF Browsable API template by re-enabling autoescape
As requested in#6191.