Conversation
This was referenced Sep 20, 2026
- Remove the doc comment left dangling on AppIdValidator after moving validate_kms_rpc_cert into cert-client. - Lowercase the server cert usage error message. - Shorten history-narrating comments. - Replace ra-tls tests that only asserted sign_csr copies its input with a single fail-closed test; condense the cert-client TLS tests.
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.
Problem
The KMS signs a per-app CA under the same root every guest pins, and
SignCertcopies an app's requested SANs andserverAuthusage into the leaf.cert-clientpinned that root with nocert_validator, so it checked only chain + hostname: any app authorized for key release could mint a certificate for the KMS hostname, and a network attacker holding it would be accepted as the KMS forSignCert/GetMeta. (GetAppKeyindstack-utilwas not affected — it already checks the usage.)Two related issues in the same path:
device_idwas alwayssha256("")in KMS-issued certificates:sign_csrdecoded app info from the requester's unverifiedAttestation<()>, which has no device id.os_image_hashin the certificate came from the config embedded in the CSR, not thevm_configthe KMS authorized. Nothing binds that embedded config to the quote on TDX, so a requester could make the two disagree.Fix
cert-clientinstallsvalidate_kms_rpc_cert(requiresspecial_usage == "kms:rpc"), now shared withdstack-utilinstead of duplicated. Apps can't choose this value: the KMS writeskms:rpconly on its own RPC cert andapp:customon everything it signs for apps.CaCert::sign_csrtakesapp_info: Option<&AppInfo>(the identity the signer verified) instead ofapp_id, and stamps both app extensions from it. It refuses a CSR asking forext_app_infowhen none is supplied.attestation.decode_app_info_ex(false, &request.vm_config)— the same verified attestation andvm_configit authorized. Runtime measurements are unchanged; for honest callers onlydevice_id(now real) andos_image_hashdiffer.Name constraints / SAN allowlists / EKU restrictions were deliberately not used: apps are meant to get
serverAuthcertificates for their own domains.Behavior change
With a validator installed,
RaClientalso verifies the KMS's attestation onSignCert/GetMeta, asdstack-utilalready does against the same endpoint earlier in boot.Tests
cert-client: serves a real app leaf (root →derive_app_ca→sign_csr) and a realkms:rpcleaf over TLS, and drives the production client config against both: the app cert is refused, the KMS cert is accepted.ra-tls:sign_csrrefuses to embed app info the signer did not supply.cargo test -p cert-client -p ra-tls -p dstack-kmspasses;cargo check -p dstack-util -p dstack-guest-agent --all-targetsis clean.