Skip to content

fix(sse): send immediate key deletion as a confirmed two-step request - #293

Merged
cxymds merged 1 commit into
mainfrom
reatang/kms-two-step-key-destruction
Nov 12, 2026
Merged

cxymds merged 1 commit into
mainfrom
reatang/kms-two-step-key-destruction

Conversation

@reatang

@reatang reatang commented Nov 11, 2026

Copy link
Copy Markdown
Member

Pull Request

Description

"Delete Immediately" on the SSE page never worked against a current server, and it was offered on keys it cannot apply to.

  • The server accepts an immediate KMS key deletion only as a JSON body that carries confirm_key_id; the query-string form is refused with 400. The console sent force_immediate=true in the query string, so every attempt failed.
  • Immediate deletion is the second step of a two-step process: it applies to a key that is already PendingDeletion. The console offered it on every key, including ones that had never been scheduled.

This PR:

  • sends immediate deletion as a JSON body (key_id, force_immediate, confirm_key_id); scheduling keeps its existing query form;
  • shows "Delete Immediately" only on keys in PendingDeletion, in both the table menu and the mobile cards;
  • adds a field to the confirmation dialog where the operator types the key ID; the action stays disabled until it matches exactly, and the typed value is what is sent as confirm_key_id;
  • rewrites the "Two-stage key deletion" notice and the dialog warning in all 15 locales to describe the two steps and that the server must allow immediate deletion.

The console does not know whether the server allows immediate deletion (RUSTFS_KMS_ALLOW_IMMEDIATE_DELETION). When it does not, the server's refusal message is shown as is.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test improvements
  • Security fix

Testing

  • Unit tests added/updated
  • Manual testing completed
pnpm type-check
pnpm lint
pnpm format:check
pnpm test:run   # 951 passed

New suite tests/lib/sse-key-deletion.test.ts covers the pending-deletion check, the exact-match confirmation, the request body, and that the page offers the action only for pending keys.

Manual run against a local RustFS with the Local KMS backend:

  • Active key: the menu offers only "View Details" and "Schedule Deletion".
  • After scheduling: the menu offers "Cancel Deletion" and "Delete Immediately"; the mobile cards match.
  • Confirmation dialog: the action is disabled with an empty or partial key ID and enabled on an exact match.
  • Server allowing immediate deletion: DELETE /kms/keys/delete with a JSON body returns 200 and the key leaves the list.
  • Server not allowing it: the request returns 400, the server's message is shown, and the key stays PendingDeletion.

Checklist

  • Code follows the project's style guidelines
  • Self-review completed
  • TypeScript types are properly defined
  • All commit messages are in English (Conventional Commits)
  • All existing tests pass
  • No new dependencies added, or they are justified

Related Issues

None.

Screenshots (if applicable)

To be attached: key list menu for an active key and a pending key, and the confirmation dialog (empty and filled).

Additional Notes

  • The key list response has no deletion date, so the list still does not show when a pending key will be destroyed; the date remains in the key details.
  • A refused request also triggers the existing "outcome uncertain, state refreshed" notice alongside the server's message. That path is unchanged here.

The server only accepts an immediate KMS key deletion as a JSON body that
repeats the key ID, and only for a key that is already pending deletion.
The console sent `force_immediate=true` in the query string with no
confirmation, so "Delete Immediately" was always refused, and it offered
the action on keys that had never been scheduled.

Send the request as a JSON body with `confirm_key_id`, offer "Delete
Immediately" only on keys in PendingDeletion, and require the operator to
type the key ID before the action is enabled. Update the explanatory copy
in every locale to describe the two steps and the server-side switch.
@cxymds
cxymds merged commit 173bb38 into main Nov 12, 2026
10 checks passed
@cxymds
cxymds deleted the reatang/kms-two-step-key-destruction branch November 12, 2026 09:16
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.

2 participants