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

Unified Diff: third_party/WebKit/Source/core/frame/csp/CSPSource.h

Issue 2442513004: Part 1.1: Is policy list subsumed under subsuming policy? (Closed)
Patch Set: CSPSource subsumption Created 4 years, 1 month 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: third_party/WebKit/Source/core/frame/csp/CSPSource.h
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPSource.h b/third_party/WebKit/Source/core/frame/csp/CSPSource.h
index b049bf6c87966def6e30c4eb3fb72696f106021d..450b56a948f5febb3768a8c477af9a1ea8132f60 100644
--- a/third_party/WebKit/Source/core/frame/csp/CSPSource.h
+++ b/third_party/WebKit/Source/core/frame/csp/CSPSource.h
@@ -31,16 +31,32 @@ class CORE_EXPORT CSPSource : public GarbageCollectedFinalized<CSPSource> {
bool matches(const KURL&,
ResourceRequest::RedirectStatus =
ResourceRequest::RedirectStatus::NoRedirect) const;
+ // Check whether this CSPSource is subsumed under a given CSPSource for a
jochen (gone - plz use gerrit) 2016/11/02 11:11:33 nit. add empty line before this one
+ // subsumption algorithm described here:
+ // https://w3c.github.io/webappsec-csp/embedded/#subsume-policy
+ bool isSubsumedBy(CSPSource*);
DECLARE_TRACE();
private:
+ FRIEND_TEST_ALL_PREFIXES(CSPSourceTest, IsSimilar);
+
bool schemeMatches(const String&) const;
bool hostMatches(const String&) const;
bool pathMatches(const String&) const;
// Protocol is necessary to determine default port if it is zero.
bool portMatches(int port, const String& protocol) const;
bool isSchemeOnly() const;
+ bool isPathEmptyOrSlashOnly() const;
+ // Check if either one of the two matches the scheme, host, port, path of the
+ // other. More detailed explanation here:
+ // https://docs.google.com/document/d/1xwTxpB_sWYaTrOBJEPSXtfWKO4M2k9Xya7o0zcd6Dec/edit#heading=h.9efhej5pg0hj
jochen (gone - plz use gerrit) 2016/11/02 11:11:33 if you put links in the source, please make this a
+ bool isSimilar(CSPSource* other);
+
+ bool isWildcardsSubsumedBy(CSPSource* other);
jochen (gone - plz use gerrit) 2016/11/02 11:11:33 isWildcard or areWildcards
+ bool isSchemeSubsumedBy(CSPSource* other);
+ bool isPortSubsumedBy(CSPSource* other);
+ bool isPathSubsumedBy(CSPSource* other);
Member<ContentSecurityPolicy> m_policy;
String m_scheme;

Powered by Google App Engine
This is Rietveld 408576698