Skip to content

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

Merged
kvinwang merged 1 commit into
nextfrom
feat/iappauth-v2
Nov 12, 2026
Merged

kvinwang merged 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.

  • Append teeVariant (the platform name the KMS reports, passed through unchanged) to the AuthorizationRequest of IAppEpochAuth. AppInfo is unchanged, so legacy IAppAuth policies still get it as is.
  • DstackApp and DstackKms: allowAnyTeeVariant() (default true, also for upgraded proxies) and allowedTeeVariants(), set by setAllowAnyTeeVariant(bool) / setAllowedTeeVariants(string[]), covering every epoch. Stored as one packed slot (restricted flag + bitmask over the names hardcoded in TeeVariantPolicy.sol); listing an unknown name reverts and a restricted policy refuses it, as it does the legacy isAppAllowed/isKmsAllowed.
  • auth-eth requires teeVariant on /authorizeKms and /authorizeApp.
  • Manage.s.sol: SetKmsTeeVariants / SetTeeVariants (TEE_VARIANTS=any or names); Query.s.sol prints the policies.

DstackKms is 24,041 bytes (EIP-170 limit 24,576). Breaking only for unreleased ABI: authorizeKms/authorizeApp, IAppEpochAuth, IAppEpochManagement (now 0x8c0524c4).

Tests: forge clean && forge test --ffi (114 passed), vitest run (58 passed), Halmos DstackAppEpochSymbolicTest (10/10, including a new platform-policy property).

@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
@kvinwang
kvinwang force-pushed the feat/iappauth-v2 branch 5 times, most recently from 3108ac0 to 0f55944 Compare November 12, 2026 12:10
…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.

- Append teeVariant, the platform name the KMS reports, to the
  AuthorizationRequest of IAppEpochAuth. auth-eth passes it through
  unchanged, so the KMS defines the names and each policy picks its own
  representation. AppInfo is unchanged, so DstackKms still forwards it as
  is to policies without IAppEpochAuth.
- DstackApp and DstackKms allow any platform until the owner calls
  setAllowAnyTeeVariant(false), then only the names set by
  setAllowedTeeVariants. TeeVariantPolicy keeps them as one packed slot: a
  restricted flag and a bitmask over the platform names it hardcodes, so a
  check costs one read; listing an unknown name reverts, and a restricted
  policy refuses one. The policy covers every epoch: which platforms may hold
  keys is a trust decision, not a property of a key generation. A restricted
  policy 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.
- Manage.s.sol SetKmsTeeVariants/SetTeeVariants take TEE_VARIANTS=any or a
  list of names and refuse an empty one; Query.s.sol prints the policies.

DstackKms stays under the EIP-170 limit at 24,041 bytes.

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

Signed-off-by: Kevin Wang <wy721@qq.com>
@kvinwang
kvinwang merged commit 0702b5c into next Nov 12, 2026
24 checks passed
@kvinwang
kvinwang deleted the feat/iappauth-v2 branch November 12, 2026 13:09
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