-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add security hardenings to $.ajax() #19014
Merged
DeepDiver1975
merged 3 commits into
master
from
dont-add-requestheaders-for-cross-domain-requests
Sep 15, 2015
Merged
Add security hardenings to $.ajax() #19014
DeepDiver1975
merged 3 commits into
master
from
dont-add-requestheaders-for-cross-domain-requests
Sep 15, 2015
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A new inspection was created. |
@MorrisJobke @nickvergessen Mind testing? :) |
Does this effect |
Prevents leaking the CSRF token to another third-party domain by mistake.
If a response to a $.ajax() request returns a content type of "application/javascript" JQuery would previously execute the response body. This is a pretty unexpected behaviour and can result in a bypass of our Content-Security-Policy as well as multiple unexpected XSS vectors.
No. Tested with: $.get('http://localhost/test.php'); $.getScript('http://localhost/test.php'); <?php
header('Content-Type: application/javascript');
?>
alert(1); |
LukasReschke
force-pushed
the
dont-add-requestheaders-for-cross-domain-requests
branch
from
September 15, 2015 09:44
a6fb35c
to
f2d63d3
Compare
👍 |
Looks good! And your testcase works as expected. 👍 |
👍 Tested |
DeepDiver1975
added a commit
that referenced
this pull request
Sep 15, 2015
…ross-domain-requests Add security hardenings to $.ajax()
DeepDiver1975
deleted the
dont-add-requestheaders-for-cross-domain-requests
branch
September 15, 2015 22:16
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds two security hardening to
$.ajax
:JQuery would previously execute the response body. This is a pretty unexpected
behaviour and can result in a bypass of our Content-Security-Policy as well as
multiple unexpected XSS vectors.