Skip to content

feat(kms): audit key releases on both listeners - #1540

Merged
kvinwang merged 2 commits into
feat/kms-epochs-combinedfrom
feat/kms-key-release-audit
Nov 9, 2026
Merged

kvinwang merged 2 commits into
feat/kms-epochs-combinedfrom
feat/kms-key-release-audit

Conversation

@kvinwang

@kvinwang kvinwang commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up to #1533 review (blocking #3).

  • Logs one dstack_kms::audit line per handover_keys call (RPC and admin listeners) and per get_app_key call. The log is written regardless of the metrics setting. Fields: app_id, instance_id (UNKNOWN when empty), remote endpoint, operation, requested epoch, returned epoch, and whether the self-authorization result was cached.
  • Adds dstack_kms_key_releases_total{listener,operation} to /metrics.

Tests: cargo test -p dstack-kms --all-features (82 passed), rebased onto #1539. The handover tests assert that a successful handover counts one release on its listener and a refused one counts none.

Log one line per key handover (RPC and admin listeners) and per app key
release, regardless of the metrics setting: app_id, instance_id
(UNKNOWN when empty), remote endpoint, operation, requested and
returned epochs, and whether the self-authorization result was cached.
Count releases in dstack_kms_key_releases_total labelled by listener
and operation.

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

Rebased onto #1539, whose handover tests construct RpcHandler and call
handover_keys directly. Pass the remote endpoint and the release kind
there, and assert that a successful handover counts one release on its
listener while a refused one counts none.

Signed-off-by: Kevin Wang <wy721@qq.com>
@kvinwang
kvinwang force-pushed the feat/kms-key-release-audit branch from d71808a to 76a0149 Compare November 9, 2026 12:59
@kvinwang
kvinwang merged commit 5fcc62f into feat/kms-epochs-combined Nov 9, 2026
2 checks passed
@kvinwang
kvinwang deleted the feat/kms-key-release-audit branch November 9, 2026 13:01
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