fix(config): vault token resolution must not auto-create channel configs#2133
Merged
fix(config): vault token resolution must not auto-create channel configs#2133
Conversation
resolve_vault_secrets() used get_or_insert to create TelegramConfig, DiscordConfig, and SlackConfig when vault tokens were found, even when no corresponding section existed in the config file. This caused immediate startup failure due to empty allowed_users. Replace get_or_insert with as_mut() let-chains so vault tokens are only injected into existing channel configs. If no [telegram]/[discord]/ [slack] section is present, the vault token is silently ignored and the agent starts in CLI mode as expected. Closes #2132
…ution behavior age_encrypt_decrypt_resolve_secrets_roundtrip now asserts telegram is None when no [telegram] section exists in config (new correct behavior). Added age_vault_injects_token_into_existing_telegram_config to verify that vault tokens ARE injected when the config section already exists.
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
resolve_vault_secrets()usedget_or_insertto createTelegramConfig/DiscordConfig/SlackConfigwhen vault tokens were found, even without a corresponding config sectionallowed_users→telegram.allowed_users must not be emptyget_or_insertwithas_mut()let-chains — vault tokens are only injected into configs that already exist from the TOML fileTest plan
cargo +nightly fmt --checkpassescargo clippy --features full --workspace -- -D warningspassescargo nextest run --config-file .github/nextest.toml --workspace --features full --lib --bins— 6397 tests passCloses #2132