Skip to content

fix(guest): isolate local key providers from KMS inventory - #1016

Open
kvinwang wants to merge 1 commit into
masterfrom
fix/guest-local-provider-inventory-master
Open

fix(guest): isolate local key providers from KMS inventory#1016
kvinwang wants to merge 1 commit into
masterfrom
fix/guest-local-provider-inventory-master

Conversation

@kvinwang

@kvinwang kvinwang commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • validate KMS inventory requirements according to the selected key-provider kind
  • allow local, TPM, and ephemeral key providers to proceed without configured KMS URLs
  • cover provider-specific validation with a focused regression test

Context

This supersedes #954, which was accidentally merged into its stacked base branch instead of master. The replacement is based directly on the latest master and excludes the abandoned refactoring from #946.

Verification

  • cargo fmt --manifest-path dstack/Cargo.toml -p dstack-util --check
  • cargo test --manifest-path dstack/Cargo.toml -p dstack-util local_key_providers_do_not_require_kms_inventory
  • git diff --check

Copilot AI lite review requested due to automatic review settings August 5, 2026 16:19
@kvinwang
kvinwang enabled auto-merge August 5, 2026 16:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_inputs to gate KMS inventory requirements based on KeyProviderKind.
  • 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");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants