Skip to content

secretsmanager: PutSecretValue, UpdateSecret, TagResource and UntagResource accept a secret scheduled for deletion #956

Closed

Description

@scttfrdmn

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 moves CurrentVersionID to it
  • UpdateSecret — rewrites Description, KmsKeyId and the value
  • TagResource — merges tags onto the record
  • UntagResource — 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, TagResource and UntagResource each answer InvalidRequestException/400 through smSecretScheduledForDeletion when the target's DeletionDate is set, and write nothing.
  • The refusal is asserted to be distinguishable from ResourceNotFoundException at 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, DescribeSecret reports the same Tags, Description and DeletedDate, and RestoreSecret followed by GetSecretValue reports the value the secret had before the delete.
  • A table over all six operations that refuse a scheduled secret (the four here plus GetSecretValue and the unforced DeleteSecret) 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 for smSecretNotFound'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.md states the compatibility break: four operations that answered 200 against 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

  1. added this to the v0.118.0 milestone on Sep 17, 2026
  2. added
    type: bug
    on Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions