Repository navigation
Description
The defect
Four Secrets Manager operations accept a secret whose deletion is already scheduled, although each of their AWS pages publishes InvalidRequestException with "The secret is scheduled for deletion." as the first of its three "Possible causes":
PutSecretValue— writes a new version onto a scheduled secret and movesCurrentVersionIDto itUpdateSecret— rewritesDescription,KmsKeyIdand the valueTagResource— merges tags onto the recordUntagResource— strips tags off it
#953 established the guard and the helper. smSecretScheduledForDeletion (emulator/secretsmanager_deletion.go) already builds the exact refusal, and GetSecretValue and DeleteSecret already call it; these four do not. So a consumer's "is this secret usable?" logic gets a 200 from substrate and a 400 from AWS at four operations.
GetSecretValue was fixed in #953 rather than here because AWS states its case in prose as well as in the error list — "When a secret is scheduled for deletion, you cannot retrieve the secret value." — and because it is the one whose refusal makes the scheduled state observable at all. These four rest on the published cause list alone, which is why they were split out rather than bundled.
Why it matters
The whole point of #953's distinction is that a scheduled secret is a different thing from a live one and from an absent one. A caller that can still write a version to it, retag it, or change its description is being told the secret is fully operational while its recovery window counts down. RestoreSecret then returns a secret carrying writes AWS would have refused.
Acceptance criteria
-
PutSecretValue,UpdateSecret,TagResourceandUntagResourceeach answerInvalidRequestException/400throughsmSecretScheduledForDeletionwhen the target'sDeletionDateis set, and write nothing. - The refusal is asserted to be distinguishable from
ResourceNotFoundExceptionat each of the four, per secretsmanager: DeleteSecret always deletes immediately, so the recovery window, DeletionDate and RestoreSecret do not exist #953's precedent — a scheduled secret and an absent one must not read alike. - Each is asserted to write nothing: after the refusal,
DescribeSecretreports the sameTags,DescriptionandDeletedDate, andRestoreSecretfollowed byGetSecretValuereports the value the secret had before the delete. - A table over all six operations that refuse a scheduled secret (the four here plus
GetSecretValueand the unforcedDeleteSecret) proves no handler builds its own refusal instead of calling the shared helper — the arrangement fix(secretsmanager): ResourceNotFoundException is 400, not 404, and DescribeSecret emits members AWS omits #930 used forsmSecretNotFound's nine callers. -
docs/services.md's A deleted secret is scheduled, not removed section drops the "still unmodelled" paragraph that names this issue, and its table gains the four rows. -
CHANGELOG.mdstates the compatibility break: four operations that answered200against a scheduled secret now refuse.
Provenance
Every code and cause here is AWS's, taken from the four operations' own API reference pages — nothing in this issue is substrate's reading. Whether the message names which of the three causes applies follows #953's choice to name it, which is substrate's, since one code covers three unrelated conditions.
Out of scope
The other two published causes — a rotation attempted on a secret with no Lambda function configured, and a secret managed by another service — belong to #952 and to whatever eventually models OwningService.
Activity