Skip to content

feat(auth-eth): accept TCB statuses and advisories per TEE platform - #1624

Closed
kvinwang wants to merge 1 commit into
nextfrom
feat/per-platform-tcb-policy-contracts
Closed

kvinwang wants to merge 1 commit into
nextfrom
feat/per-platform-tcb-policy-contracts

Conversation

@kvinwang

Copy link
Copy Markdown
Collaborator

Problem

DstackKms (for KMS instances) and DstackApp (with requireTcbUpToDate) compare tcbStatus with "UpToDate" for every platform. A TCB status only means something on the platform that reported it. TDX's comes from Intel's TCB info, SEV-SNP's from the KMS's AMD bulletin list (#1621), and the Nitro platforms report none. The contracts can't express a different rule per platform, even though AuthorizationRequest.teeVariant already says which platform reported the status. This was split out of #1621 because DstackKms had no room for it; #1623 freed that room.

Fix

A shared TcbPolicy library. DstackKms and DstackApp gain setTcbPolicy(teeVariant, allowedTcbStatuses, allowedAdvisoryIds), a tcbPolicy(teeVariant) getter and a TcbPolicySet event, plus a PolicyChanged audit entry.

  • A platform with a rule must report one of its statuses, and every advisory it reports must be on the rule's list.
  • A platform without a rule, and a legacy caller that reports no platform, keeps today's check: tcbStatus == "UpToDate", with advisories unchecked. Existing proxies therefore decide exactly as before.
  • Empty statuses clear a rule. Advisories without statuses, and unknown platforms, are rejected.

isAppAllowed, isKmsAllowed, authorizeApp, authorizeKms and AppInfo are unchanged. Storage is appended, and each gap shrinks by one slot.

Contract next This PR Limit
DstackKms 21,802 23,598 24,576
DstackKmsV2 22,025 23,821 24,576
DstackApp 14,117 16,942 24,576

Not in this PR: NitroTPM still reports a hard-coded UpToDate (verifier/src/verification.rs). It can report an empty status once a dstack-aws-nitro-tpm rule is deployed; until then, dropping it would break NitroTPM boots under the default rule.

Verification

  • forge build --sizes gives the sizes above.
  • forge clean && forge test --ffi: 119 passed, including the OpenZeppelin upgrade-safety validation. The two new tests cover the per-platform rule, the default, legacy callers, rule clearing, invalid input and access control.
  • Halmos (FOUNDRY_DYNAMIC_TEST_LINKING=false): DstackKmsSymbolicTest 11/11, DstackAppSymbolicTest 5/5.

@kvinwang

Copy link
Copy Markdown
Collaborator Author

Closing for now. #1627 made the SEV-SNP case moot: governance now publishes the minimum TCB per CPU, and SEV-SNP reports no advisory IDs for a rule to match. What is left is accepting non-UpToDate TDX statuses with their advisories, and Nitro Enclave's empty status. Reopen when one of those is needed; it would then need a rebase onto #1627 (the __gap line conflicts) and a description that leads with TDX and Nitro.

@kvinwang kvinwang closed this Nov 19, 2026
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