Skip to content

Stop writing the bearer token to the log - #24

Open
agent-qv wants to merge 1 commit into
Combodo:masterfrom
agent-qv:pr/no-token-in-log
Open

agent-qv wants to merge 1 commit into
Combodo:masterfrom
agent-qv:pr/no-token-in-log

Conversation

@agent-qv

@agent-qv agent-qv commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #23.

AuthTokenAuthenticator no longer puts the token, or the raw Authorization header, in its debug messages. The messages themselves stay. One file, two lines, no change in behaviour.

AuthTokenAuthenticator logged the token at debug level, and the whole
Authorization header when it did not match "Bearer <token>". That looks
harmless with APP_LOG_LEVEL=info, but config/packages/monolog.yaml also
defines filter_for_errors, a fingers_crossed handler whose nested
file_log handler has no level: as soon as a request logs one error,
every record buffered for that request, debug included, is written to
mcp.log. A failed tool call or a token refused by iTop is enough to put
the token in the log in clear.

The messages stay, only the secret goes. The logging setup is left as
it is: escalating to debug on error is useful, a secret in a debug
message is not.
Copilot AI balanced review requested due to automatic review settings October 18, 2026 20:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Both changes remove credential exposure without altering authentication logic or logging configuration.

No open issues 🎉

What changed in this PR

Removes credentials from authentication debug logs while preserving diagnostic messages and authentication behavior.

Changes:

  • Stops logging malformed Authorization header contents.
  • Replaces bearer token output with a generic receipt message.
File Description
src/​Security/​AuthTokenAuthenticator.php Removes sensitive values from two debug messages.

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The bearer token is written in clear to mcp.log whenever a request logs an error

2 participants