Repository navigation
feat: add support for same-origin SRI allowing use of strict Integrit… - #17399
Open
willfarrell wants to merge 4 commits into
Open
willfarrell wants to merge 4 commits into
willfarrell wants to merge 4 commits into
Conversation
…y-Policy Signed-off-by: will Farrell <willfarrell@proton.me>
|
Install the latest version of pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/db2328e83f8cc456a7a8590e3b720fc98d842d6bOpen in Note This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed. |
🦋 Changeset detectedLatest commit: db2328e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
6 tasks done
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds opt-in Subresource Integrity (SRI) support to SvelteKit. When enabled, SvelteKit adds
integrityhashes to the scripts and stylesheets it emits, so apps can use a strictIntegrity-Policyheader. Without this, a strictIntegrity-Policyblocks SvelteKit's own assets because they have no integrity metadata.What this does
New config option (in the
sveltekit()plugin options, alongsidecsp/csrf):subresourceIntegrity: false | 'sha256' | 'sha384' | 'sha512'(defaultfalse)Build (
exports/vite/build/index.js):node:cryptoand stores the result inbuild_data.client.integrity. Inlined chunks are skipped.Rendering (
runtime/server/page/render.js):integrityandcrossorigin="anonymous"to<link rel="stylesheet">and<link rel="modulepreload">tags emitted during SSR.Linkheader can't carryintegrity, so preloads that have a hash are always emitted as tags instead of headers.Tests: the
optionstest app enablessha384and checks that every emitted hash matches the bytes actually served.AI disclosure: Implemented by Claude Opus 5.5. Reviewed and tested by human.
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.Which packages should have a major bump?, but doesn't let me set it as a minor version.Edits