fix: preserve empty API keys in redaction output#45
Merged
kriserickson merged 2 commits intomainfrom Mar 2, 2026
Merged
Conversation
Co-authored-by: kriserickson <325934+kriserickson@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add enhanced debug logging and sensitive data handling
fix: preserve empty API keys in redaction output
Mar 2, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes redaction behavior so empty API key values remain empty in display/redacted outputs, allowing users to distinguish “unset” from “set but masked” when viewing configuration.
Changes:
- Update
RedactSecretto return""for empty input while preserving existing masking behavior for non-empty secrets. - Adjust config-related tests to expect
""(not"****") for empty secret values.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/config/redact.go | Preserves empty-string secrets by returning "" early in RedactSecret. |
| internal/config/config_test.go | Updates TestRedactSecret to expect empty output for empty input. |
| cmd/cmd_test.go | Updates TestMaskKey to expect empty output for empty input. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
RedactSecretreturned"****"for empty strings, causingconfig show(which marshalsRedactedCopy) to render unset API keys as non-empty placeholders — making it impossible to distinguish an unconfigured key from a masked one, and risking users persisting"****"as a real key value.Changes
internal/config/redact.go:RedactSecretreturns""immediately for empty input; non-empty short strings still produce"****"internal/config/config_test.go,cmd/cmd_test.go: updated empty-string test cases to expect""instead of"****"🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.