feat(security): add global tracing scrubber to prevent token exposure in logs#3
Open
alessandrostone wants to merge 1 commit intomainfrom
Open
feat(security): add global tracing scrubber to prevent token exposure in logs#3alessandrostone wants to merge 1 commit intomainfrom
alessandrostone wants to merge 1 commit intomainfrom
Conversation
… in logs Implements automatic sanitization of GitHub tokens and credentials across all log output using tracing-subscriber. Prevents accidental exposure of: - GitHub tokens (ghp_, gho_, ghu_, ghs_, ghr_) - Credentials in URLs (x-access-token, basic auth) - Bearer tokens Resolves critical security vulnerability where installation tokens embedded in git URLs would leak through error messages. - add tracing and tracing-subscriber to Cargo.toml
9959249 to
f68d4b1
Compare
jsam
approved these changes
Nov 18, 2025
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
Changes
src/tracing_sanitizer.rswith regex-based sanitizationMakeWritertrait for automatic log interceptiongitops.rsandapp_auth.rsstd::sync::Mutextotokio::sync::Mutexinit_tracing()andinit_tracing_json()functionsSecurity Impact
🔒 Resolves critical vulnerability: Installation tokens embedded in git clone URLs (e.g.,
https://x-access-token:TOKEN@github.com/repo.git) were previously exposed in error messages when git commands failed. All tokens are now automatically redacted before logs are written.Test Coverage
Example Output
Before:
Error: git clone failed: https://x-access-token:ghs_16C7e42F292c6912E7710c838347Ae178B4a@github.com/repo.gitAfter:
Error: git clone failed: https://x-access-token:[REDACTED]@github.com/repo.git