Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7k
Avoid inline script execution for injecting CSRF token#7016
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Farisiimoet3 commentedNov 2, 2019
Unsubscribe |
dca1374 to95b9ef8CompareThis issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Scripts with type="application/json" or "text/plain" are not executed, so we canuse them to inject dynamic CSRF data, without allowing inline-script executionin Content-Security-Policy.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
juspence commentedOct 28, 2022
@tomchristie Is there any way I can help get this PR (as well as#5740 and#7960) merged? I'm happy to help test and provide feedback. Merging any of these would help to resolve#6069, which is blocking me from using stricter Cross-Site Scripting (XSS) protections. |
twbagustin commentedNov 15, 2022
Replying on this one seems more up to date, since#5740 seems a bit outdated (shows conflicts),#7960 does seem a bit off because |
lovelydinosaur commentedNov 21, 2022
I'm happy to add collaborators to the @encode/django-rest-framework team if asked. |
juspence commentedNov 28, 2022
@tomchristie I can't commit to spending any effort beyond this one feature. If that's still OK, please add me to the encode/drf team, and I'll review, test, and merge these three PRs (#5740,#7016, and#7960). Thank you! |
auvipy commentedNov 29, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
you can handle this one and I can help you review and merge this. we now have 3 more new maintainers. can you test and share your feedback on this PR? after your confirmation I can merge it. the other open PR's need more works before merge. |
lovelydinosaur commentedNov 29, 2022
@juspence - Invite sent. |
juspence commentedNov 29, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@auvipy This looks good to me. I tested Django-REST-Framework without this change in Firefox 102.4.0esr and Chrome 106.0.5249.119, using a Content-Security-Policy like "script-src: 'self'" that doesn't allow inline scripts. I saw the below error for the CSRF script in the developer console, like I expected: Then I tested again with this change, and the above error went away. |
lovelydinosaur commentedNov 29, 2022
@juspence - Great. You're welcome to approve pull requests that you're happy with. |
Uh oh!
There was an error while loading.Please reload this page.
Description
Scripts with type="application/json" or "text/plain" are not executed, so we can use them to inject dynamic CSRF data, without allowing inline-script execution in Content-Security-Policy.
This helps towards fixing#6069 a bit.