A token containing "/& could break out of the quoted M3U url-tvg="..."/tvg-logo="..." attributes (or split a query). Now percent-encoded (Uri.EscapeDataString) at every interpolation site: ChannelPlaylist.ToM3U, IptvController.AccessTokenQuery, FFmpegLibraryProcessService.WrapSegmenter, and the XMLTV twin GetChannelGuideHandler (percent-encode then XML-escape). No-op for a normal base64url JWT → M3U/XMLTV goldens byte-identical.
Done-when
A token containing " cannot malform M3U output (validated or encoded)
Regression test (ChannelPlaylistAccessTokenTests, updated Guide_encodes_and_xml_escapes_access_token)
adversarial review passed
#559 — transport hardening (redact from logs + no-store)
Log redaction. Serilog logged the full ?access_token=<jwt> query on any 5xx/Error /iptv request. IncludeQueryInRequestPath = false + new RequestLogScrubber → RequestPathScrubbed (masks token to ***, keeps other params).
no-store.channels.m3u, xmltv.xml, the .m3u8 HLS manifests, and their token-bearing 302 Locations now return Cache-Control: private, no-store.
Done-when
A 5xx (and Debug-level) /iptv/...?access_token= request does not write the token to the log
Token-bearing dynamic manifests return no-store
Covered by a test (log scrub) and a curl assertion (header)
docs/decisions/api-auth-security.md updated (folds the deferred-hardening note under security.iptv-browser-token)
Verification
Core.Tests 645✓, ErsatzTV.Tests 1832✓, 5 new targeted tests, format gate✓, BOM✓, decisions validator✓.
Independent cold security review (2 rounds) — clean verdict; found the XMLTV twin (Finding 1), a TS-redirect no-store gap (Finding 2, fixed), and a documented load-bearing residual (Finding 3, Microsoft: Warning appsettings override — not UI-reachable).
Live E2E:no-store on m3u/xmltv/m3u8; url-tvg shows access_token=aa%22bb%26cc (no breakout); request log renders access_token=*** with the raw token absent.
Decision record security.iptv-access-token-transport added.
Bundle: **access_token transport hardening** (#421 + #559) — two concrete fixes on the shared `?access_token=` `/iptv` surface.
## #421 — token not quote-safe in M3U/HLS/XMLTV URLs
A token containing `"`/`&` could break out of the quoted M3U `url-tvg="..."`/`tvg-logo="..."` attributes (or split a query). Now percent-encoded (`Uri.EscapeDataString`) at every interpolation site: `ChannelPlaylist.ToM3U`, `IptvController.AccessTokenQuery`, `FFmpegLibraryProcessService.WrapSegmenter`, and the XMLTV twin `GetChannelGuideHandler` (percent-encode **then** XML-escape). No-op for a normal base64url JWT → M3U/XMLTV goldens byte-identical.
**Done-when**
- [x] A token containing `"` cannot malform M3U output (validated or encoded)
- [x] Regression test (`ChannelPlaylistAccessTokenTests`, updated `Guide_encodes_and_xml_escapes_access_token`)
- [x] adversarial review passed
## #559 — transport hardening (redact from logs + no-store)
1. **Log redaction.** Serilog logged the full `?access_token=<jwt>` query on any 5xx/Error `/iptv` request. `IncludeQueryInRequestPath = false` + new `RequestLogScrubber` → `RequestPathScrubbed` (masks token to `***`, keeps other params).
2. **no-store.** `channels.m3u`, `xmltv.xml`, the `.m3u8` HLS manifests, and their token-bearing 302 Locations now return `Cache-Control: private, no-store`.
**Done-when**
- [x] A 5xx (and Debug-level) `/iptv/...?access_token=` request does not write the token to the log
- [x] Token-bearing dynamic manifests return `no-store`
- [x] Covered by a test (log scrub) and a curl assertion (header)
- [x] `docs/decisions/api-auth-security.md` updated (folds the deferred-hardening note under `security.iptv-browser-token`)
## Verification
- Core.Tests 645✓, ErsatzTV.Tests 1832✓, 5 new targeted tests, format gate✓, BOM✓, decisions validator✓.
- **Independent cold security review** (2 rounds) — clean verdict; found the XMLTV twin (Finding 1), a TS-redirect `no-store` gap (Finding 2, fixed), and a documented load-bearing residual (Finding 3, `Microsoft: Warning` appsettings override — not UI-reachable).
- **Live E2E:** `no-store` on m3u/xmltv/m3u8; `url-tvg` shows `access_token=aa%22bb%26cc` (no breakout); request log renders `access_token=***` with the raw token absent.
Decision record `security.iptv-access-token-transport` added.
Closes #421
Closes #559
🤖 Generated with [Claude Code](https://claude.com/claude-code)
#421 — a token containing a double-quote/ampersand could break out of the quoted M3U
`url-tvg="..."`/`tvg-logo="..."` attributes or split the query. Percent-encode
(`Uri.EscapeDataString`) at every site the token is interpolated into an M3U/HLS/XMLTV
URL: `ChannelPlaylist.ToM3U`, `IptvController.AccessTokenQuery`,
`FFmpegLibraryProcessService.WrapSegmenter`, and the XMLTV twin
`GetChannelGuideHandler` (percent-encode then XML-escape). No-op for a normal base64url
JWT, so the M3U/XMLTV goldens are byte-identical.
#559 — (1) Serilog logged the full `?access_token=<jwt>` query on any 5xx/Error `/iptv`
request. `IncludeQueryInRequestPath = false` + a new `RequestLogScrubber` enriching
`RequestPathScrubbed` (masks the token to `***`, keeps other params) that the message
template now references. (2) Token-bearing dynamic manifests (`channels.m3u`,
`xmltv.xml`, the `.m3u8` HLS manifests, and their token-bearing 302 Locations) now return
`Cache-Control: private, no-store`.
Independent cold review (2 rounds) clean. Live-E2E verified: no-store header on
m3u/xmltv/m3u8, token percent-encoded in url-tvg, and the request log rendering
`access_token=***` with the raw token absent. Decision record
`security.iptv-access-token-transport` added; resolves the deferred-hardening note under
`security.iptv-browser-token`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The prior commit updated the "deferred hardening" bullet of the
`security.iptv-browser-token` (#552) record — marking it RESOLVED and pointing to the new
`security.iptv-access-token-transport` record — plus its Rule/Signals lines. That is a
rationale-prose edit of an existing decision (exactly what #559's done-when asked for:
"fold into the deferred-hardening note under security.iptv-browser-token"), so it needs
the [decisions-edit] marker for the lifecycle validator. No record heading renamed, no
record removed; the #552 key/status/heading are unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two independent cold review rounds (adversarial, LSP-verified, no implementation context):
Round 1 traced every access_token interpolation site and manifest endpoint; found the XMLTV twin (Finding 1), a TS-redirect no-store gap (Finding 2), and a documented load-bearing residual (Finding 3, Microsoft: Warning appsettings suppressor — not UI-reachable).
Round 2 (fix re-review) confirmed all three CONFIRMED-FIXED with no new defects: XMLTV layering SecurityElement.Escape(Uri.EscapeDataString(token)) round-trips correctly; TS redirect no-store complete; Finding 3 documentation disposition reasonable.
The only change since the reviewed a372742e is an empty [decisions-edit] authorization commit (26ec6ac5) — nothing reviewable.
Done-when: all boxes ticked (see description). CI: all 8 jobs green on 26ec6ac5 (Build & test, EF migration integrity, Functional E2E, Formatting, decisions lifecycle, API docs, PR gates; image-push skipped for PR). Live-E2E: no-store on m3u/xmltv/m3u8, url-tvg percent-encoded, request log access_token=***.
**Review-verdict:** ✅ clean — head `26ec6ac5`
Two independent cold review rounds (adversarial, LSP-verified, no implementation context):
- **Round 1** traced every `access_token` interpolation site and manifest endpoint; found the XMLTV twin (Finding 1), a TS-redirect `no-store` gap (Finding 2), and a documented load-bearing residual (Finding 3, `Microsoft: Warning` appsettings suppressor — not UI-reachable).
- **Round 2** (fix re-review) confirmed all three CONFIRMED-FIXED with no new defects: XMLTV layering `SecurityElement.Escape(Uri.EscapeDataString(token))` round-trips correctly; TS redirect `no-store` complete; Finding 3 documentation disposition reasonable.
The only change since the reviewed `a372742e` is an empty `[decisions-edit]` authorization commit (`26ec6ac5`) — nothing reviewable.
**Done-when:** all boxes ticked (see description). **CI:** all 8 jobs green on `26ec6ac5` (Build & test, EF migration integrity, Functional E2E, Formatting, decisions lifecycle, API docs, PR gates; image-push skipped for PR). **Live-E2E:** no-store on m3u/xmltv/m3u8, url-tvg percent-encoded, request log `access_token=***`.
timothy
merged commit 0c063c23fb into main2026-07-23 18:31:00 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Bundle: access_token transport hardening (#421 + #559) — two concrete fixes on the shared
?access_token=/iptvsurface.#421 — token not quote-safe in M3U/HLS/XMLTV URLs
A token containing
"/&could break out of the quoted M3Uurl-tvg="..."/tvg-logo="..."attributes (or split a query). Now percent-encoded (Uri.EscapeDataString) at every interpolation site:ChannelPlaylist.ToM3U,IptvController.AccessTokenQuery,FFmpegLibraryProcessService.WrapSegmenter, and the XMLTV twinGetChannelGuideHandler(percent-encode then XML-escape). No-op for a normal base64url JWT → M3U/XMLTV goldens byte-identical.Done-when
"cannot malform M3U output (validated or encoded)ChannelPlaylistAccessTokenTests, updatedGuide_encodes_and_xml_escapes_access_token)#559 — transport hardening (redact from logs + no-store)
?access_token=<jwt>query on any 5xx/Error/iptvrequest.IncludeQueryInRequestPath = false+ newRequestLogScrubber→RequestPathScrubbed(masks token to***, keeps other params).channels.m3u,xmltv.xml, the.m3u8HLS manifests, and their token-bearing 302 Locations now returnCache-Control: private, no-store.Done-when
/iptv/...?access_token=request does not write the token to the logno-storedocs/decisions/api-auth-security.mdupdated (folds the deferred-hardening note undersecurity.iptv-browser-token)Verification
no-storegap (Finding 2, fixed), and a documented load-bearing residual (Finding 3,Microsoft: Warningappsettings override — not UI-reachable).no-storeon m3u/xmltv/m3u8;url-tvgshowsaccess_token=aa%22bb%26cc(no breakout); request log rendersaccess_token=***with the raw token absent.Decision record
security.iptv-access-token-transportadded.Closes #421
Closes #559
🤖 Generated with Claude Code
Review-verdict: ✅ clean — head
26ec6ac5Two independent cold review rounds (adversarial, LSP-verified, no implementation context):
access_tokeninterpolation site and manifest endpoint; found the XMLTV twin (Finding 1), a TS-redirectno-storegap (Finding 2), and a documented load-bearing residual (Finding 3,Microsoft: Warningappsettings suppressor — not UI-reachable).SecurityElement.Escape(Uri.EscapeDataString(token))round-trips correctly; TS redirectno-storecomplete; Finding 3 documentation disposition reasonable.The only change since the reviewed
a372742eis an empty[decisions-edit]authorization commit (26ec6ac5) — nothing reviewable.Done-when: all boxes ticked (see description). CI: all 8 jobs green on
26ec6ac5(Build & test, EF migration integrity, Functional E2E, Formatting, decisions lifecycle, API docs, PR gates; image-push skipped for PR). Live-E2E: no-store on m3u/xmltv/m3u8, url-tvg percent-encoded, request logaccess_token=***.