feat(runtime): scope external resource origins to published scripts - #594
Draft
marcodantonio-netsons wants to merge 1 commit into
Draft
marcodantonio-netsons wants to merge 1 commit into
marcodantonio-netsons wants to merge 1 commit into
Conversation
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.
User-authored scripts can load a third-party SDK but the published page's default CSP blocks its script, iframe or fetch destination. Add per-script HTTP(S) resource origins to the runtime settings and carry them through the build into published CSP, scoped to pages where that script actually emits a tag.
Authors can configure script, frame and connection origins in the code editor. Paths, credentials, wildcards and CSP keywords are rejected. Disabled scripts, excluded pages, failed builds and rejected script URLs grant no origins; connection grants retain same-origin access. No database migration is needed.
Validation:
bun test(7,059 passing),bun run build,bun run lint, andgit diff --check. Tests cover origin validation, editor corrections, classic/module builds, page scope, disabled/failed entries and CSP isolation. A local native-publisher browser preview loaded the real Turnstile SDK and produced a token with its localhost test key; no external form submission was sent.