Skip to content

Bind optimized HLS base/data segment tokens#603

Merged
Bladestar2105 merged 1 commit into
mainfrom
codex/propose-fix-for-hls-payload-vulnerability
May 7, 2026
Merged

Bind optimized HLS base/data segment tokens#603
Bladestar2105 merged 1 commit into
mainfrom
codex/propose-fix-for-hls-payload-vulnerability

Conversation

@Bladestar2105
Copy link
Copy Markdown
Owner

Motivation

  • A security issue allowed replay/mix-and-match of split HLS encrypted base and data blobs, letting attackers combine headers/safety flags from one playlist with a URL from another to bypass isSafeUrl and exfiltrate/internal-request sensitive data.
  • The change must preserve the optimized split format while preventing cross-playlist token recombination.

Description

  • Generate a per-playlist bindingId (b) in the HLS rewriting paths (proxyLive and proxyTimeshift) and include it in both the encrypted base and per-segment data payloads in src/controllers/streamController.js.
  • Validate in proxySegment that when a base is supplied the decrypted data.b matches the base.b, returning HTTP 400 on missing/mismatched binding, while keeping legacy single-payload (data only) behavior intact.
  • Add/update targeted tests in tests/performance/segment_encryption.test.js to include binding-aware optimized payloads and a negative test that ensures mismatched bindings are rejected.

Testing

  • Added/updated tests/performance/segment_encryption.test.js to cover legacy, optimized, and mismatched-binding cases (new negative test asserts 400 for mismatch).
  • Attempted to run the targeted suite with npm exec vitest run tests/performance/segment_encryption.test.js but the run failed in this environment due to missing native better-sqlite3 bindings (better_sqlite3.node), so the test suite could not execute here.
  • The fix is minimal and localized to src/controllers/streamController.js and the added assertions, preserving existing behaviors; please run CI (or npm exec vitest ...) in an environment with better-sqlite3 native bindings to verify tests pass.

Codex Task

@Bladestar2105 Bladestar2105 merged commit fe72e9e into main May 7, 2026
2 checks passed
@Bladestar2105 Bladestar2105 deleted the codex/propose-fix-for-hls-payload-vulnerability branch May 7, 2026 16:19
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