Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1417)

Unified Diff: Source/core/xml/XMLHttpRequest.cpp

Issue 13979011: Block all scripts from setting unsafe headers in XMLHttpRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix the header. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/xmlhttprequest/set-dangerous-headers-local-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/XMLHttpRequest.cpp
diff --git a/Source/core/xml/XMLHttpRequest.cpp b/Source/core/xml/XMLHttpRequest.cpp
index 7ac3d25f622e78d82bc500de0708943fcbcb96b6..721eb66d658eea25e674ca40b10519df39fe5992 100644
--- a/Source/core/xml/XMLHttpRequest.cpp
+++ b/Source/core/xml/XMLHttpRequest.cpp
@@ -921,8 +921,8 @@ void XMLHttpRequest::setRequestHeader(const AtomicString& name, const String& va
return;
}
- // A privileged script can set any headers.
- if (!securityOrigin()->canLoadLocalResources() && !isAllowedHTTPHeader(name)) {
+ // No script (privileged or not) can set unsafe headers.
+ if (!isAllowedHTTPHeader(name)) {
logConsoleError(scriptExecutionContext(), "Refused to set unsafe header \"" + name + "\"");
return;
}
« no previous file with comments | « LayoutTests/fast/xmlhttprequest/set-dangerous-headers-local-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698