You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MarkdownLogger.Log() already calls sanitize.SanitizeString() on every message before writing to gateway.md, redacting tokens/keys/secrets. However, FileLogger.Log() (writes the unified mcp-gateway.log) and ServerFileLogger.Log() (writes per-server <serverID>.log files) both build their log line via the shared formatLogLine() helper, which did not sanitize the formatted message. This meant secrets logged via logger.LogInfo, logger.LogWarn, logger.LogError, logger.LogDebug, logger.LogInfoToServer, etc. could leak into mcp-gateway.log and per-server log files even though the markdown log correctly redacted them.
Fix
Centralized the fix in formatLogLine() (shared by both FileLogger and ServerFileLogger) so the fully-formatted message is passed through sanitize.SanitizeString() before being returned, mirroring the existing MarkdownLogger.Log() behavior. This ensures secrets are redacted consistently across all three file-based log sinks (unified log, per-server logs, markdown log).
Trade-offs
Adds one extra pass of the 10 compiled sanitize regex patterns per log line for FileLogger/ServerFileLogger (previously only MarkdownLogger paid this cost). This is consistent with existing behavior elsewhere in the codebase (e.g. RPC message logging already sanitizes once and shares the result across sinks) and is a worthwhile trade-off for closing a secret-leakage gap.
No API changes; formatLogLine signature and callers are unchanged.
Test Status
Added a regression test (TestFormatLogLine/secrets_in_the_formatted_message_are_redacted) asserting that a GitHub PAT-shaped string is redacted to [REDACTED] by formatLogLine.
gofmt passes cleanly on both changed files (no diff).
Could not run go build/go test in this sandbox: the Go module proxy (proxy.golang.org) is blocked by the environment firewall (403 Forbidden on all module downloads, including toolchain and dependency downloads), so the module graph cannot be resolved here. This is an environment/infrastructure limitation, not a defect in the change. The change is a small, syntactically-verified (gofmt -e) addition of a single sanitize call and a corresponding unit test using only existing test patterns already present in global_state_test.go; please run make test / make agent-finished in CI to confirm.
Warning
Firewall blocked 2 domains
The following domains were blocked by the firewall during workflow execution:
goproxy.io
proxy.golang.org
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
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
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.
🤖 This is an automated pull request from Repo Assist, an AI assistant.
Closes #10763
Root cause
MarkdownLogger.Log()already callssanitize.SanitizeString()on every message before writing togateway.md, redacting tokens/keys/secrets. However,FileLogger.Log()(writes the unifiedmcp-gateway.log) andServerFileLogger.Log()(writes per-server<serverID>.logfiles) both build their log line via the sharedformatLogLine()helper, which did not sanitize the formatted message. This meant secrets logged vialogger.LogInfo,logger.LogWarn,logger.LogError,logger.LogDebug,logger.LogInfoToServer, etc. could leak intomcp-gateway.logand per-server log files even though the markdown log correctly redacted them.Fix
Centralized the fix in
formatLogLine()(shared by bothFileLoggerandServerFileLogger) so the fully-formatted message is passed throughsanitize.SanitizeString()before being returned, mirroring the existingMarkdownLogger.Log()behavior. This ensures secrets are redacted consistently across all three file-based log sinks (unified log, per-server logs, markdown log).Trade-offs
FileLogger/ServerFileLogger(previously onlyMarkdownLoggerpaid this cost). This is consistent with existing behavior elsewhere in the codebase (e.g. RPC message logging already sanitizes once and shares the result across sinks) and is a worthwhile trade-off for closing a secret-leakage gap.formatLogLinesignature and callers are unchanged.Test Status
TestFormatLogLine/secrets_in_the_formatted_message_are_redacted) asserting that a GitHub PAT-shaped string is redacted to[REDACTED]byformatLogLine.gofmtpasses cleanly on both changed files (no diff).go build/go testin this sandbox: the Go module proxy (proxy.golang.org) is blocked by the environment firewall (403 Forbidden on all module downloads, including toolchain and dependency downloads), so the module graph cannot be resolved here. This is an environment/infrastructure limitation, not a defect in the change. The change is a small, syntactically-verified (gofmt -e) addition of a single sanitize call and a corresponding unit test using only existing test patterns already present inglobal_state_test.go; please runmake test/make agent-finishedin CI to confirm.Warning
Firewall blocked 2 domains
The following domains were blocked by the firewall during workflow execution:
goproxy.ioproxy.golang.orgTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.
Add this agentic workflow to your repo
To install this agentic workflow, run