Repository navigation
fix(playback): keep the account token out of transcode relay logs - #3126
Conversation
The transcode relay strips only the stream token ("st") from the URL it
forwards to the node, so a player's account "token" query stays in it.
Two error branches logged that URL as-is, and the proxy branch also logged
the HTTP client's error, whose text repeats the full URL. The proxy branch
runs on every client cancel, so access tokens reached stderr and the
operational log.
Log both URLs through logredact.SanitizeURL and the proxy error through
logredact.SanitizeURLError, as the unreachable branch already does. The
token is still forwarded: the node copies the query into segment URIs,
which native HLS players need for owner-checked V3 sessions.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 8 minutes. View limit details
Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…3137) * fix(logredact): keep signed stream and download tokens out of logs When the download preflight to a proxy node failed, a debug log wrote the HTTP client's error, which repeats the probe URL with the signed download token in its path. logredact.SanitizeURL only dropped userinfo, query and fragment, so routing the error through it would not have helped, and the same gap applied to every signed stream URL (/stream/direct/, /stream/remux/, /stream/transcode/<token>/...). Signed stream and download tokens are JWTs, so logredact now treats a JWT-shaped path segment as a credential: SanitizeURL and SanitizeRequestURL mask it, and the checks that decide whether a URL needs sanitizing (SanitizeURLError's requested-URL scrub, SanitizeJSON and the operational log's free-text URL pass) share one rule, URLMayHoldCredential. The preflight log now uses SanitizeURLError. The proxy's "proxy to transcode node" error log, the node-side copy of the relay log fixed in #3126, also logged its raw URL and error, whose query can carry the player's account token. It now uses SanitizeURL and SanitizeURLError like the API relay. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(logredact): match token path segments after unescaping A token whose characters were percent-encoded in the path, such as a leading %65 for e, slipped past the redaction and decodes back to a working token. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(opslog): trim a trailing exclamation mark before checking a logged URL An exclamation mark ending a sentence was taken into the URL, so a signed token in its last path segment no longer matched and stayed in the log. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Problem
Related issue: N/A
Validation tasks: none
When a player streams a transcode that runs on a remote transcode node, the API relays each manifest and segment request to the node. Two of the relay's error logs wrote the request URL with the viewer's account access token still in it. One of them runs every time a client cancels a request, which players do routinely while seeking or stopping. The token ended up in stderr, any OTLP collector, and the operational log that admins can read in the web admin. Anyone with access to those logs could reuse a viewer's token until it expires, about 8 hours by default. An automated security scan found this, and the finding was re-verified against the code.
The relay removes the signed stream token (
st) from the forwarded URL but keeps every other query parameter, including thetokenthe web player appends because a native media element cannot send anAuthorizationheader. The "proxy to transcode node" branch logged that URL as-is, and itserrorattribute also carried the full URL, since the HTTP client's*url.Errorrepeats it. The "read transcode node manifest" branch logged the same URL. The console log handler redacts by attribute key only, so neither value was masked.Approach
Both branches now log the URL through
logredact.SanitizeURL, which drops the query, and the proxy branch logs its error throughlogredact.SanitizeURLError. That matches the neighboring "transcode node unreachable" branch, which already sanitized both. No new redaction code.The token is still forwarded to the node. The node copies the forwarded query into the segment URIs of the manifest it builds, and negotiated V3 sessions check the account owner on every segment request. A native HLS player has no other way to authenticate those requests when the URL carries no
st, so droppingtokenfrom the forwarded query could break that playback. The other node-URL logs in the handlers package already go throughSanitizeURL.Validation
gofmt,go vet,make lint-changed,make lint-router-recovery: clean.go test ./internal/api/handlers/: pass.make test-go: fails locally ininternal/jellycompat,internal/metadata/nfo,internal/playback,internal/scannerandinternal/subtitles/subsync, on filename case and encoding on macOS and on real-FFmpeg timeouts. None of those packages importinternal/api/handlers.?token=through the console handler stack. Before the change the token appeared 3 times in the output; after it, 0. That test is not committed because the redaction helpers already have their own tests.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-3126/
Risks
Only log output changes. These two messages no longer include the relay request's query string; the path, node and playback session ID are still logged.
Checklist
AI Disclosure
🤖 Generated with Claude Code