fix(guest): isolate local key providers from KMS inventory - #1016
Open
kvinwang wants to merge 1 commit into
Open
fix(guest): isolate local key providers from KMS inventory#1016kvinwang wants to merge 1 commit into
kvinwang wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines guest key provisioning validation so only the Kms key provider requires a configured KMS URL inventory, allowing non-KMS providers (local/TPM/none) to proceed without KMS configuration. It adds a focused regression test to ensure provider-specific validation behavior is enforced.
Changes:
- Add
validate_key_provider_inputsto gate KMS inventory requirements based onKeyProviderKind. - Invoke this validation before selecting the provider-specific key request path.
- Add a unit test covering provider-specific validation behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| assert!(validate_key_provider_inputs(KeyProviderKind::Tpm, &no_urls).is_ok()); | ||
| assert!(validate_key_provider_inputs(KeyProviderKind::None, &no_urls).is_ok()); | ||
| let error = validate_key_provider_inputs(KeyProviderKind::Kms, &no_urls).unwrap_err(); | ||
| assert!(error.to_string().contains("No KMS URLs are set")); |
|
|
||
| fn validate_key_provider_inputs(kind: KeyProviderKind, kms_urls: &[String]) -> Result<()> { | ||
| if kind.is_kms() && kms_urls.is_empty() { | ||
| bail!("No KMS URLs are set"); |
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
Context
This supersedes #954, which was accidentally merged into its stacked base branch instead of
master. The replacement is based directly on the latestmasterand excludes the abandoned refactoring from #946.Verification
cargo fmt --manifest-path dstack/Cargo.toml -p dstack-util --checkcargo test --manifest-path dstack/Cargo.toml -p dstack-util local_key_providers_do_not_require_kms_inventorygit diff --check