Files
floci/src/main/java
Kumar Prabhat 1e443acd06 fix(secretsmanager): stop CreateSecret overwriting a secret inside its recovery window (#2555)
createSecret's "already exists" guard only fired when deletedDate was
null, so a name scheduled for deletion fell straight through and
overwrote the recoverable secret at the same storage key. That also
cleared deletedDate, so RestoreSecret then reported "was not deleted"
and the original value was unrecoverable with nothing surfacing the
loss. Real AWS refuses this with InvalidRequestException, which is
what makes the recovery window mean anything.

tagResource, untagResource, and a repeat non-force deleteSecret had
the same shape - no pending-deletion check at all, so all three
returned 200. The repeat delete silently moved DeletionDate forward,
quietly extending a window the caller believed was counting down.
All four reuse the throwIfPendingDeletion helper from #2514.

deleteSecret's guard sits after the force-delete branch on purpose:
force-deleting an already-scheduled secret is a legitimate "skip the
window" escape hatch and stays allowed. DescribeSecret and
ListSecretVersionIds are untouched - AWS doesn't declare
InvalidRequestException for them, and describing a scheduled secret
is how a caller reads its DeletedDate.

Fixes #2549
2026-08-26 10:35:55 -04:00
..