fix(config): show only last 4 characters of API key in config show#78
Merged
electather merged 1 commit intomainfrom Mar 16, 2026
Merged
fix(config): show only last 4 characters of API key in config show#78electather merged 1 commit intomainfrom
electather merged 1 commit intomainfrom
Conversation
Replace the prefix-exposing mask (first4****last4) with ********last4 so the key prefix is never revealed in output. Short keys (≤ 4 chars) remain fully masked as ****, and absent keys continue to show <not set>. Closes #67
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
Replace the
first4****last4masking format with********last4so the API key prefix is never shown in plain text. This prevents accidental exposure when screenshots or logs ofconfig showoutput are shared.Closes #67
Changes
cmd/config/show.go: new masking logic — keys longer than 4 chars get"********" + last4; keys of 4 chars or fewer get"****"; absent keys still show<not set>tests/config_test.go: update existing assertion to expect the new********2345format and verify the prefix is not visible on theAPI Key:linetests/config_show_mask_test.go: new table-driven tests covering long keys, exactly-5-char keys, 4-char keys, 2-char keys, and absent keysTest plan
go test -v ./...passesgo fmt ./...produces no diffgo buildsucceedsChecklist
--help, comments)