Repository navigation
fix(player)!: read a trusted package and a bundle only from the origin their address names - #341
Merged
Merged
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 4 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…n their address names (#340) trusted and libraries vouch for an address, and fetch follows redirects, so a redirect let another origin choose the code. The probe of a trusted package and of a bundle now refuses a response a redirect brought from another origin, naming both; a redirect within the origin is followed. A probe the address's own origin answered marks the descriptor sameOrigin, and the worker's range reads and the Jobs worker's download hold to it. An untrusted package still follows redirects.
alekswebnet
force-pushed
the
fix/code-from-its-origin
branch
from
December 3, 2026 08:58
ee57759 to
173d3a8
Compare
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
Closes #340.
trustedandlibrariesvouch for an address, and the player followed redirects, so a trusted package or a library bundle whose address redirected to another origin played with that origin's code. Now only a redirect within the address's own origin is followed for them.Changes
probeSourcetakescode: for a trusted package (srcwithtrusted) and a bundle (a.h5pinlibraries), a response thatResponse.redirectedandResponse.urlsay came from another origin is refused (network), naming both origins.sameOrigin, and every later read holds to it (holdToOrigin): the Service Worker's range reads, the probe's size request, and the Jobs worker's download. The mark comes from the address, not the load's mode, so two loads of one package, trusted and untrusted, agree./redirect/<fixture>?to=<loopback origin>route on the player's dev server.design/security.md;docs/api.md(trusted,libraries),docs/untrusted.md(a table row), the player README's 1.x note.Breaking, for the release notes (player 2.0): a trusted package, or a library bundle, whose address redirects to another origin is refused. Its address on the origin that serves it plays.
Verification
tests/browser/redirects.test.ts, with real redirects to the test server's loopback address: same-origin redirects play, trusted and as a bundle; a trusted package and a bundle redirected to another origin are refused with the message; an untrusted one plays through the redirect with the bundle's code. Chromium, Firefox and WebKit: 4 passed each.tests/unit/source-probe.test.ts: the probe's refusal and its follow for data; a read refused when the address starts redirecting elsewhere during a load; an unmarked address unaffected. 11 passed.Player suite in Chromium: 640 passed, plus 1 failure in
playback.test.ts("applies the H5P core styles",'normal'for'24px') that passed on a re-run (31 of 31). It is in the same file as this morning's one-off CI failure on feat(embed)!: every package untrusted unless --trusted names it (#323) #339.pnpm typecheck,pnpm lint,pnpm comments: pass.Tests added or updated where behavior changed
Documentation updated where public behavior or deployment changed
Relevant type checks, tests, and builds pass
No security-sensitive details or credentials are included
Screenshots or reproduction
Summary by cubic
Closes #340.
trustedandlibrariesvouch for an address, and the player followed redirects, so a trusted package or a library bundle whose address redirected to another origin played with that origin's code. Now only a redirect within the address's own origin is followed for them; one to another origin is refused (network), naming both.This is a breaking change for player 2.x: such a package plays only when
srcnames an address on the origin that serves it. A probe answered by the address's own origin marks the descriptorsameOrigin, and every later read—the Service Worker's range reads, the probe's size request, and the Jobs worker's download—holds to it. The mark comes from the address, not the load's mode, so two loads of one package agree. Untrusted packages still follow redirects, since their code does not run.Written for commit 173d3a8. Summary will update on new commits.