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

Unified Diff: content/browser/frame_host/ancestor_throttle.cc

Issue 1969743002: XFO: Bypass ancestor checks for 'Content-Disposition: attachment; ...' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
Index: content/browser/frame_host/ancestor_throttle.cc
diff --git a/content/browser/frame_host/ancestor_throttle.cc b/content/browser/frame_host/ancestor_throttle.cc
index 0a148c08386c27a660ae38974e27a6f02e6885df..03f183937ec428d810bfc941186705ebe01e7c2f 100644
--- a/content/browser/frame_host/ancestor_throttle.cc
+++ b/content/browser/frame_host/ancestor_throttle.cc
@@ -14,6 +14,7 @@
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/navigation_throttle.h"
#include "content/public/common/console_message_level.h"
+#include "net/http/http_content_disposition.h"
#include "net/http/http_response_headers.h"
#include "url/origin.h"
@@ -159,7 +160,8 @@ AncestorThrottle::HeaderDisposition AncestorThrottle::ParseHeader(
// If 'X-Frame-Options' would potentially block the response, check whether
// the 'frame-ancestors' CSP directive should take effect instead. See
- // https://www.w3.org/TR/CSP/#frame-ancestors-and-frame-options
+ // https://www.w3.org/TR/CSP/#frame-ancestors-and-frame-options. Also, check
+ // whether the response should be treated as a download.
if (result != HeaderDisposition::NONE &&
result != HeaderDisposition::ALLOWALL) {
iter = 0;
@@ -179,6 +181,13 @@ AncestorThrottle::HeaderDisposition AncestorThrottle::ParseHeader(
return HeaderDisposition::BYPASS;
}
}
+
+ iter = 0;
+ value = std::string();
+ while (headers->EnumerateHeader(&iter, "content-disposition", &value)) {
+ if (net::HttpContentDisposition(value, std::string()).is_attachment())
+ return HeaderDisposition::BYPASS;
+ }
}
return result;
}
« no previous file with comments | « content/browser/frame_host/ancestor_throttle.h ('k') | content/browser/frame_host/ancestor_throttle_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698