fix(security): remove raw session_id from security event logs#625
Open
hobostay wants to merge 1 commit into
Open
fix(security): remove raw session_id from security event logs#625hobostay wants to merge 1 commit into
hobostay wants to merge 1 commit into
Conversation
The INVALID_SESSION_ID_FORMAT log event was logging the raw user-supplied session_id value in both the message and details field. Since this input is already flagged as potentially malicious (failing the format check), logging it verbatim could enable log injection attacks where an attacker crafts a session_id containing log-forging characters (e.g. newlines) to inject fake log entries. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
session_idfrom theINVALID_SESSION_ID_FORMATsecurity log eventdetailsfieldVulnerability Details
In
server/routes/sessions.py(lines 21-26), when an invalidsession_idis detected, the code logs:Since this input already failed the format validation and is flagged as potentially malicious, logging it verbatim is risky:
session_idcontaining newline characters or log-formatting sequences to inject fake log entries, obscuring real attacksdetails, potentially exposing injection payloads to downstream log analysis systemsFix
Replace with a static message that still records the event without echoing the raw input:
Test plan
🤖 Generated with Claude Code