Files
floci/src/main/java/io/github
Kumar Prabhat fd78ae4f4b fix(secretsmanager): raise InvalidRequestException, not ResourceNotFoundException, for pending-deletion secrets (#2514)
DeleteSecret without ForceDeleteWithoutRecovery keeps the secret in
store with deletedDate set to a future date (recoverable via
RestoreSecret) - it's only removed from store outright on a force
delete, so resolveSecret() already raises ResourceNotFoundException on
its own for a genuinely gone secret. Any getDeletedDate() != null
check reached past resolveSecret() therefore always means "still
present, scheduled for deletion", which real AWS reports as
InvalidRequestException.

getSecretValue, putSecretValue, updateSecret,
claimTargetAttachment, rotateSecret, and updateSecretVersionStage
all threw ResourceNotFoundException here instead, making a
recoverable, still-restorable secret indistinguishable from one
that's genuinely gone. batchGetSecretValue in the same file already
had this right (InvalidRequestException with the correct message) -
extracted that into a shared throwIfPendingDeletion(secret) helper
and applied it consistently at the six other sites.

Strengthened the existing deleteSecretWithRecoveryWindow test (it
only asserted AwsException.class, which passes regardless of error
code) to check the specific error code, and added a test covering
all six affected operations.

Fixes #2513
2026-08-25 10:00:38 -04:00
..