Skip to content

Integrate with speculation rules #776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

domenic
Copy link
Contributor

@domenic domenic commented Jul 10, 2025

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.


This should be merged a bit after whatwg/html#11426. Otherwise it will reference the WICG draft.


Preview | Diff

@domenic
Copy link
Contributor Author

domenic commented Jul 10, 2025

The build error appears to be preexisting.

@antosart
Copy link
Member

The build error should be fixed with #777.

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.
@domenic domenic force-pushed the speculationrules branch from 16bb13b to 8c2dcb5 Compare July 10, 2025 06:58
@domenic
Copy link
Contributor Author

domenic commented Jul 10, 2025

Rebased!

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.

2 participants