fix: mask API key output and clear conflicting OAuth credentials#195
Merged
Conversation
adec0dc to
dc9b7e2
Compare
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
api_keyin normal and dry-runconfig setoutputRoot cause
config setrendered every value verbatim, including API keys. It also wrote a newapi_keywithout clearing OAuth, while the credential resolver prefers OAuth over the config-file API key. The command could therefore leak the secret and then silently continue using the old credential.The first regression tests used a process-wide Bun module mock. After PR #194 added auth persistence coverage, that mock leaked into the auth tests and replaced their real temporary config loader. Empty values also remained valid and could erase a working OAuth session while saving an unusable key.
Impact
The complete key is still written to the mode-0600 config file, but terminal and CI output only receive a masked value. A successful API-key update now leaves one unambiguous credential source. Empty values fail without touching existing credentials, and the tests preserve the isolation introduced by PR #194.
Validation
bun test— 392 passedbun run typecheckbun run build:devgit diff --check