refactor(attestation): explicit trust configuration and mock E2E#806
Open
kvinwang wants to merge 9 commits into
Open
refactor(attestation): explicit trust configuration and mock E2E#806kvinwang wants to merge 9 commits into
kvinwang wants to merge 9 commits into
Conversation
…y-compose # Conflicts: # dstack/local-key-provider/build/Dockerfile.key-provider
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends dstack’s attestation stack to support externally configured verification trust anchors (while keeping vendor roots as the secure default), and adds a deterministic mock-attestation toolkit + E2E coverage to exercise TDX, TPM, NSM, and SEV-SNP verification paths.
Changes:
- Add configurable attestation root trust anchors guarded by an explicit
insecure_allow_external_trust_anchorsopt-in across KMS, gateway, and verifier. - Introduce
mock-attestation+dstack-tee-simulatorintegration for cryptographically valid, deterministic evidence/collateral across TDX/TPM/NSM/SEV-SNP. - Add a production-style full-stack Compose E2E suite to validate stateful upgrades and HA gateway behavior.
Reviewed changes
Copilot reviewed 62 out of 64 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test-suites/full-stack-compose/state/.gitkeep | Keep state dir in repo. |
| test-suites/full-stack-compose/scripts/runner.sh | Orchestrate full-stack rolling upgrade + assertions. |
| test-suites/full-stack-compose/scripts/render-config.sh | Render pinned E2E config + artifacts. |
| test-suites/full-stack-compose/scripts/network-probe.sh | HA probe during gateway rolling restart. |
| test-suites/full-stack-compose/scripts/app_compose.py | Generate measured app-compose manifests. |
| test-suites/full-stack-compose/scripts/allowlist.py | Manage mutable auth allowlist JSON. |
| test-suites/full-stack-compose/runtime/requirements.txt | Runtime Python deps for E2E tooling. |
| test-suites/full-stack-compose/runtime/Dockerfile | Build E2E runtime container image. |
| test-suites/full-stack-compose/run-upgrade-e2e.sh | Driver script for the upgrade E2E. |
| test-suites/full-stack-compose/README.md | Documentation for running the E2E suite. |
| test-suites/full-stack-compose/mock-cf-dns/server.py | Mock Cloudflare DNS API + UDP TXT server. |
| test-suites/full-stack-compose/mock-cf-dns/Dockerfile | Containerize mock DNS service. |
| test-suites/full-stack-compose/compose.yml | Compose stack for infra + runner. |
| test-suites/full-stack-compose/.gitignore | Ignore local env/state artifacts. |
| test-suites/full-stack-compose/.env.example | Example env overrides for E2E. |
| os/yocto/layers/meta-dstack/recipes-core/dstack-tee-simulator/files/dstack-tee-simulator.service | Export simulator env vars to systemd environment. |
| dstack/vmm/src/vmm-cli.py | Support updating KMS URL list via UpgradeApp. |
| dstack/vmm/src/tests/test_vmm_cli.py | Regression test for CLI upgrade params. |
| dstack/vmm/src/config.rs | Add optional tee_simulator config in CVM config. |
| dstack/vmm/src/app.rs | Include tee_simulator in guest sys-config JSON. |
| dstack/verifier/src/verification.rs | Refactor/prune image cache contents more safely + test. |
| dstack/verifier/src/main.rs | Load/apply configured root CA paths at startup. |
| dstack/verifier/dstack-verifier.toml | Document root CA overrides + opt-in gate. |
| dstack/tpm-qvl/src/lib.rs | Add TPM QVL QuoteVerifier with injectable root CA. |
| dstack/tpm-attest/src/lib.rs | Route to mock TPM path when mock-attestation enabled. |
| dstack/tpm-attest/src/gcp_ak.rs | Allow mock TPM quote generation via mock service. |
| dstack/tee-simulator/tests/process_e2e.rs | E2E test for separate simulator process + all platforms. |
| dstack/tee-simulator/src/tdx.rs | Generate TDX quotes from deterministic mock PKI seed. |
| dstack/tee-simulator/src/main.rs | Select platform from sys-config + run mock collateral service. |
| dstack/tee-simulator/Cargo.toml | Add deps for mock attestation and HTTP service. |
| dstack/tdx-attest/src/linux.rs | Allow mock TDX quote generation via mock service. |
| dstack/tdx-attest/Cargo.toml | Add dstack-types dependency for mock client. |
| dstack/sev-snp-qvl/src/lib.rs | Add injectable ARKs + adjust chain verification logic. |
| dstack/sev-snp-qvl/Cargo.toml | Add x509 parsing deps for chain verification. |
| dstack/sev-snp-attest/src/lib.rs | Support mock SEV-SNP evidence via mock service. |
| dstack/sev-snp-attest/Cargo.toml | Add serde + mock client deps. |
| dstack/nsm-qvl/src/lib.rs | Add NSM QVL QuoteVerifier with injectable root CA. |
| dstack/nsm-attest/src/lib.rs | Support mock NSM docs + safe drop when fd is synthetic. |
| dstack/nsm-attest/Cargo.toml | Add dstack-types dependency for mock client. |
| dstack/local-key-provider/build/Dockerfile.key-provider | Generate Gramine signing key via OpenSSL workaround. |
| dstack/kms/src/main.rs | Apply configured root CA paths at startup. |
| dstack/kms/src/config.rs | Add root_ca + opt-in gate to KMS config. |
| dstack/kms/kms.toml | Document root CA overrides + opt-in gate. |
| dstack/kms/Cargo.toml | Move dstack-attest to non-dev dependency. |
| dstack/gateway/src/main.rs | Apply configured root CA paths at startup. |
| dstack/gateway/src/config.rs | Add root_ca + opt-in gate to gateway config. |
| dstack/gateway/gateway.toml | Document root CA overrides + opt-in gate. |
| dstack/gateway/Cargo.toml | Add dstack-attest dependency. |
| dstack/dstack-types/src/mock_attestation.rs | Add minimal mock-attestation HTTP client. |
| dstack/dstack-types/src/lib.rs | Add tee_simulator sys-config types and module export. |
| dstack/dstack-types/Cargo.toml | Add anyhow dependency. |
| dstack/dstack-attest/src/attestation.rs | Root CA path support + simulator platform detection + verifier wiring. |
| dstack/dstack-attest/Cargo.toml | Add PEM parsing dependency. |
| dstack/crates/mock-attestation/src/tpm.rs | Generate verifiable mock TPM evidence/collateral. |
| dstack/crates/mock-attestation/src/tdx.rs | Generate verifiable mock TDX/DCAP evidence/collateral. |
| dstack/crates/mock-attestation/src/sev_snp.rs | Generate verifiable mock SEV-SNP evidence/cert chain. |
| dstack/crates/mock-attestation/src/server.rs | Serve mock PCCS/KDS/AIA endpoints + attest endpoints. |
| dstack/crates/mock-attestation/src/nsm.rs | Generate verifiable mock NSM COSE documents. |
| dstack/crates/mock-attestation/src/main.rs | CLI for generate/serve workflows. |
| dstack/crates/mock-attestation/src/lib.rs | Seed parsing + deterministic key generation + assets manifest. |
| dstack/crates/mock-attestation/README.md | Usage docs for mock-attestation + dev image flow. |
| dstack/crates/mock-attestation/Cargo.toml | Add new crate + deps. |
| dstack/Cargo.toml | Add mock-attestation crate to workspace. |
| dstack/Cargo.lock | Lockfile updates for new deps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+565
to
+576
| let standard_x509_result = verify_x509_chain(&ark_bytes, &ask_bytes, &vcek_bytes); | ||
| let ark = parse_certificate(&ark_bytes, "ark")?; | ||
| let ask = parse_certificate(&ask_bytes, "ask")?; | ||
| let vcek = parse_certificate(&vcek_bytes, "vcek")?; | ||
|
|
||
| let chain = Chain { | ||
| ca: ca::Chain { ark, ask }, | ||
| vek: vcek.clone(), | ||
| }; | ||
| chain | ||
| if standard_x509_result.is_err() { | ||
| Chain { | ||
| ca: ca::Chain { ark, ask }, | ||
| vek: vcek.clone(), | ||
| } | ||
| .verify() | ||
| .map_err(|err| anyhow::anyhow!("amd cert chain verification failed: {err:?}"))?; | ||
| } |
Comment on lines
+17
to
+23
| let authority = base.trim_start_matches("http://").trim_end_matches('/'); | ||
| let mut stream = TcpStream::connect(authority)?; | ||
| let path = format!("/attest/{platform}"); | ||
| write!(stream, "POST {path} HTTP/1.1\r\nHost: {authority}\r\nContent-Length: {}\r\nConnection: close\r\n\r\n", report_data.len())?; | ||
| stream.write_all(report_data)?; | ||
| let mut response = Vec::new(); | ||
| stream.read_to_end(&mut response)?; |
| Type=notify | ||
| ExecCondition=/bin/sh -c '! grep -qE "^(tdx_guest|sev_guest)" /sys/kernel/config/tsm/report/*/provider 2>/dev/null' | ||
| ExecStart=/usr/bin/dstack-tee-simulator | ||
| ExecStartPost=/bin/sh -c 'systemctl set-environment $(cat /run/dstack/tee-simulator.env)' |
kvinwang
force-pushed
the
codex/external-attestation-root-ca
branch
from
July 21, 2026 10:46
59d5942 to
1408f8c
Compare
kvinwang
force-pushed
the
codex/external-attestation-root-ca
branch
2 times, most recently
from
July 21, 2026 14:26
d130c73 to
b5838c4
Compare
kvinwang
force-pushed
the
codex/external-attestation-root-ca
branch
from
July 21, 2026 17:27
b5838c4 to
f081f40
Compare
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
AttestationVerifiercontaining one QVL verifier per evidence trust domainattestation.insecure_allow_external_trust_anchors = truebefore loading any external CA fileConfiguration
Missing CA paths select the corresponding QVL production root. Missing URLs select the production PCCS/AMD KDS defaults. Loaded verifiers contain no paths, optional roots, insecure flag, or environment lookups.
Safety
sevcrate's AMD-specific chain validation; generic X.509 fallback is restricted to explicitly supplied rootsValidation
cargo check --workspace-D warnings) for affected libraries and production binaries