| 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/dom/SandboxFlags.h" | 34 #include "core/dom/SandboxFlags.h" |
| 35 #include "core/events/EventQueue.h" | 35 #include "core/events/EventQueue.h" |
| 36 #include "core/events/SecurityPolicyViolationEvent.h" | 36 #include "core/events/SecurityPolicyViolationEvent.h" |
| 37 #include "core/fetch/IntegrityMetadata.h" | 37 #include "core/fetch/IntegrityMetadata.h" |
| 38 #include "core/frame/FrameClient.h" | 38 #include "core/frame/FrameClient.h" |
| 39 #include "core/frame/LocalDOMWindow.h" | 39 #include "core/frame/LocalDOMWindow.h" |
| 40 #include "core/frame/LocalFrame.h" | 40 #include "core/frame/LocalFrame.h" |
| 41 #include "core/frame/UseCounter.h" | 41 #include "core/frame/UseCounter.h" |
| 42 #include "core/frame/csp/CSPDirectiveList.h" | 42 #include "core/frame/csp/CSPDirectiveList.h" |
| 43 #include "core/frame/csp/CSPSource.h" | 43 #include "core/frame/csp/CSPSource.h" |
| 44 #include "core/frame/csp/CSPSourceList.h" | |
| 45 #include "core/frame/csp/MediaListDirective.h" | 44 #include "core/frame/csp/MediaListDirective.h" |
| 46 #include "core/frame/csp/SourceListDirective.h" | 45 #include "core/frame/csp/SourceListDirective.h" |
| 47 #include "core/inspector/ConsoleMessage.h" | 46 #include "core/inspector/ConsoleMessage.h" |
| 48 #include "core/inspector/InspectorInstrumentation.h" | 47 #include "core/inspector/InspectorInstrumentation.h" |
| 49 #include "core/loader/DocumentLoader.h" | 48 #include "core/loader/DocumentLoader.h" |
| 50 #include "core/loader/FrameLoaderClient.h" | 49 #include "core/loader/FrameLoaderClient.h" |
| 51 #include "core/loader/PingLoader.h" | 50 #include "core/loader/PingLoader.h" |
| 52 #include "platform/RuntimeEnabledFeatures.h" | 51 #include "platform/RuntimeEnabledFeatures.h" |
| 53 #include "platform/json/JSONValues.h" | 52 #include "platform/json/JSONValues.h" |
| 54 #include "platform/network/ContentSecurityPolicyParsers.h" | 53 #include "platform/network/ContentSecurityPolicyParsers.h" |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 | 603 |
| 605 template <bool (CSPDirectiveList::*allowed)(const CSPHashValue&, | 604 template <bool (CSPDirectiveList::*allowed)(const CSPHashValue&, |
| 606 ContentSecurityPolicy::InlineType) | 605 ContentSecurityPolicy::InlineType) |
| 607 const> | 606 const> |
| 608 bool checkDigest(const String& source, | 607 bool checkDigest(const String& source, |
| 609 ContentSecurityPolicy::InlineType type, | 608 ContentSecurityPolicy::InlineType type, |
| 610 uint8_t hashAlgorithmsUsed, | 609 uint8_t hashAlgorithmsUsed, |
| 611 const CSPDirectiveListVector& policies) { | 610 const CSPDirectiveListVector& policies) { |
| 612 // Any additions or subtractions from this struct should also modify the | 611 // Any additions or subtractions from this struct should also modify the |
| 613 // respective entries in the kSupportedPrefixes array in | 612 // respective entries in the kSupportedPrefixes array in |
| 614 // CSPSourceList::parseHash(). | 613 // SourceListDirective::parseHash(). |
| 615 static const struct { | 614 static const struct { |
| 616 ContentSecurityPolicyHashAlgorithm cspHashAlgorithm; | 615 ContentSecurityPolicyHashAlgorithm cspHashAlgorithm; |
| 617 HashAlgorithm algorithm; | 616 HashAlgorithm algorithm; |
| 618 } kAlgorithmMap[] = { | 617 } kAlgorithmMap[] = { |
| 619 {ContentSecurityPolicyHashAlgorithmSha1, HashAlgorithmSha1}, | 618 {ContentSecurityPolicyHashAlgorithmSha1, HashAlgorithmSha1}, |
| 620 {ContentSecurityPolicyHashAlgorithmSha256, HashAlgorithmSha256}, | 619 {ContentSecurityPolicyHashAlgorithmSha256, HashAlgorithmSha256}, |
| 621 {ContentSecurityPolicyHashAlgorithmSha384, HashAlgorithmSha384}, | 620 {ContentSecurityPolicyHashAlgorithmSha384, HashAlgorithmSha384}, |
| 622 {ContentSecurityPolicyHashAlgorithmSha512, HashAlgorithmSha512}}; | 621 {ContentSecurityPolicyHashAlgorithmSha512, HashAlgorithmSha512}}; |
| 623 | 622 |
| 624 // Only bother normalizing the source/computing digests if there are any | 623 // Only bother normalizing the source/computing digests if there are any |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1496 // Collisions have no security impact, so we can save space by storing only | 1495 // Collisions have no security impact, so we can save space by storing only |
| 1497 // the string's hash rather than the whole report. | 1496 // the string's hash rather than the whole report. |
| 1498 return !m_violationReportsSent.contains(report.impl()->hash()); | 1497 return !m_violationReportsSent.contains(report.impl()->hash()); |
| 1499 } | 1498 } |
| 1500 | 1499 |
| 1501 void ContentSecurityPolicy::didSendViolationReport(const String& report) { | 1500 void ContentSecurityPolicy::didSendViolationReport(const String& report) { |
| 1502 m_violationReportsSent.add(report.impl()->hash()); | 1501 m_violationReportsSent.add(report.impl()->hash()); |
| 1503 } | 1502 } |
| 1504 | 1503 |
| 1505 } // namespace blink | 1504 } // namespace blink |
| OLD | NEW |