fix(config): prevent config set from persisting env-only API key to disk#76
Conversation
config.Get() merges RUNWARE_API_KEY from the environment before saving, silently writing an ephemeral key to ~/.runware/config.yaml. Switch to config.FileConfig() (file-only read) to mirror the pattern already used by config reset. Adds TestSetDoesNotPersistEnvAPIKey regression test. Fixes RUN-10950 Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. To trigger a review, include ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR prevents runware config set from accidentally persisting an API key that was provided only via RUNWARE_API_KEY by switching the command’s read-modify-write flow to use config.FileConfig() (file-only) instead of config.Get() (merged with env).
Changes:
- Update
config setto load file-only config viaconfig.FileConfig()and return a wrapped error on read failure. - Add a regression test ensuring
config setdoes not write an env-only API key into~/.runware/config.yaml.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/cmd/config/set.go | Uses file-only config for read-modify-write to avoid persisting env-only API keys. |
| internal/cmd/config/config_test.go | Adds regression test to ensure config set doesn’t persist RUNWARE_API_KEY to disk. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
config.Get() merges RUNWARE_API_KEY from the environment before saving, silently writing an ephemeral key to ~/.runware/config.yaml. Switch to config.FileConfig() (file-only read) to mirror the pattern already used by config reset. Adds TestSetDoesNotPersistEnvAPIKey regression test.
Fixes RUN-10950