Bug 235602 - CSP: Clean up effective-violation handling in reports
Summary: CSP: Clean up effective-violation handling in reports
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Patrick Griffis
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-01-25 12:31 PST by Patrick Griffis
Modified: 2022-01-27 10:44 PST (History)
4 users (show)

See Also:


Attachments
Patch (93.20 KB, patch)
2022-01-25 12:32 PST, Patrick Griffis
no flags Details | Formatted Diff | Diff
Patch (91.59 KB, patch)
2022-01-25 12:57 PST, Patrick Griffis
no flags Details | Formatted Diff | Diff
Patch (98.51 KB, patch)
2022-01-26 08:41 PST, Patrick Griffis
no flags Details | Formatted Diff | Diff
Patch (88.21 KB, patch)
2022-01-27 07:07 PST, Patrick Griffis
no flags Details | Formatted Diff | Diff
Patch (92.94 KB, patch)
2022-01-27 07:36 PST, Patrick Griffis
no flags Details | Formatted Diff | Diff
Patch (91.01 KB, patch)
2022-01-27 07:38 PST, Patrick Griffis
no flags Details | Formatted Diff | Diff
Patch (94.53 KB, patch)
2022-01-27 09:07 PST, Patrick Griffis
no flags Details | Formatted Diff | Diff
Patch for landing (94.41 KB, patch)
2022-01-27 09:11 PST, Patrick Griffis
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Griffis 2022-01-25 12:31:38 PST
CSP: Clean up effective-violation handling in reports
Comment 1 Patrick Griffis 2022-01-25 12:32:30 PST Comment hidden (obsolete)
Comment 2 Patrick Griffis 2022-01-25 12:57:36 PST Comment hidden (obsolete)
Comment 3 Patrick Griffis 2022-01-26 08:41:59 PST Comment hidden (obsolete)
Comment 4 Patrick Griffis 2022-01-27 07:07:47 PST Comment hidden (obsolete)
Comment 5 Patrick Griffis 2022-01-27 07:36:11 PST Comment hidden (obsolete)
Comment 6 Patrick Griffis 2022-01-27 07:38:05 PST
Created attachment 450136 [details]
Patch
Comment 7 Kate Cheney 2022-01-27 08:50:11 PST
Comment on attachment 450136 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=450136&action=review

r=me once EWS is happy.

> Source/WebCore/page/csp/ContentSecurityPolicy.cpp:74
> +    // Normalize script-src and style-src for logs as its generally what developers use

nit: missing a period at the end of this comment.

> Source/WebCore/page/csp/ContentSecurityPolicy.cpp:75
> +    if (violatedDirective.nameForReporting().startsWith(ContentSecurityPolicyDirectiveNames::scriptSrc))

you could remove the else statements and have fewer lines of code if you do something like:

String name = violatedDirective.nameForReporting();
if (violatedDirective.nameForReporting().startsWith(ContentSecurityPolicyDirectiveNames::scriptSrc))
    name = ContentSecurityPolicyDirectiveNames::scriptSrc;
if (violatedDirective.nameForReporting().startsWith(ContentSecurityPolicyDirectiveNames::styleSrc))
    name = ContentSecurityPolicyDirectiveNames::styleSrc;

> Source/WebCore/page/csp/ContentSecurityPolicy.cpp:809
> +    violationEventInit.violatedDirective = effectiveViolatedDirective; // Historical alias to effectiveDirective: https://www.w3.org/TR/CSP3/#violation-events

nit: comment is missing a period.
Comment 8 Patrick Griffis 2022-01-27 09:07:33 PST Comment hidden (obsolete)
Comment 9 Patrick Griffis 2022-01-27 09:11:31 PST
Created attachment 450146 [details]
Patch for landing
Comment 10 EWS 2022-01-27 10:15:12 PST
Committed r288678 (246484@main): <https://commits.webkit.org/246484@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 450146 [details].
Comment 11 Radar WebKit Bug Importer 2022-01-27 10:16:39 PST
<rdar://problem/88140258>