Skip to content

feat(kms): judge the SEV-SNP TCB against per-CPUID minimums from the auth API - #1627

Merged
kvinwang merged 3 commits into
nextfrom
feat/onchain-snp-tcb-requirements
Nov 19, 2026
Merged

kvinwang merged 3 commits into
nextfrom
feat/onchain-snp-tcb-requirements

Conversation

@kvinwang

@kvinwang kvinwang commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

AMD publishes no TCB status for SEV-SNP, so #1621 judges a report against the AMD bulletins listed in sev_snp_tcb_requirements. Two things are wrong with that list, which no release has shipped:

  • It lives in each KMS's kms.toml: governance cannot see or change it, and every KMS has to be configured with the same one.
  • It is keyed by product family, which is too coarse. AMD's bulletins give a minimum per CPU: for AMD-SB-3027, microcode 0xDE on Milan but 0x47 on Milan-X, and 0x56 on Genoa but 0x1B on Bergamo/Siena. A milan entry either rejects a patched Milan-X or checks nothing on Milan.

Fix

Governance publishes one minimum TCB per CPU, and the KMS reads the list from its auth API, as a JSON string it parses itself, like Intel's TCB info.

[{"cpuid":"00a00f11","bootloader":0,"tee":0,"snp":27,"microcode":222}]
  • An entry names the CPU by CPUID Fn0000_0001 EAX, as the bulletins print it, and holds the highest SVNs they require of it. SVNs only grow, so one minimum per CPU decides as a list of bulletins would. The entries no longer name a bulletin, so SEV-SNP reports no advisory IDs.
  • DstackKms: setSevSnpTcbRequirements(string), the sevSnpTcbRequirements() getter, a SevSnpTcbRequirementsSet event and a PolicyChanged entry that commits to the content.
  • auth-eth: GET /sevSnpTcbRequirements, plus the SetSevSnpTcbRequirements script, which refuses malformed JSON.
  • dstack-auth: the same route, from sevSnpTcbRequirements in its allowlist.
  • KMS: it judges every SEV-SNP TCB against the published list, reused for a second, and no longer against the list in kms.toml.

Behavior change

  • The KMS refuses an SEV-SNP request it cannot judge, and says why, instead of reporting a status: when the auth API does not serve the list (a 404 from a backend without the route included) or serves none, when the list does not parse, when it has no entry for the report's CPU, and for a report v2, which predates the CPUID fields. The dev backend publishes none and judges nothing.
  • dstack-verifier takes the same per-CPUID entries in [[attestation.sev_snp_tcb_requirements]]. As before, its status is empty for a report it has no entry for.

The contract takes one SEV-SNP string instead of a value per TEE platform: that is 326 bytes of DstackKms against 596, and both this PR and #1624 draw on the same headroom.

Contract next This PR Limit
DstackKms 21,802 22,128 24,576
DstackKmsV2 22,025 22,351 24,576

Not in this PR: dstack-verifier does not read the auth API, so its own list must still match the published one. Bulletins that signal a fix through a mitigation or platform-info bit (AMD-SB-3020, 3033, 3059) are not checked.

Verification

  • forge clean && forge test --ffi: 118 passed, including the upgrade-safety validation. forge build --sizes gives the sizes above.
  • bun run check in auth-eth: 60 passed.
  • cargo check --workspace --all-targets --all-features passes. cargo test -p sev-snp-qvl -p dstack-attest -p dstack-verifier -p dstack-kms -p dstack-auth -p mock-attestation -p dstack-tee-simulator --all-features passes.
  • configured_tcb_requirements_judge_the_real_report runs the real Milan fixture: UpToDate at its own TCB under 00a00f11, OutOfDate one microcode SVN higher, and an empty status under Milan-X's 00a00f12.
  • The key handover and app key handler tests assert the tcbStatus sent for authorization is the one judged against the published list; reverting either handler to the verifier's own status fails them. The certificate handler has no SEV-SNP handler test.
  • sev_snp_tcb_is_judged_against_governances_requirements covers a met minimum and an unmet one, and the refusals: another CPU's entry only, an empty list, a backend without the route, an unavailable backend and an unparsable list.
  • On a local anvil chain, with the earlier entry format: deployed with Deploy.s.sol, set the list with the script (malformed JSON refused), read it back through Query.s.sol and GET /sevSnpTcbRequirements.

@kvinwang
kvinwang force-pushed the feat/onchain-snp-tcb-requirements branch 2 times, most recently from 38802aa to aa914a4 Compare November 19, 2026 11:25
@kvinwang kvinwang changed the title feat(kms): read SEV-SNP TCB requirements from DstackKms feat(kms): read SEV-SNP TCB requirements from the auth API Nov 19, 2026
@kvinwang
kvinwang force-pushed the feat/onchain-snp-tcb-requirements branch 2 times, most recently from a23f6d7 to 01b3511 Compare November 19, 2026 15:02
@kvinwang kvinwang changed the title feat(kms): read SEV-SNP TCB requirements from the auth API feat(kms): judge the SEV-SNP TCB against per-CPUID minimums from the auth API Nov 19, 2026
@kvinwang
kvinwang force-pushed the feat/onchain-snp-tcb-requirements branch from 01b3511 to 152c09d Compare November 19, 2026 15:25
Signed-off-by: Kevin Wang <wy721@qq.com>
Signed-off-by: Kevin Wang <wy721@qq.com>
…auth API

Signed-off-by: Kevin Wang <wy721@qq.com>
@kvinwang
kvinwang force-pushed the feat/onchain-snp-tcb-requirements branch from 152c09d to 7b62da8 Compare November 19, 2026 15:52
@kvinwang
kvinwang merged commit 47c0355 into next Nov 19, 2026
30 checks passed
@kvinwang
kvinwang deleted the feat/onchain-snp-tcb-requirements branch November 19, 2026 16:06
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.

1 participant