| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google, Inc. All rights reserved. | 2 * Copyright (C) 2011 Google, Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 | 861 |
| 862 uint8_t hashAlgorithmsUsed() const { return m_sourceList.hashAlgorithmsUsed(
); } | 862 uint8_t hashAlgorithmsUsed() const { return m_sourceList.hashAlgorithmsUsed(
); } |
| 863 | 863 |
| 864 private: | 864 private: |
| 865 CSPSourceList m_sourceList; | 865 CSPSourceList m_sourceList; |
| 866 }; | 866 }; |
| 867 | 867 |
| 868 class CSPDirectiveList { | 868 class CSPDirectiveList { |
| 869 WTF_MAKE_FAST_ALLOCATED; | 869 WTF_MAKE_FAST_ALLOCATED; |
| 870 public: | 870 public: |
| 871 static PassOwnPtr<CSPDirectiveList> create(ContentSecurityPolicy*, const UCh
ar* begin, const UChar* end, ContentSecurityPolicy::HeaderType); | 871 static PassOwnPtr<CSPDirectiveList> create(ContentSecurityPolicy*, const UCh
ar* begin, const UChar* end, ContentSecurityPolicy::HeaderType, ContentSecurityP
olicy::HeaderSource); |
| 872 | 872 |
| 873 void parse(const UChar* begin, const UChar* end); | 873 void parse(const UChar* begin, const UChar* end); |
| 874 | 874 |
| 875 const String& header() const { return m_header; } | 875 const String& header() const { return m_header; } |
| 876 ContentSecurityPolicy::HeaderType headerType() const { return m_headerType;
} | 876 ContentSecurityPolicy::HeaderType headerType() const { return m_headerType;
} |
| 877 ContentSecurityPolicy::HeaderSource headerSource() const { return m_headerSo
urce; } |
| 877 | 878 |
| 878 bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber&
contextLine, ContentSecurityPolicy::ReportingStatus) const; | 879 bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber&
contextLine, ContentSecurityPolicy::ReportingStatus) const; |
| 879 bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNu
mber& contextLine, ContentSecurityPolicy::ReportingStatus) const; | 880 bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNu
mber& contextLine, ContentSecurityPolicy::ReportingStatus) const; |
| 880 bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& c
ontextLine, ContentSecurityPolicy::ReportingStatus) const; | 881 bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& c
ontextLine, ContentSecurityPolicy::ReportingStatus) const; |
| 881 bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& co
ntextLine, ContentSecurityPolicy::ReportingStatus) const; | 882 bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& co
ntextLine, ContentSecurityPolicy::ReportingStatus) const; |
| 882 bool allowEval(ScriptState*, ContentSecurityPolicy::ReportingStatus) const; | 883 bool allowEval(ScriptState*, ContentSecurityPolicy::ReportingStatus) const; |
| 883 bool allowPluginType(const String& type, const String& typeAttribute, const
KURL&, ContentSecurityPolicy::ReportingStatus) const; | 884 bool allowPluginType(const String& type, const String& typeAttribute, const
KURL&, ContentSecurityPolicy::ReportingStatus) const; |
| 884 | 885 |
| 885 bool allowScriptFromSource(const KURL&, ContentSecurityPolicy::ReportingStat
us) const; | 886 bool allowScriptFromSource(const KURL&, ContentSecurityPolicy::ReportingStat
us) const; |
| 886 bool allowObjectFromSource(const KURL&, ContentSecurityPolicy::ReportingStat
us) const; | 887 bool allowObjectFromSource(const KURL&, ContentSecurityPolicy::ReportingStat
us) const; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 898 bool allowStyleHash(const SourceHashValue&) const; | 899 bool allowStyleHash(const SourceHashValue&) const; |
| 899 | 900 |
| 900 const String& evalDisabledErrorMessage() const { return m_evalDisabledErrorM
essage; } | 901 const String& evalDisabledErrorMessage() const { return m_evalDisabledErrorM
essage; } |
| 901 ReflectedXSSDisposition reflectedXSSDisposition() const { return m_reflected
XSSDisposition; } | 902 ReflectedXSSDisposition reflectedXSSDisposition() const { return m_reflected
XSSDisposition; } |
| 902 ReferrerPolicy referrerPolicy() const { return m_referrerPolicy; } | 903 ReferrerPolicy referrerPolicy() const { return m_referrerPolicy; } |
| 903 bool didSetReferrerPolicy() const { return m_didSetReferrerPolicy; } | 904 bool didSetReferrerPolicy() const { return m_didSetReferrerPolicy; } |
| 904 bool isReportOnly() const { return m_reportOnly; } | 905 bool isReportOnly() const { return m_reportOnly; } |
| 905 const Vector<KURL>& reportURIs() const { return m_reportURIs; } | 906 const Vector<KURL>& reportURIs() const { return m_reportURIs; } |
| 906 | 907 |
| 907 private: | 908 private: |
| 908 CSPDirectiveList(ContentSecurityPolicy*, ContentSecurityPolicy::HeaderType); | 909 CSPDirectiveList(ContentSecurityPolicy*, ContentSecurityPolicy::HeaderType,
ContentSecurityPolicy::HeaderSource); |
| 909 | 910 |
| 910 bool parseDirective(const UChar* begin, const UChar* end, String& name, Stri
ng& value); | 911 bool parseDirective(const UChar* begin, const UChar* end, String& name, Stri
ng& value); |
| 911 void parseReportURI(const String& name, const String& value); | 912 void parseReportURI(const String& name, const String& value); |
| 912 void parsePluginTypes(const String& name, const String& value); | 913 void parsePluginTypes(const String& name, const String& value); |
| 913 void parseReflectedXSS(const String& name, const String& value); | 914 void parseReflectedXSS(const String& name, const String& value); |
| 914 void parseReferrer(const String& name, const String& value); | 915 void parseReferrer(const String& name, const String& value); |
| 915 void addDirective(const String& name, const String& value); | 916 void addDirective(const String& name, const String& value); |
| 916 void applySandboxPolicy(const String& name, const String& sandboxPolicy); | 917 void applySandboxPolicy(const String& name, const String& sandboxPolicy); |
| 917 | 918 |
| 918 template <class CSPDirectiveType> | 919 template <class CSPDirectiveType> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 937 | 938 |
| 938 bool checkSourceAndReportViolation(SourceListDirective*, const KURL&, const
String& effectiveDirective) const; | 939 bool checkSourceAndReportViolation(SourceListDirective*, const KURL&, const
String& effectiveDirective) const; |
| 939 bool checkMediaTypeAndReportViolation(MediaListDirective*, const String& typ
e, const String& typeAttribute, const String& consoleMessage) const; | 940 bool checkMediaTypeAndReportViolation(MediaListDirective*, const String& typ
e, const String& typeAttribute, const String& consoleMessage) const; |
| 940 | 941 |
| 941 bool denyIfEnforcingPolicy() const { return m_reportOnly; } | 942 bool denyIfEnforcingPolicy() const { return m_reportOnly; } |
| 942 | 943 |
| 943 ContentSecurityPolicy* m_policy; | 944 ContentSecurityPolicy* m_policy; |
| 944 | 945 |
| 945 String m_header; | 946 String m_header; |
| 946 ContentSecurityPolicy::HeaderType m_headerType; | 947 ContentSecurityPolicy::HeaderType m_headerType; |
| 948 ContentSecurityPolicy::HeaderSource m_headerSource; |
| 947 | 949 |
| 948 bool m_reportOnly; | 950 bool m_reportOnly; |
| 949 bool m_haveSandboxPolicy; | 951 bool m_haveSandboxPolicy; |
| 950 ReflectedXSSDisposition m_reflectedXSSDisposition; | 952 ReflectedXSSDisposition m_reflectedXSSDisposition; |
| 951 | 953 |
| 952 bool m_didSetReferrerPolicy; | 954 bool m_didSetReferrerPolicy; |
| 953 ReferrerPolicy m_referrerPolicy; | 955 ReferrerPolicy m_referrerPolicy; |
| 954 | 956 |
| 955 OwnPtr<MediaListDirective> m_pluginTypes; | 957 OwnPtr<MediaListDirective> m_pluginTypes; |
| 956 OwnPtr<SourceListDirective> m_baseURI; | 958 OwnPtr<SourceListDirective> m_baseURI; |
| 957 OwnPtr<SourceListDirective> m_connectSrc; | 959 OwnPtr<SourceListDirective> m_connectSrc; |
| 958 OwnPtr<SourceListDirective> m_defaultSrc; | 960 OwnPtr<SourceListDirective> m_defaultSrc; |
| 959 OwnPtr<SourceListDirective> m_fontSrc; | 961 OwnPtr<SourceListDirective> m_fontSrc; |
| 960 OwnPtr<SourceListDirective> m_formAction; | 962 OwnPtr<SourceListDirective> m_formAction; |
| 961 OwnPtr<SourceListDirective> m_frameSrc; | 963 OwnPtr<SourceListDirective> m_frameSrc; |
| 962 OwnPtr<SourceListDirective> m_imgSrc; | 964 OwnPtr<SourceListDirective> m_imgSrc; |
| 963 OwnPtr<SourceListDirective> m_mediaSrc; | 965 OwnPtr<SourceListDirective> m_mediaSrc; |
| 964 OwnPtr<SourceListDirective> m_objectSrc; | 966 OwnPtr<SourceListDirective> m_objectSrc; |
| 965 OwnPtr<SourceListDirective> m_scriptSrc; | 967 OwnPtr<SourceListDirective> m_scriptSrc; |
| 966 OwnPtr<SourceListDirective> m_styleSrc; | 968 OwnPtr<SourceListDirective> m_styleSrc; |
| 967 | 969 |
| 968 Vector<KURL> m_reportURIs; | 970 Vector<KURL> m_reportURIs; |
| 969 | 971 |
| 970 String m_evalDisabledErrorMessage; | 972 String m_evalDisabledErrorMessage; |
| 971 }; | 973 }; |
| 972 | 974 |
| 973 CSPDirectiveList::CSPDirectiveList(ContentSecurityPolicy* policy, ContentSecurit
yPolicy::HeaderType type) | 975 CSPDirectiveList::CSPDirectiveList(ContentSecurityPolicy* policy, ContentSecurit
yPolicy::HeaderType type, ContentSecurityPolicy::HeaderSource source) |
| 974 : m_policy(policy) | 976 : m_policy(policy) |
| 975 , m_headerType(type) | 977 , m_headerType(type) |
| 978 , m_headerSource(source) |
| 976 , m_reportOnly(false) | 979 , m_reportOnly(false) |
| 977 , m_haveSandboxPolicy(false) | 980 , m_haveSandboxPolicy(false) |
| 978 , m_reflectedXSSDisposition(ReflectedXSSUnset) | 981 , m_reflectedXSSDisposition(ReflectedXSSUnset) |
| 979 , m_didSetReferrerPolicy(false) | 982 , m_didSetReferrerPolicy(false) |
| 980 , m_referrerPolicy(ReferrerPolicyDefault) | 983 , m_referrerPolicy(ReferrerPolicyDefault) |
| 981 { | 984 { |
| 982 m_reportOnly = type == ContentSecurityPolicy::Report; | 985 m_reportOnly = type == ContentSecurityPolicy::Report; |
| 983 } | 986 } |
| 984 | 987 |
| 985 PassOwnPtr<CSPDirectiveList> CSPDirectiveList::create(ContentSecurityPolicy* pol
icy, const UChar* begin, const UChar* end, ContentSecurityPolicy::HeaderType typ
e) | 988 PassOwnPtr<CSPDirectiveList> CSPDirectiveList::create(ContentSecurityPolicy* pol
icy, const UChar* begin, const UChar* end, ContentSecurityPolicy::HeaderType typ
e, ContentSecurityPolicy::HeaderSource source) |
| 986 { | 989 { |
| 987 OwnPtr<CSPDirectiveList> directives = adoptPtr(new CSPDirectiveList(policy,
type)); | 990 OwnPtr<CSPDirectiveList> directives = adoptPtr(new CSPDirectiveList(policy,
type, source)); |
| 988 directives->parse(begin, end); | 991 directives->parse(begin, end); |
| 989 | 992 |
| 990 if (!directives->checkEval(directives->operativeDirective(directives->m_scri
ptSrc.get()))) { | 993 if (!directives->checkEval(directives->operativeDirective(directives->m_scri
ptSrc.get()))) { |
| 991 String message = "Refused to evaluate a string as JavaScript because 'un
safe-eval' is not an allowed source of script in the following Content Security
Policy directive: \"" + directives->operativeDirective(directives->m_scriptSrc.g
et())->text() + "\".\n"; | 994 String message = "Refused to evaluate a string as JavaScript because 'un
safe-eval' is not an allowed source of script in the following Content Security
Policy directive: \"" + directives->operativeDirective(directives->m_scriptSrc.g
et())->text() + "\".\n"; |
| 992 directives->setEvalDisabledErrorMessage(message); | 995 directives->setEvalDisabledErrorMessage(message); |
| 993 } | 996 } |
| 994 | 997 |
| 995 if (directives->isReportOnly() && directives->reportURIs().isEmpty()) | 998 if (directives->isReportOnly() && directives->reportURIs().isEmpty()) |
| 996 policy->reportMissingReportURI(String(begin, end - begin)); | 999 policy->reportMissingReportURI(String(begin, end - begin)); |
| 997 | 1000 |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 } | 1583 } |
| 1581 | 1584 |
| 1582 ContentSecurityPolicy::~ContentSecurityPolicy() | 1585 ContentSecurityPolicy::~ContentSecurityPolicy() |
| 1583 { | 1586 { |
| 1584 } | 1587 } |
| 1585 | 1588 |
| 1586 void ContentSecurityPolicy::copyStateFrom(const ContentSecurityPolicy* other) | 1589 void ContentSecurityPolicy::copyStateFrom(const ContentSecurityPolicy* other) |
| 1587 { | 1590 { |
| 1588 ASSERT(m_policies.isEmpty()); | 1591 ASSERT(m_policies.isEmpty()); |
| 1589 for (CSPDirectiveListVector::const_iterator iter = other->m_policies.begin()
; iter != other->m_policies.end(); ++iter) | 1592 for (CSPDirectiveListVector::const_iterator iter = other->m_policies.begin()
; iter != other->m_policies.end(); ++iter) |
| 1590 addPolicyFromHeaderValue((*iter)->header(), (*iter)->headerType()); | 1593 addPolicyFromHeaderValue((*iter)->header(), (*iter)->headerType(), (*ite
r)->headerSource()); |
| 1591 } | 1594 } |
| 1592 | 1595 |
| 1593 void ContentSecurityPolicy::didReceiveHeaders(const ContentSecurityPolicyRespons
eHeaders& headers) | 1596 void ContentSecurityPolicy::didReceiveHeaders(const ContentSecurityPolicyRespons
eHeaders& headers) |
| 1594 { | 1597 { |
| 1595 if (!headers.contentSecurityPolicy().isEmpty()) | 1598 if (!headers.contentSecurityPolicy().isEmpty()) |
| 1596 didReceiveHeader(headers.contentSecurityPolicy(), ContentSecurityPolicy:
:Enforce); | 1599 didReceiveHeader(headers.contentSecurityPolicy(), ContentSecurityPolicy:
:Enforce, ContentSecurityPolicy::HeaderSourceHTTP); |
| 1597 if (!headers.contentSecurityPolicyReportOnly().isEmpty()) | 1600 if (!headers.contentSecurityPolicyReportOnly().isEmpty()) |
| 1598 didReceiveHeader(headers.contentSecurityPolicyReportOnly(), ContentSecur
ityPolicy::Report); | 1601 didReceiveHeader(headers.contentSecurityPolicyReportOnly(), ContentSecur
ityPolicy::Report, ContentSecurityPolicy::HeaderSourceHTTP); |
| 1599 | 1602 |
| 1600 // FIXME: Remove this reporting (and the 'xWebKitCSP*' methods) after the ne
xt release branch. | 1603 // FIXME: Remove this reporting (and the 'xWebKitCSP*' methods) after the ne
xt release branch. |
| 1601 if (m_client->isDocument()) { | 1604 if (m_client->isDocument()) { |
| 1602 Document* document = static_cast<Document*>(m_client); | 1605 Document* document = static_cast<Document*>(m_client); |
| 1603 if (!headers.xWebKitCSP().isEmpty()) | 1606 if (!headers.xWebKitCSP().isEmpty()) |
| 1604 UseCounter::countDeprecation(*document, UseCounter::PrefixedContentS
ecurityPolicy); | 1607 UseCounter::countDeprecation(*document, UseCounter::PrefixedContentS
ecurityPolicy); |
| 1605 if (!headers.xWebKitCSPReportOnly().isEmpty()) | 1608 if (!headers.xWebKitCSPReportOnly().isEmpty()) |
| 1606 UseCounter::countDeprecation(*document, UseCounter::PrefixedContentS
ecurityPolicyReportOnly); | 1609 UseCounter::countDeprecation(*document, UseCounter::PrefixedContentS
ecurityPolicyReportOnly); |
| 1607 } | 1610 } |
| 1608 } | 1611 } |
| 1609 | 1612 |
| 1610 void ContentSecurityPolicy::didReceiveHeader(const String& header, HeaderType ty
pe) | 1613 void ContentSecurityPolicy::didReceiveHeader(const String& header, HeaderType ty
pe, HeaderSource source) |
| 1611 { | 1614 { |
| 1612 addPolicyFromHeaderValue(header, type); | 1615 addPolicyFromHeaderValue(header, type, source); |
| 1613 } | 1616 } |
| 1614 | 1617 |
| 1615 void ContentSecurityPolicy::addPolicyFromHeaderValue(const String& header, Heade
rType type) | 1618 void ContentSecurityPolicy::addPolicyFromHeaderValue(const String& header, Heade
rType type, HeaderSource source) |
| 1616 { | 1619 { |
| 1617 Document* document = 0; | 1620 Document* document = 0; |
| 1618 if (m_client->isDocument()) { | 1621 if (m_client->isDocument()) { |
| 1619 document = static_cast<Document*>(m_client); | 1622 document = static_cast<Document*>(m_client); |
| 1620 UseCounter::count(*document, getUseCounterType(type)); | 1623 UseCounter::count(*document, getUseCounterType(type)); |
| 1624 |
| 1625 // CSP 1.1 defines report-only in a <meta> element as invalid. Measure f
or now, disable in experimental mode. |
| 1626 if (source == ContentSecurityPolicy::HeaderSourceMeta && type == Content
SecurityPolicy::Report) { |
| 1627 UseCounter::count(*document, UseCounter::ContentSecurityPolicyReport
OnlyInMeta); |
| 1628 if (experimentalFeaturesEnabled()) { |
| 1629 reportReportOnlyInMeta(header); |
| 1630 return; |
| 1631 } |
| 1632 } |
| 1621 } | 1633 } |
| 1622 | 1634 |
| 1635 |
| 1623 Vector<UChar> characters; | 1636 Vector<UChar> characters; |
| 1624 header.appendTo(characters); | 1637 header.appendTo(characters); |
| 1625 | 1638 |
| 1626 const UChar* begin = characters.data(); | 1639 const UChar* begin = characters.data(); |
| 1627 const UChar* end = begin + characters.size(); | 1640 const UChar* end = begin + characters.size(); |
| 1628 | 1641 |
| 1629 // RFC2616, section 4.2 specifies that headers appearing multiple times can | 1642 // RFC2616, section 4.2 specifies that headers appearing multiple times can |
| 1630 // be combined with a comma. Walk the header string, and parse each comma | 1643 // be combined with a comma. Walk the header string, and parse each comma |
| 1631 // separated chunk as a separate header. | 1644 // separated chunk as a separate header. |
| 1632 const UChar* position = begin; | 1645 const UChar* position = begin; |
| 1633 while (position < end) { | 1646 while (position < end) { |
| 1634 skipUntil<UChar>(position, end, ','); | 1647 skipUntil<UChar>(position, end, ','); |
| 1635 | 1648 |
| 1636 // header1,header2 OR header1 | 1649 // header1,header2 OR header1 |
| 1637 // ^ ^ | 1650 // ^ ^ |
| 1638 OwnPtr<CSPDirectiveList> policy = CSPDirectiveList::create(this, begin,
position, type); | 1651 OwnPtr<CSPDirectiveList> policy = CSPDirectiveList::create(this, begin,
position, type, source); |
| 1639 | 1652 |
| 1640 // We disable 'eval()' even in the case of report-only policies, and rel
y on the check in the V8Initializer::codeGenerationCheckCallbackInMainThread cal
lback to determine whether the call should execute or not. | 1653 // We disable 'eval()' even in the case of report-only policies, and rel
y on the check in the V8Initializer::codeGenerationCheckCallbackInMainThread cal
lback to determine whether the call should execute or not. |
| 1641 if (!policy->allowEval(0, SuppressReport)) | 1654 if (!policy->allowEval(0, SuppressReport)) |
| 1642 m_client->disableEval(policy->evalDisabledErrorMessage()); | 1655 m_client->disableEval(policy->evalDisabledErrorMessage()); |
| 1643 | 1656 |
| 1644 m_policies.append(policy.release()); | 1657 m_policies.append(policy.release()); |
| 1645 | 1658 |
| 1646 // Skip the comma, and begin the next header from the current position. | 1659 // Skip the comma, and begin the next header from the current position. |
| 1647 ASSERT(position == end || *position == ','); | 1660 ASSERT(position == end || *position == ','); |
| 1648 skipExactly<UChar>(position, end, ','); | 1661 skipExactly<UChar>(position, end, ','); |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2036 PingLoader::sendViolationReport(frame, reportURIs[i], report, PingLoader
::ContentSecurityPolicyViolationReport); | 2049 PingLoader::sendViolationReport(frame, reportURIs[i], report, PingLoader
::ContentSecurityPolicyViolationReport); |
| 2037 | 2050 |
| 2038 didSendViolationReport(stringifiedReport); | 2051 didSendViolationReport(stringifiedReport); |
| 2039 } | 2052 } |
| 2040 | 2053 |
| 2041 void ContentSecurityPolicy::reportInvalidReferrer(const String& invalidValue) co
nst | 2054 void ContentSecurityPolicy::reportInvalidReferrer(const String& invalidValue) co
nst |
| 2042 { | 2055 { |
| 2043 logToConsole("The 'referrer' Content Security Policy directive has the inval
id value \"" + invalidValue + "\". Valid values are \"always\", \"default\", \"n
ever\", and \"origin\"."); | 2056 logToConsole("The 'referrer' Content Security Policy directive has the inval
id value \"" + invalidValue + "\". Valid values are \"always\", \"default\", \"n
ever\", and \"origin\"."); |
| 2044 } | 2057 } |
| 2045 | 2058 |
| 2059 void ContentSecurityPolicy::reportReportOnlyInMeta(const String& header) const |
| 2060 { |
| 2061 logToConsole("The report-only Content Security Policy '" + header + "' was d
elivered via a <meta> element, which is disallowed. The policy has been ignored.
"); |
| 2062 } |
| 2063 |
| 2046 void ContentSecurityPolicy::reportInvalidInReportOnly(const String& name) const | 2064 void ContentSecurityPolicy::reportInvalidInReportOnly(const String& name) const |
| 2047 { | 2065 { |
| 2048 logToConsole("The Content Security Policy directive '" + name + "' is ignore
d when delivered in a report-only policy."); | 2066 logToConsole("The Content Security Policy directive '" + name + "' is ignore
d when delivered in a report-only policy."); |
| 2049 } | 2067 } |
| 2050 | 2068 |
| 2051 void ContentSecurityPolicy::reportUnsupportedDirective(const String& name) const | 2069 void ContentSecurityPolicy::reportUnsupportedDirective(const String& name) const |
| 2052 { | 2070 { |
| 2053 DEFINE_STATIC_LOCAL(String, allow, ("allow")); | 2071 DEFINE_STATIC_LOCAL(String, allow, ("allow")); |
| 2054 DEFINE_STATIC_LOCAL(String, options, ("options")); | 2072 DEFINE_STATIC_LOCAL(String, options, ("options")); |
| 2055 DEFINE_STATIC_LOCAL(String, policyURI, ("policy-uri")); | 2073 DEFINE_STATIC_LOCAL(String, policyURI, ("policy-uri")); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2160 // Collisions have no security impact, so we can save space by storing only
the string's hash rather than the whole report. | 2178 // Collisions have no security impact, so we can save space by storing only
the string's hash rather than the whole report. |
| 2161 return !m_violationReportsSent.contains(report.impl()->hash()); | 2179 return !m_violationReportsSent.contains(report.impl()->hash()); |
| 2162 } | 2180 } |
| 2163 | 2181 |
| 2164 void ContentSecurityPolicy::didSendViolationReport(const String& report) | 2182 void ContentSecurityPolicy::didSendViolationReport(const String& report) |
| 2165 { | 2183 { |
| 2166 m_violationReportsSent.add(report.impl()->hash()); | 2184 m_violationReportsSent.add(report.impl()->hash()); |
| 2167 } | 2185 } |
| 2168 | 2186 |
| 2169 } // namespace WebCore | 2187 } // namespace WebCore |
| OLD | NEW |