Skip to content

fix: #1533 review round 2 (dstack-auth handover, KMS tests, docs) - #1560

Merged
kvinwang merged 12 commits into
feat/kms-epochs-combinedfrom
fix/pr1533-round2
Nov 11, 2026
Merged

kvinwang merged 12 commits into
feat/kms-epochs-combinedfrom
fix/pr1533-round2

Conversation

@kvinwang

Copy link
Copy Markdown
Collaborator

Follow-up to the second-round review of #1533. This PR covers the non-contract fixes; contract changes, the CI changes and the sealed-env integration cases are handled in other PRs.

dstack-auth pending root epoch

  • Problem: dstack-auth capped every operation at currentRootEpoch. KMS handover always authorizes at the highest epoch the keyring holds, so a pending epoch could not be handed to other nodes before activation (kms_import_keys at the pending epoch 1: requested root epoch is not active). The contract backend already allows this.
  • Fix: kms_export_keys/kms_import_keys may request up to the latest registered epoch. Key-issuing operations (kms_serve, app_get_key, app_get_cert) stay capped at current. Epochs beyond latest are always rejected. Adds test T1 from the review.

KMS

  • authorized_epoch reports a backend rejection before it checks the chain hash, so the rejection reason is no longer hidden.
  • GetAppKey and key handover run ensure_attested before the KMS self check, so anonymous requests no longer reach the auth backend.
  • SignCert and GetTempCaCert now write audit lines in the existing dstack_kms::audit style, and their releases are counted in metrics.
  • Handler-level tests:
    • GetAppKey after rotation: requested epochs are used and not mixed up with the current ones; a backend rejection fails the RPC; requested app epoch is not active; anonymous callers are refused without any backend call.
    • SignCert with a mock Nitro attestation: issued under the current root and app epoch; fails when the backend rejects.
    • Env public key RPCs at app epoch 1.

Guest

  • Removes the three sealed-env tamper cases that failed during RA-TLS generation, before reaching the logic under test, and renames the test to what it checks.
  • The "exceeds current epoch" error now prints both epochs. Before, it printed the root epoch even when the app epoch was the one over the limit.

SDKs

  • Tests for the "GetKey returned different epochs than requested" check in Rust, Go, Python and JS.

Docs

  • ETH_BLOCK_TAG=latest/safe: a reorg can roll back both activations and revocations. Documents the ETH_FINALITY_CONFIRMATIONS tradeoff and limits the "survives reorgs" claim to finalized. Updates the auth-eth README and docs/deployment.md.
  • The source admin token is required for onboarding now that public handover is off by default (feat(kms)!: turn off the public KMS key handover by default #1552). The deployment.md curl line matches docs(kms): require admin TLS for onboarding handover #1558.
  • Stale statements: the emergency rotation protocol status and the removed setKmsInfo; on-chain compose and Helios in the rc testing runbook; dstack-auth pending-epoch handover in app-key-epochs.md and dstack-auth-operations.md.
  • Removes a debug console.log from auth-eth GET /.

Tests (local)

  • dstack-auth: 15
  • dstack-kms: 90
  • dstack-util: 133
  • auth-eth: 58, plus oxlint
  • SDK Rust: 60
  • SDK Go: 64 top-level tests
  • SDK Python: 182, plus checks
  • SDK JS: 172, plus tsc

…rt issuance

Report a backend rejection before the epoch fields are checked, require attestation in GetAppKey and the key handover before the KMS self check reaches the auth backend, and add audit lines for SignCert and GetTempCaCert.

Signed-off-by: Kevin Wang <wy721@qq.com>
…checked logic

The root_epoch and app_epoch tamper cases failed while generating the RA-TLS certificate for the historical key request, so they passed even without the epoch checks. Rename the test to what it checks, and report both epochs when a sealed env is ahead of the current ones; the error printed the root epoch even when the app epoch was the one exceeding.

Signed-off-by: Kevin Wang <wy721@qq.com>
Signed-off-by: Kevin Wang <wy721@qq.com>
Signed-off-by: Kevin Wang <wy721@qq.com>
Signed-off-by: Kevin Wang <wy721@qq.com>
Signed-off-by: Kevin Wang <wy721@qq.com>
Add the deployment order, the GET /app/:appId backend requirement, the
per-epoch setter semantics from #1561, the removed DstackKms setters and
legacy KMS info setters, two-step ownership for v0.5.9 proxies, dstack-auth
pending-epoch handover, and the reorg caveat of non-finalized block tags.

Signed-off-by: Kevin Wang <wy721@qq.com>
…support

Follow #1561: DstackApp loses its epoch-less setters and
IAppAuthBasicManagement, reports IAppEpochManagement, and app policies
predating app epochs keep working at app epoch 0.

Signed-off-by: Kevin Wang <wy721@qq.com>
@kvinwang
kvinwang merged commit ecc9ec3 into feat/kms-epochs-combined Nov 11, 2026
17 checks passed
@kvinwang
kvinwang deleted the fix/pr1533-round2 branch November 11, 2026 13:02
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