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 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
736 return; | 736 return; |
737 | 737 |
738 SecurityPolicyViolationEventInit violationData; | 738 SecurityPolicyViolationEventInit violationData; |
739 gatherSecurityPolicyViolationEventData(violationData, document, directiveTex t, effectiveDirective, blockedURL, header); | 739 gatherSecurityPolicyViolationEventData(violationData, document, directiveTex t, effectiveDirective, blockedURL, header); |
740 | 740 |
741 frame->localDOMWindow()->enqueueDocumentEvent(SecurityPolicyViolationEvent:: create(EventTypeNames::securitypolicyviolation, violationData)); | 741 frame->localDOMWindow()->enqueueDocumentEvent(SecurityPolicyViolationEvent:: create(EventTypeNames::securitypolicyviolation, violationData)); |
742 | 742 |
743 if (reportEndpoints.isEmpty()) | 743 if (reportEndpoints.isEmpty()) |
744 return; | 744 return; |
745 | 745 |
746 // TODO(mkwst): Obviously, we shouldn't hit this check, as extension-loaded | |
747 // resources should be allowed regardless. We apparently do, however, so | |
748 // we should at least stop spamming reporting endpoints. See | |
749 // https://crbug.com/524356 for detail. | |
750 if (!violationData.sourceFile().isEmpty() && SchemeRegistry::schemeShouldByp assContentSecurityPolicy(violationData.sourceFile().protocol()) | |
Mike West
2015/09/09 09:18:18
Ha, I'm an idiot. Pretend that this reads `KURL(Pa
| |
751 return; | |
752 | |
746 // We need to be careful here when deciding what information to send to the | 753 // We need to be careful here when deciding what information to send to the |
747 // report-uri. Currently, we send only the current document's URL and the | 754 // report-uri. Currently, we send only the current document's URL and the |
748 // directive that was violated. The document's URL is safe to send because | 755 // directive that was violated. The document's URL is safe to send because |
749 // it's the document itself that's requesting that it be sent. You could | 756 // it's the document itself that's requesting that it be sent. You could |
750 // make an argument that we shouldn't send HTTPS document URLs to HTTP | 757 // make an argument that we shouldn't send HTTPS document URLs to HTTP |
751 // report-uris (for the same reasons that we supress the Referer in that | 758 // report-uris (for the same reasons that we supress the Referer in that |
752 // case), but the Referer is sent implicitly whereas this request is only | 759 // case), but the Referer is sent implicitly whereas this request is only |
753 // sent explicitly. As for which directive was violated, that's pretty | 760 // sent explicitly. As for which directive was violated, that's pretty |
754 // harmless information. | 761 // harmless information. |
755 | 762 |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1008 // Collisions have no security impact, so we can save space by storing only the string's hash rather than the whole report. | 1015 // Collisions have no security impact, so we can save space by storing only the string's hash rather than the whole report. |
1009 return !m_violationReportsSent.contains(report.impl()->hash()); | 1016 return !m_violationReportsSent.contains(report.impl()->hash()); |
1010 } | 1017 } |
1011 | 1018 |
1012 void ContentSecurityPolicy::didSendViolationReport(const String& report) | 1019 void ContentSecurityPolicy::didSendViolationReport(const String& report) |
1013 { | 1020 { |
1014 m_violationReportsSent.add(report.impl()->hash()); | 1021 m_violationReportsSent.add(report.impl()->hash()); |
1015 } | 1022 } |
1016 | 1023 |
1017 } // namespace blink | 1024 } // namespace blink |
OLD | NEW |