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

Unified Diff: Source/core/frame/ContentSecurityPolicy.h

Issue 26481005: Implementation of script hashes for CSP. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More fixes from mkwst comments Created 7 years, 2 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: Source/core/frame/ContentSecurityPolicy.h
diff --git a/Source/core/frame/ContentSecurityPolicy.h b/Source/core/frame/ContentSecurityPolicy.h
index 927d8532c99f13ba35368860272d0a835995e651..b2f828adb1e660f116f33bfc83481b10546459ce 100644
--- a/Source/core/frame/ContentSecurityPolicy.h
+++ b/Source/core/frame/ContentSecurityPolicy.h
@@ -75,6 +75,12 @@ public:
SuppressReport
};
+ enum HashFunctions {
+ HashFunctionsNone = 0x0,
+ HashFunctionsSha1 = 0x1,
+ HashFunctionsSha256 = 0x2
abarth-chromium 2013/10/22 17:46:49 It looks like you're using this as a bit field. T
jww 2013/10/28 19:36:23 Done.
+ };
+
void didReceiveHeaders(const ContentSecurityPolicyResponseHeaders&);
void didReceiveHeader(const String&, HeaderType);
@@ -102,6 +108,9 @@ public:
bool allowBaseURI(const KURL&, ReportingStatus = SendReport) const;
bool allowScriptNonce(const String& nonce) const;
bool allowStyleNonce(const String& nonce) const;
+ bool allowScriptHash(const String& source) const;
+
+ void usesScriptHashFunctions(uint8_t hashFunctions);
ReflectedXSSDisposition reflectedXSSDisposition() const;
@@ -114,7 +123,6 @@ public:
void reportDuplicateDirective(const String&) const;
void reportInvalidDirectiveValueCharacter(const String& directiveName, const String& value) const;
void reportInvalidPathCharacter(const String& directiveName, const String& value, const char) const;
- void reportInvalidNonce(const String&) const;
void reportInvalidPluginTypes(const String&) const;
void reportInvalidSandboxFlags(const String&) const;
void reportInvalidSourceExpression(const String& directiveName, const String& source) const;
@@ -151,6 +159,11 @@ private:
CSPDirectiveListVector m_policies;
HashSet<unsigned, AlreadyHashed> m_violationReportsSent;
+
+ // We put the hash functions used on the policy object so that we only need
+ // to calculate a script hash once and then distribute it to all of the
+ // directives for validation.
+ uint8_t m_sourceHashFunctionsUsed;
};
}

Powered by Google App Engine
This is Rietveld 408576698