Skip to content

feat(kms-auth)!: pass the TEE platform to policies and allow restricting it - #1567

Open
kvinwang wants to merge 1 commit into
nextfrom
feat/iappauth-v2
Open

kvinwang wants to merge 1 commit into
nextfrom
feat/iappauth-v2

Conversation

@kvinwang

@kvinwang kvinwang commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

One OS image hash can boot on several TEE platforms, and app keys derive from the app ID alone, so a policy that cannot see the platform cannot keep an app on, say, bare-metal TDX. The KMS already sends teeVariant; auth-eth dropped it before the contract call.

  • Rename the unreleased IAppEpochAuth to IAppAuthV2; AuthorizationRequest carries BootInfoV2 (legacy AppInfo + uint8 teeVariant, numbered as dstack's TeeVariant enum, see TeeVariant.sol). Legacy IAppAuth policies still get AppInfo.
  • DstackApp and DstackKms: allowedTeeVariants() / setAllowedTeeVariants(mask), one bitmask covering every epoch (bit n allows platform n). Stored as its complement, so new and upgraded proxies read TeeVariant.ANY and 0 literally allows nothing. A restricted mask refuses the legacy isAppAllowed/isKmsAllowed, whose callers report no platform.
  • auth-eth requires teeVariant on /authorizeKms and /authorizeApp and rejects unknown platforms.
  • Manage.s.sol: SetKmsAllowedTeeVariants / SetAllowedTeeVariants (TEE_VARIANTS=any or names); Query.s.sol prints the masks.

Breaking only for unreleased ABI: authorizeKms/authorizeApp, IAppAuthV2, IAppEpochManagement (now 0xb5cb3ab1).

Tests: forge clean && forge test --ffi (113 passed), vitest run (58 passed).

…ing it

One OS image hash can boot on several TEE platforms (a release ships both
TDX and SEV-SNP firmware), and app keys derive from the app ID alone, so an
app approved on bare-metal TDX could be served on any platform the KMS
enables. The KMS already sends teeVariant; auth-eth dropped it.

- Rename the unreleased IAppEpochAuth to IAppAuthV2. AuthorizationRequest
  carries BootInfoV2: the legacy AppInfo plus a uint8 teeVariant, numbered
  as dstack's TeeVariant enum (TeeVariant.sol). DstackKms still forwards
  AppInfo to policies without IAppAuthV2.
- DstackApp and DstackKms get allowedTeeVariants(): bit n allows platform
  n, at every epoch, since which platforms may hold keys is a trust
  decision rather than a property of a key generation. It is stored as its
  complement, so new and upgraded proxies read TeeVariant.ANY (all bits)
  and 0 means what it says. A restricted mask refuses the legacy
  isAppAllowed/isKmsAllowed, whose callers report no platform; the 0.6.x
  KMS also serves SEV-SNP and Nitro, so they cannot be taken as TDX.
- auth-eth requires teeVariant on /authorizeKms and /authorizeApp, rejects
  unknown platforms and passes the number on.
- Manage.s.sol SetKmsAllowedTeeVariants/SetAllowedTeeVariants take
  TEE_VARIANTS=any or a list of names; Query.s.sol prints the masks.

BREAKING CHANGE: unreleased ABI only: authorizeKms/authorizeApp, and the
IAppAuthV2 and IAppEpochManagement (now 0xb5cb3ab1) interface IDs.

Signed-off-by: Kevin Wang <wy721@qq.com>
@kvinwang kvinwang changed the title feat(kms-auth)!: pass the TEE variant to policies and allow restricting it feat(kms-auth)!: pass the TEE platform to policies and allow restricting it Nov 12, 2026

This branch has not been deployed

No deployments
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