Skip to content

fix(hls): hold import resources and redirects to the playlist origin (backport #6374) - #6640

Merged
kixelated merged 2 commits into
releasefrom
backport/hls-admission
Oct 24, 2026
Merged

kixelated merged 2 commits into
releasefrom
backport/hls-admission

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Problem

release, which moq.dev runs, still lets a hostile HLS playlist steer the importer off its origin: an absolute or network-path reference to another host, a file: path from an HTTP(S) playlist, or a redirect hop to another origin. #6374 fixed this on main with a breaking change (it removed import::Config::client).

Approach

A cherry-pick of #6374's code, adapted to keep release's API:

  • Fetcher keeps the entry playlist URL and refuses any playlist, init segment, or media segment whose scheme, host, or port differs, before any I/O. Import::new refuses entry schemes other than file, http, and https.
  • The client moq-hls builds checks every redirect hop against the same rule before following it; a stopped hop reaches fetch as a 3xx and is refused.
  • Error::ResourceRefused ends the import immediately instead of riding the retry budget or rendition eviction.
  • import::Config::client stays. A caller-supplied client keeps its own redirect policy, so it decides which hops are requested, which the field's docs now say. The import still refuses a reference off the origin before I/O, and refuses a response whose final URL left the origin, so its body is never imported. This last check is new relative to main, which has no caller client.
  • doc/bin/hls.md states the origin rule.

Left out: #6374's quest edits. Added: futures as a moq-hls dev-dependency (workspace version) for the no-retry test's now_or_never, as main has.

Impact

  • Public API: additive. Error::ResourceRefused is a new variant of the #[non_exhaustive] error enum. Config::client keeps its type; only its docs change. Ships as a moq-hls patch.
  • Behavior: a playlist that references, or redirects to, another origin (such as a separate CDN host) fails the import. A file:// playlist reads only local files. Unsupported entry schemes fail Import::new.
  • Wire: none.

Alternatives

  • Wrap or rebuild a caller's client to force the origin redirect policy: reqwest::Client exposes no way to change an existing client's policy, so this would mean dropping the field, which is the breaking change main made.
  • Skip the final-URL check for a caller's client: it leaves an off-origin redirect body importable through the client, the exfiltration half of the attack, for one line of cost.

Validation

  • cargo test -p moq-hls --lib: 113 passed, including fix(hls)!: hold import resources and redirects to the playlist origin #6374's admission, redirect, and no-retry tests plus a new caller_client_stays_on_the_playlist_origin, which fails without the final-URL check.
  • just check origin/release passes: it selected the full suite (the lockfile changed), including Rust nextest (5674 + 387 + 133 + 78 tests), clippy, rustdoc, wasm clippy, and the JS tests.
  • just test interop --all not run: no wire, FFI, or CLI surface changes, and interop exercises no HLS path.

The quest PR #6638 deletes the quest on main; merge this one first.

🤖 Generated with Claude Code

(Written by Claude Opus 5.5)

…(backport #6374)

Backport of #6374 that keeps
`import::Config::client`: a caller-supplied client keeps its own redirect
policy, and the import still refuses any resource, or response, off the
playlist's origin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T15:27:32.850337Z cb25638 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated

Copy link
Copy Markdown
Collaborator Author

Merge summary:

  • Merged release (with the H.265 backport, fix(moq-mux): send the H.265 picture aspect, not the pixel aspect (backport #5574) #6631) into this branch as cb25638; no conflicts, the two diffs touch disjoint files.
  • just check origin/release passed locally; CI is green on the new head, and Codex reacted with a thumbs-up after the push.
  • The release-only final-URL check for a caller-supplied import::Config::client was accepted by the maintainer.
  • Landing with a merge commit per CONTRIBUTING for PRs into release.

(Written by Claude Opus 5.5)

@kixelated
kixelated merged commit d608f5b into release Oct 24, 2026
11 checks passed
@kixelated
kixelated deleted the backport/hls-admission branch October 24, 2026 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant