Repository navigation
🔒 Stop printing the Valohai LLM API key in debug logs - #44
Merged
Merged
Conversation
`conduit -v` logs the loaded config with its `Debug` representation, and `ValohaiLlmConfig` derived `Debug`, so `valohai_llm.api_key` was printed in full on the "config loaded" line, whether the key came from `conduit.toml` or `VALOHAI_LLM_API_KEY`. `ValohaiLlmConfig` now implements `Debug` by hand. The line shows `api_key: "<redacted>"` when a key is set and `api_key: "<empty>"` when it is not, so you can still tell whether a key was picked up, and `url` is shown as before. Fixes #40 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change that redacts the Valohai LLM API key from configuration debug logs.
No open issues 🎉
What changed in this PR
Addresses #40 by preventing the Valohai LLM API key from appearing in configuration debug logs, while preserving whether a key is set. Other secret-logging paths remain outside this PR’s scope and are tracked in #42.
Changes:
- Replaces derived
Debugwith a custom implementation showing<redacted>or<empty>instead of the key. - Adds regression tests for TOML-loaded and environment-loaded keys, nested configuration formatting, and empty keys.
| File | Description |
|---|---|
crates/core/src/config.rs |
Redacts the API key in debug output and adds regression tests. |
Review effort: Balanced
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.
Fixes #40.
conduit -vlogs the loaded config with itsDebugrepresentation, andValohaiLlmConfigderivedDebug, so the Valohai LLM API key was printed in full on the "config loaded" line.ValohaiLlmConfignow implementsDebugby hand:The line still shows whether a key was picked up, which is the useful part when debugging forwarding.
For the reviewer
secrecy::SecretString. This PR doesn't use it: the hand-writtenDebugcovers every{:?}of the config without a new dependency or a change to the field type thatsync.rsreads.Debugoutput ofValohaiLlmConfigor of a wholeConfig, for a key from the TOML file and for one fromVALOHAI_LLM_API_KEY.-vv, are tracked inconduit -vvprints provider API keys, and two other log paths can leak secrets #42 and not changed here.Testing
cargo fmt --all --check,cargo clippy --workspace --tests --lockedandcargo test --workspace --lockedpass. The old and new binaries were also run with a dummy key; with the fix, the key appears nowhere in the output at-vor-vv.🤖 Generated with Claude Code