Skip to content

Commit b26993f

Browse files
committed
Use "Strip URL" from the Reporting API
1 parent 7690298 commit b26993f

File tree

1 file changed

+11
-26
lines changed

1 file changed

+11
-26
lines changed

index.bs

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,7 +1120,7 @@ spec:SRI; urlPrefix: https://w3c.github.io/webappsec-subresource-integrity
11201120
1. Let |hash| be the [=concatenation=] of |algorithm|, U+2D (-), and |h|.
11211121
1. Let |global| be the |request|'s [=request/client=]'s [=/global object=].
11221122
1. If |global| is not a {{Window}}, return.
1123-
1. Let |stripped document URL| to be the result of executing [[#strip-url-for-use-in-reports]]
1123+
1. Let |stripped document URL| to be the result of executing [=strip URL for use in reports=]
11241124
on |global|'s [=associated document|document=]'s [=Document/URL=].
11251125
1. If |policy|'s [=directive set=] does not contain a [=directive=] named "report-to", return.
11261126
1. Let |report-to directive| be a [=directive=] named "report-to" from |policy|'s [=directive
@@ -1744,7 +1744,7 @@ Content-Type: application/reports+json
17441744

17451745
1. Assert: |resource| is a [=/URL=] or a [=string=].
17461746

1747-
2. If |resource| is a [=/URL=], return the result of executing [[#strip-url-for-use-in-reports]] on
1747+
2. If |resource| is a [=/URL=], return the result of executing [=strip URL for use in reports=] on
17481748
|resource|.
17491749

17501750
3. Return |resource|.
@@ -1761,10 +1761,10 @@ Content-Type: application/reports+json
17611761
follows:
17621762

17631763
: "`document-uri`"
1764-
:: The result of executing [[#strip-url-for-use-in-reports]] on |violation|'s
1764+
:: The result of executing [=strip URL for use in reports=] on |violation|'s
17651765
<a for="violation">url</a>.
17661766
: "`referrer`"
1767-
:: The result of executing [[#strip-url-for-use-in-reports]] on |violation|'s
1767+
:: The result of executing [=strip URL for use in reports=] on |violation|'s
17681768
<a for="violation">referrer</a>.
17691769
: "`blocked-uri`"
17701770
:: The result of executing [[#obtain-violation-blocked-uri]] on |violation|'s
@@ -1793,7 +1793,7 @@ Content-Type: application/reports+json
17931793

17941794
2. If |violation|'s <a for="violation">source file</a> is not null:
17951795

1796-
1. Set |body|["`source-file`'] to the result of executing [[#strip-url-for-use-in-reports]]
1796+
1. Set |body|["`source-file`'] to the result of executing [=strip URL for use in reports=]
17971797
on |violation|'s <a for="violation">source file</a>.
17981798

17991799
2. Set |body|["`line-number`"] to |violation|'s
@@ -1808,21 +1808,6 @@ Content-Type: application/reports+json
18081808
4. Return the result of <a>serialize an infra value to JSON bytes</a> given
18091809
«[ "csp-report" → body ]».
18101810

1811-
<h3 id="strip-url-for-use-in-reports" algorithm>Strip URL for use in reports</h3>
1812-
Given a [=/URL=] |url|, this algorithm returns a string representing the URL for use in violation
1813-
reports:
1814-
1815-
1. If |url|'s <a for="url">scheme</a> is not an <a>HTTP(S) scheme</a>,
1816-
then return |url|'s <a for="url">scheme</a>.
1817-
1818-
2. Set |url|’s <a for="url">fragment</a> to the empty string.
1819-
1820-
3. Set |url|’s <a for="url">username</a> to the empty string.
1821-
1822-
4. Set |url|’s <a for="url">password</a> to the empty string.
1823-
1824-
5. Return the result of executing the <a>URL serializer</a> on |url|.
1825-
18261811
<h3 id="report-violation" algorithm>
18271812
Report a |violation|
18281813
</h3>
@@ -1865,10 +1850,10 @@ Content-Type: application/reports+json
18651850
interface at |target| with its attributes initialized as follows:
18661851

18671852
: {{SecurityPolicyViolationEvent/documentURI}}
1868-
:: The result of executing [[#strip-url-for-use-in-reports]] on |violation|'s
1853+
:: The result of executing [=strip URL for use in reports=] on |violation|'s
18691854
<a for="violation">url</a>.
18701855
: {{SecurityPolicyViolationEvent/referrer}}
1871-
:: The result of executing [[#strip-url-for-use-in-reports]] on |violation|'s
1856+
:: The result of executing [=strip URL for use in reports=] on |violation|'s
18721857
<a for="violation">referrer</a>.
18731858
: {{SecurityPolicyViolationEvent/blockedURI}}
18741859
:: The result of executing [[#obtain-violation-blocked-uri]] on |violation|'s
@@ -1883,7 +1868,7 @@ Content-Type: application/reports+json
18831868
: {{SecurityPolicyViolationEvent/disposition}}
18841869
:: |violation|'s <a for="violation">disposition</a>
18851870
: {{SecurityPolicyViolationEvent/sourceFile}}
1886-
:: The result of executing [[#strip-url-for-use-in-reports]] on |violation|'s
1871+
:: The result of executing [=strip URL for use in reports=] on |violation|'s
18871872
<a for="violation">source file</a>, if |violation|'s
18881873
<a for="violation">source file</a> is not null, or null otherwise.
18891874
: {{SecurityPolicyViolationEvent/statusCode}}
@@ -1976,11 +1961,11 @@ Content-Type: application/reports+json
19761961
follows:
19771962

19781963
: {{CSPViolationReportBody/documentURL}}
1979-
:: The result of executing [[#strip-url-for-use-in-reports]] on |violation|'s
1964+
:: The result of executing [=strip URL for use in reports=] on |violation|'s
19801965
<a for="violation">url</a>.
19811966

19821967
: {{CSPViolationReportBody/referrer}}
1983-
:: The result of executing [[#strip-url-for-use-in-reports]] on |violation|'s
1968+
:: The result of executing [=strip URL for use in reports=] on |violation|'s
19841969
<a for="violation">referrer</a>.
19851970

19861971
: {{CSPViolationReportBody/blockedURL}}
@@ -1995,7 +1980,7 @@ Content-Type: application/reports+json
19951980
<a for="violation">policy</a>.
19961981

19971982
: {{CSPViolationReportBody/sourceFile}}
1998-
:: The result of executing [[#strip-url-for-use-in-reports]] on |violation|'s
1983+
:: The result of executing [=strip URL for use in reports=] on |violation|'s
19991984
<a for="violation">source file</a>, if |violation|'s
20001985
<a for="violation">source file</a> is not null, or null otherwise.
20011986

0 commit comments

Comments
 (0)