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

Issue 21789002: CSP: Deduplicate violation reports before sending. (Closed)

Created:
7 years, 4 months ago by Mike West
Modified:
7 years, 4 months ago
CC:
blink-reviews, dglazkov+blink, eae+blinkwatch, mkwst+watchlist_chromium.org
Visibility:
Public.

Description

CSP: Deduplicate violation reports before sending. Violation reports should be sent once and only once per page load. If a single line of code generates the same report over and over again, we should attempt to avoid spamming the report server with not-particularly valuable duplicates. For example, if a report-only policy blocks 'eval()', then the following loop would make a sysadmin somewhere quite unhappy: for (i=0;i<Number.MAX_VALUE;i++) eval(...); This patch adds a HashSet<unsigned> to ContentSecurityPolicy, and stores the hash of the stringified violation report. We check that set just before handing things off to PingLoader for delivery. If there's a match, we've already sent the report, and can safely discard it. If not we send the report, then add it to the list. Discussed on public-webappsec@w3.org: http://lists.w3.org/Archives/Public/public-webappsec/2013Aug/0000.html BUG=267453 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=155708

Patch Set 1 #

Total comments: 10

Patch Set 2 : tests. #

Messages

Total messages: 10 (0 generated)
Mike West
Hi Adam, Tom. I have no idea how to test this change. We don't really ...
7 years, 4 months ago (2013-08-02 09:42:44 UTC) #1
Tom Sepez
Nice. https://codereview.chromium.org/21789002/diff/1/Source/core/page/ContentSecurityPolicy.cpp File Source/core/page/ContentSecurityPolicy.cpp (right): https://codereview.chromium.org/21789002/diff/1/Source/core/page/ContentSecurityPolicy.cpp#newcode1777 Source/core/page/ContentSecurityPolicy.cpp:1777: return; Maybe count number of times we are ...
7 years, 4 months ago (2013-08-02 18:03:22 UTC) #2
abarth-chromium
https://codereview.chromium.org/21789002/diff/1/Source/core/page/ContentSecurityPolicy.cpp File Source/core/page/ContentSecurityPolicy.cpp (right): https://codereview.chromium.org/21789002/diff/1/Source/core/page/ContentSecurityPolicy.cpp#newcode1779 Source/core/page/ContentSecurityPolicy.cpp:1779: RefPtr<FormData> report = FormData::create(reportObject->toJSONString().utf8()); Rather than calling toJSONString() three ...
7 years, 4 months ago (2013-08-02 18:04:28 UTC) #3
Tom Sepez
https://codereview.chromium.org/21789002/diff/1/Source/core/page/ContentSecurityPolicy.cpp File Source/core/page/ContentSecurityPolicy.cpp (right): https://codereview.chromium.org/21789002/diff/1/Source/core/page/ContentSecurityPolicy.cpp#newcode1900 Source/core/page/ContentSecurityPolicy.cpp:1900: bool ContentSecurityPolicy::shouldSendViolationReport(PassRefPtr<JSONObject> report) const Maybe add a comment that ...
7 years, 4 months ago (2013-08-02 18:11:40 UTC) #4
Mike West
https://codereview.chromium.org/21789002/diff/1/Source/core/page/ContentSecurityPolicy.cpp File Source/core/page/ContentSecurityPolicy.cpp (right): https://codereview.chromium.org/21789002/diff/1/Source/core/page/ContentSecurityPolicy.cpp#newcode1777 Source/core/page/ContentSecurityPolicy.cpp:1777: return; On 2013/08/02 18:03:22, Tom Sepez wrote: > Maybe ...
7 years, 4 months ago (2013-08-05 08:21:28 UTC) #5
Mike West
PingLoader callback CL is up for review at https://codereview.chromium.org/22159002. I think that's a better, more ...
7 years, 4 months ago (2013-08-05 09:02:38 UTC) #6
Mike West
Uploaded a new patchset that tests multiple reports. Mind taking another look?
7 years, 4 months ago (2013-08-07 07:02:41 UTC) #7
abarth-chromium
lgtm
7 years, 4 months ago (2013-08-07 18:01:02 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mkwst@chromium.org/21789002/16001
7 years, 4 months ago (2013-08-07 18:01:19 UTC) #9
commit-bot: I haz the power
7 years, 4 months ago (2013-08-07 19:30:21 UTC) #10
Message was sent while issue was closed.
Change committed as 155708

Powered by Google App Engine
This is Rietveld 408576698