Skip to content

Add external script speculation rules case#1

Open
vickiez wants to merge 12 commits intodomenic:speculationrulesfrom
vickiez:external-spec-rules
Open

Add external script speculation rules case#1
vickiez wants to merge 12 commits intodomenic:speculationrulesfrom
vickiez:external-spec-rules

Conversation

@vickiez
Copy link
Copy Markdown

@vickiez vickiez commented Feb 4, 2026

With whatwg/html#11697, external scripts of type "speculationrules" will now be supported. Update the CSP spec accordingly to ensure this case is subject to script-src-elem and its fallback chain, similar to inline speculation rules by default.

antosart and others added 5 commits July 11, 2025 08:16
As noted in w3c#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 w3c#426.
@hiroshige-g
Copy link
Copy Markdown

FYI this is domenic's repository, maybe you might want to create a PR to https://github.com/w3c/webappsec-csp/?

@vickiez
Copy link
Copy Markdown
Author

vickiez commented Mar 16, 2026

FYI this is domenic's repository, maybe you might want to create a PR to https://github.com/w3c/webappsec-csp/?

Thanks! Created a draft here: w3c#808, and will ensure it's updated according to the plan in whatwg/html#11697

eemeli and others added 4 commits April 1, 2026 15:51
This upstreams the monkeypatches from https://wicg.github.io/nav-speculation/speculation-rules.html#content-security-policy. At a high level, the additions are:

- A new directive, `inline-speculation-rules`, which can be used if developers want to block inline JavaScript `<script>`s but allow inline `<script type=speculationrules>`s. This is done by introducing a new script type, `script speculationrules`, to sit alongside the existing `script` and `script attribute` types; HTML passes this new value in.

- Handling of the new `"speculationrules"` request destination, which is used by the `Speculation-Rules` HTTP header. It cannot be blocked by CSP.
@vickiez vickiez force-pushed the external-spec-rules branch from 22806ee to 4e8aad7 Compare April 1, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants