Skip to content

Commit 73fb5d6

Browse files
committed
Apply strict-dynamic to inline scripts.
As noted in #426, the current "Does element match source list for type and source?" algorithm does not properly handle `strict-dynamic` checks for non-parser-inserted inline scripts. This patch adds a relevant step to the algorithm to match both browser behavior and our existing tests: https://wpt.fyi/results/content-security-policy/script-src/script-src-strict_dynamic_non_parser_inserted.html?label=experimental&label=master&aligned Fixes #426.
1 parent 9dd7cf1 commit 73fb5d6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

index.bs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4412,6 +4412,10 @@ Content-Type: application/reports+json
44124412

44134413
2. <a for=set>For each</a> |expression| of |list|:
44144414

4415+
1. If |expression| is the "<a grammar>`'strict-dynamic'`</a>" <a grammar>keyword-source</a>:
4416+
4417+
1. If |type| is "`script`", and |element| is not [=parser-inserted=], return "`Matches`".
4418+
44154419
1. If |expression| matches the <a grammar>`hash-source`</a> grammar:
44164420

44174421
1. Let |algorithm| be null.
@@ -4448,8 +4452,6 @@ Content-Type: application/reports+json
44484452
they will also apply to event handlers, style attributes and `javascript:`
44494453
navigations.
44504454

4451-
ISSUE(w3c/webappsec-csp#426): This should handle `'strict-dynamic'` for dynamically inserted inline scripts.
4452-
44534455
6. Return "`Does Not Match`".
44544456

44554457
<h3 id="directive-algorithms">Directive Algorithms</h3>

0 commit comments

Comments
 (0)