summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/page/csp/ContentSecurityPolicySourceList.h
diff options
context:
space:
mode:
authorKonstantin Tokarev <annulen@yandex.ru>2018-01-11 05:56:18 +0300
committerLiang Qi <liang.qi@qt.io>2018-01-11 10:25:26 +0000
commit79143ccfc158ec4fffc49eee600d600edb342b16 (patch)
tree0e078499d8fe3e8627e3612537e61f2dd1029625 /Source/WebCore/page/csp/ContentSecurityPolicySourceList.h
parentcb895f50d5c08976c0f5ecbb82e6bd19d9ea090d (diff)
Import WebKit commit a8b574fb3cd509a2d3f2a1568ad0a66d1bf0f6e8
Change-Id: I66add69e6d08b74111ec8e7e4401e4d813501206 Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebCore/page/csp/ContentSecurityPolicySourceList.h')
-rw-r--r--Source/WebCore/page/csp/ContentSecurityPolicySourceList.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/Source/WebCore/page/csp/ContentSecurityPolicySourceList.h b/Source/WebCore/page/csp/ContentSecurityPolicySourceList.h
index fdb9b7e09..811b6cec1 100644
--- a/Source/WebCore/page/csp/ContentSecurityPolicySourceList.h
+++ b/Source/WebCore/page/csp/ContentSecurityPolicySourceList.h
@@ -27,8 +27,11 @@
#ifndef ContentSecurityPolicySourceList_h
#define ContentSecurityPolicySourceList_h
+#include "ContentSecurityPolicyHash.h"
#include "ContentSecurityPolicySource.h"
-#include <wtf/Vector.h>
+#include <wtf/HashSet.h>
+#include <wtf/OptionSet.h>
+#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -41,8 +44,14 @@ public:
ContentSecurityPolicySourceList(const ContentSecurityPolicy&, const String& directiveName);
void parse(const String&);
+
bool matches(const URL&);
- bool allowInline() const { return m_allowInline; }
+ bool matches(const ContentSecurityPolicyHash&) const;
+ bool matches(const String& nonce) const;
+
+ OptionSet<ContentSecurityPolicyHashAlgorithm> hashAlgorithmsUsed() const { return m_hashAlgorithmsUsed; }
+
+ bool allowInline() const { return m_allowInline && m_hashes.isEmpty() && m_nonces.isEmpty(); }
bool allowEval() const { return m_allowEval; }
bool allowSelf() const { return m_allowSelf; }
@@ -55,10 +64,17 @@ private:
bool parsePort(const UChar* begin, const UChar* end, int& port, bool& portHasWildcard);
bool parsePath(const UChar* begin, const UChar* end, String& path);
+ bool parseNonceSource(const UChar* begin, const UChar* end);
+
bool isProtocolAllowedByStar(const URL&) const;
+ bool parseHashSource(const UChar* begin, const UChar* end);
+
const ContentSecurityPolicy& m_policy;
Vector<ContentSecurityPolicySource> m_list;
+ HashSet<String> m_nonces;
+ HashSet<ContentSecurityPolicyHash> m_hashes;
+ OptionSet<ContentSecurityPolicyHashAlgorithm> m_hashAlgorithmsUsed;
String m_directiveName;
bool m_allowSelf { false };
bool m_allowStar { false };