Throttle the number of CSP reports that are sent
Categories
(Core :: DOM: Security, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox117 | --- | fixed |
People
(Reporter: tschuster, Assigned: tschuster)
References
(Blocks 2 open bugs, Regressed 1 open bug)
Details
(Whiteboard: [domsecurity-active])
Attachments
(3 files, 1 obsolete file)
Coealising of reports like bug 1657519 suggests is much harder to implement, and for cases like Bug 1806276 (yahoo) we would need to do inexact matching, because every report has a different source "0.5", "-2.2" etc.
We probably need to tune our constants a bit, but a maximum of 100 reports in 2 seconds makes the yahoo page load without slowing down my browser to a crawl.
| Assignee | ||
Updated•3 years ago
|
| Assignee | ||
Comment 1•3 years ago
|
||
| Assignee | ||
Comment 2•3 years ago
|
||
Depends on D181392
| Assignee | ||
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
| Assignee | ||
Comment 3•3 years ago
|
||
Depends on D181393
Updated•3 years ago
|
| Assignee | ||
Updated•3 years ago
|
| Assignee | ||
Comment 5•3 years ago
|
||
(In reply to Frederik Braun [:freddy] from comment #4)
Can we dupe bug 1657519 against this?
I don't think we should. We probably want to do something like bug 1657519 suggests (maybe in combination with the reporting API?) in the long run.
Comment 7•3 years ago
|
||
Backed out for causing failures on test_ext_contentscript_triggeringPrincipal.js
TV Failure also present here
| Assignee | ||
Updated•3 years ago
|
Updated•3 years ago
|
| Assignee | ||
Comment 8•3 years ago
|
||
Hi Nicolas! Do you have any idea why the test continues to time out? I left some references in phabricator.
Updated•3 years ago
|
Comment 9•3 years ago
|
||
Sorry for the delay Tom.
So looking at the logs, it does look like we do find the messages that we want. Maybe one of them could be displayed multiple times?
waitForMessagesByType (which is called by waitForMessageByType) will only resolve if there's only 1 matched messages.
info(
`Matched a message with text: "${message.text}", ` +
...
: `all messages received.`)
...
if (matchedMessages.length === messages.length) {
hud.ui.off("new-messages", messagesReceived);
resolve(matchedMessages);
return;
}
If I wait at the end of the test, I can see that the "blocked" message can be shown twice, and depending on the timing, it might be the case that we have the 2 messages.
Maybe you can try to switch to a polling helper instead:
diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_csp_too_many_reports.js b/devtools/client/webconsole/test/browser/browser_webconsole_csp_too_many_reports.js
--- a/devtools/client/webconsole/test/browser/browser_webconsole_csp_too_many_reports.js
+++ b/devtools/client/webconsole/test/browser/browser_webconsole_csp_too_many_reports.js
@@ -27,11 +27,6 @@ add_task(async function () {
const hud = await openNewTabAndConsole(TEST_URI);
- const onCspViolationMessage = waitForMessageByType(
- hud,
- CSP_VIOLATION_MSG,
- ".error"
- );
const onCspTooManyReportsMessage = waitForMessageByType(
hud,
CSP_TOO_MANY_REPORTS_MSG,
@@ -41,9 +36,8 @@ add_task(async function () {
info("Load a page with CSP warnings.");
await navigateTo(TEST_VIOLATIONS);
- await onCspViolationMessage;
+ await waitFor(() => findMessageByType(hud, CSP_VIOLATION_MSG, ".error"));
await onCspTooManyReportsMessage;
ok(true, "Got error about too many reports");
-
await clearOutput(hud);
});
Let me know if this helps!
| Assignee | ||
Comment 10•3 years ago
|
||
Thank you Nicolas. I didn't realize that this only matches one message. I think your suggestion works, because test-verify now seems green on try.
Comment 11•3 years ago
|
||
Comment 12•3 years ago
|
||
| bugherder | ||
| Assignee | ||
Updated•3 years ago
|
Comment 13•3 years ago
|
||
Comment on attachment 9340735 [details]
WIP: Bug 1839165 - WIP: Telemetry for number of CSP reports. (not working)
Revision D181897 was moved to bug 1848303. Setting attachment 9340735 [details] to obsolete.
Description
•