fix: redact sensitive data from diagnostics files before sharing#12290
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: redact sensitive data from diagnostics files before sharing#12290roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
Addresses the security concern raised in #12284 where diagnostic files contain sensitive information (API keys, tokens, secrets) that users might accidentally share. Changes: - Add redact utility (src/utils/redact.ts) with pattern-based redaction for common API keys (Anthropic, OpenAI, OpenRouter, Google, AWS, GitHub), Bearer tokens, environment variable secrets, and JSON key-value secrets - Apply redactDiagnosticsData() in diagnosticsHandler.ts before writing the diagnostics file to disk - Update the header comment to inform users that sensitive data has been automatically redacted, while still advising manual review - Add comprehensive tests for both the redaction utility and its integration in the diagnostics handler
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.
Related GitHub Issue
Closes: #12284
Description
This PR attempts to address the security concern raised in Issue #12284, where diagnostic files generated for support contain sensitive information (API keys, tokens, secrets) that users might accidentally share.
Key changes:
src/utils/redact.ts): Pattern-based redaction for common API key formats (Anthropic, OpenAI, OpenRouter, Google, AWS, GitHub), Bearer tokens, environment variable secrets, and JSON key-value secrets. Includes both string-level (redactSensitiveInfo) and recursive object-level (redactDiagnosticsData) redaction.src/core/webview/diagnosticsHandler.ts):redactDiagnosticsData()is called on the full diagnostics payload (including conversation history) before writing to the temp file.Design choices:
apiKey,password,token) are fully redacted regardless of value patternFeedback and guidance are welcome.
Test Procedure
cd src && npx vitest run utils/__tests__/redact.spec.tsandcd src && npx vitest run core/webview/__tests__/diagnosticsHandler.spec.tsPre-Submission Checklist
Documentation Updates
Additional Notes
The redaction patterns cover the most common API key formats. Additional patterns can be added as needed for other providers or secret formats.
Interactively review PR in Roo Code Cloud