security: redact session token from viewer access logs#877
Open
Sunil56224972 wants to merge 1 commit into
Open
security: redact session token from viewer access logs#877Sunil56224972 wants to merge 1 commit into
Sunil56224972 wants to merge 1 commit into
Conversation
The viewer server's log_message() logs the full request line, including the query string. The bootstrap token is passed as ?token=... in the initial page load URL, so it appears in plain text in log output. If logs are persisted (e.g. --log-file, systemd journal, or a redirected stdout), an attacker with read access to the log file can extract the token and hijack the viewer session -- bypassing the session cookie authentication that protects steering, report delivery, and scan history. Fix: detect the session token in the formatted log message and replace it with [REDACTED] before emitting the log line.
Contributor
Greptile SummaryPrevents viewer session tokens from leaking through HTTP access logs.
Confidence Score: 5/5The PR appears safe to merge, and the targeted redaction prevents the bootstrap token from being written to viewer access logs. The URL-safe token appears unchanged in the formatted HTTP request line, and the new replacement removes every occurrence before the message reaches the logger while leaving unrelated log output unchanged. Important Files Changed
Reviews (1): Last reviewed commit: "security: redact session token from view..." | Re-trigger Greptile |
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
The viewer server's
log_message()override logs the full HTTP request line, including the query string. The bootstrap session token is passed as?token=...in the initial page load URL (viaauthorized_url()), so it appears in plain text in log output.Severity: Medium
If logs are persisted (e.g.
--log-file, systemd journal, or redirected stdout), an attacker with read access to the log file can extract the token and hijack the viewer session — bypassing the session cookie authentication that protects:Fix
Detect the per-process session token in the formatted log message and replace it with
[REDACTED]before emitting the log line. This is a minimal, targeted change that:incheck on debug-level log lines)Files changed
strix/viewer/server.pyTesting
[REDACTED]in log output