Repository navigation
fix: an app's certificate authenticates as the KMS to any guest that pins the root CA - #1255
Merged
Merged
Conversation
- 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.
The root pin plus the kms:rpc usage already identify the KMS. Verifying its quote on every SignCert added a collateral fetch per GetTlsKey and made that path depend on collateral availability. Also let the test server bind port 0 and report it on liftoff instead of racing a released port, and stop shadowing app_info in sign_csr.
kvinwang
enabled auto-merge
September 24, 2026 04:09
kvinwang
added a commit
that referenced
this pull request
Sep 25, 2026
#1255 made SignCert stamp the verified app info instead of the requester's claims. tc-kms-keys-certs-004 decodes the leaf and requires app:custom, a real device_id rather than sha256(""), and the authorized vm_config os_image_hash. Signed-off-by: Kevin Wang <wy721@qq.com>
kvinwang
added a commit
that referenced
this pull request
Sep 25, 2026
…tls test count #1333 makes --verify-cert report is_valid false with a reason when the attested app info does not decode; run its test from the verifier binary. The ra-tls suite grew (#1232, #1255), so match any passing count and keep requiring the named tests. Signed-off-by: Kevin Wang <wy721@qq.com>
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. The KMS quote is not re-verified per call: the root pin pluskms:rpcalready identify the KMS.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.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.