Repository navigation
Conversation
Signed-off-by: Kevin Wang <[email protected]>
Signed-off-by: Kevin Wang <[email protected]>
kvinwang
marked this pull request as draft
December 1, 2026 02:53
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.
Backport of #1656 to v0.5.x, with the handshake issuer pin from #1577 (38eb367) that it builds on.
Problem
Since #1579, 0.5.x guests send the launch ticket in
GetAppKeyandSignCert, but the KMS is authenticated only after the request is sent:dstack-utiltrusts the CA that the KMS itself returns from the unauthenticatedGetTempCaCert. It checks the composekey_provider_idonly afterGetAppKeyreturns.kms:rpcusage check runs incert_validator, which runs on the response. A server holding any certificate under the KMS root (e.g. an app'sapp:customcert) completes the handshake and receives the ticket.Fix
ra-rpc:RaClientConfig::tls_pinned_issuerrequires, during the handshake, a non-CA leaf within its validity, with the pinned special usage, signed directly by the pinned key. It requires anhttpsURL and disables redirects.dstack-util: pin the KMS to the CA this boot already established when there is one. Otherwise pin it to the composekey_provider_idwhen that is non-empty. With neither, the behaviour is unchanged.cert-client: pin the runtime KMS client (SignCert, historicalGetAppKey) to the CA's key.The KMS signs its
kms:rpccertificate directly with the root CA key (kms/src/onboard_service.rs), so existing KMS deployments pass the pin.Verification
cargo test --locked -p ra-rpc -p cert-client -p dstack-utilpasses. It includes the portedra-rpc/tests/issuer_pinning.rs: wrong issuer, wrong usage, CA, and expired leaves never receive the request.cargo clippy -D warningsoncert-client,dstack-util,dstack-guest-agentandra-rpc.ra-rpcis run with-A clippy::items_after_test_modulefor a lint already failing on this branch inrocket_helper.rs.