Repository navigation
Description
Summary
DeleteSecret destroys a secret immediately, reads neither of the two parameters that decide whether it should, and omits the response member that tells a caller what happened. AWS's default is a 30-day recovery window during which the secret still exists and is restorable; substrate's only behaviour is the one AWS reserves for ForceDeleteWithoutRecovery: true. So substrate implements the dangerous variant as the default, and docs/services.md's operations table claims "Supports ForceDeleteWithoutRecovery" for a parameter nothing decodes.
Substrate's handler (emulator/secretsmanager_plugin.go:454-500) decodes only SecretId, deletes the record, the version payload and the index entry, and answers {"ARN", "Name"}.
What AWS publishes
API_DeleteSecret, opening paragraph, verbatim:
"Deletes a secret and all of its versions. You can specify a recovery window during which you can restore the secret. The minimum recovery window is 7 days. The default recovery window is 30 days. Secrets Manager attaches a
DeletionDatestamp to the secret that specifies the end of the recovery window. At the end of the recovery window, Secrets Manager deletes the secret permanently."
"At any time before recovery window ends, you can use
RestoreSecretto remove theDeletionDateand cancel the deletion of the secret."
"When a secret is scheduled for deletion, you cannot retrieve the secret value. You must first cancel the deletion with
RestoreSecretand then you can retrieve the secret."
Request parameters, both Required: No:
RecoveryWindowInDays— "The number of days from 7 to 30 that Secrets Manager waits before permanently deleting the secret. You can't use both this parameter andForceDeleteWithoutRecoveryin the same call. If you don't use either, then by default Secrets Manager uses a 30 day recovery window." Type: Long.ForceDeleteWithoutRecovery— "Specifies whether to delete the secret without any recovery window. You can't use both this parameter andRecoveryWindowInDaysin the same call…" and, separately: "If you forcibly delete an already deleted or nonexistent secret, the operation does not returnResourceNotFoundException."
Response Syntax — three members, one of which substrate omits:
{
"ARN": "string",
"DeletionDate": number,
"Name": "string"
}
DeletionDate— "The date and time after which this secret Secrets Manager can permanently delete this secret, and it can no longer be restored. This value is the date and time of the delete request plus the number of days inRecoveryWindowInDays." Type: Timestamp.
AWS's own sample returns "DeletionDate":1.524085349095E9.
Why this is in scope
A recovery window is a state transition observable through an API call, driven by a clock — the same shape as a snapshot reported pending until it reaches completed, which CLAUDE.md names as in scope explicitly. Substrate has a TimeController, and the plugin already holds one, so DeletionDate is tc.Now() plus the window and the transition is assertable without wall-clock dependence. Nothing here requires modelling the background deletion task — AWS itself declines to guarantee its timing ("There is no guarantee of a specific time after the recovery window for the permanent delete to occur"), so the observable contract is the DeletionDate stamp and the refusals it causes, not the moment the bytes go away.
What is missing, and what depends on it
Six behaviours, each observable:
DeletionDateon the response, andDeletedDateonDescribeSecret— a member fix(secretsmanager): ResourceNotFoundException is 400, not 404, and DescribeSecret emits members AWS omits #930 documented as absent-because-unmodelled and which AWS states "If it is not scheduled for deletion, this field is omitted". That per-member sentence has nothing to be true about until deletion can be scheduled.GetSecretValueon a scheduled secret must be refused, per "you cannot retrieve the secret value" —InvalidRequestException/400, whose first published cause is "The secret is scheduled for deletion." TodayGetSecretValueanswersResourceNotFoundException/400 because the record is gone, so the two conditions are indistinguishable to a caller.RestoreSecretis not implemented at all. It is one of the twenty-three operations AWS publishes and the only way to cancel a deletion; today the name falls toUnknownOperationException. A consumer's "oops, restore it" path cannot be tested.RecoveryWindowInDaysoutside 7–30 must be refused (InvalidParameterException/400), and supplying it together withForceDeleteWithoutRecoverymust be refused — AWS states the mutual exclusion twice, once under each parameter.ForceDeleteWithoutRecoveryon an absent secret must answer200, notResourceNotFoundException— the one place AWS explicitly suspends the code fix(secretsmanager): ResourceNotFoundException is 400, not 404, and DescribeSecret emits members AWS omits #930 has just corrected the status of. Substrate answersResourceNotFoundExceptionthere today.ListSecretsmust still report a scheduled secret, since it exists until the window ends. Today it does not, because the index entry is removed.
Also: the docs table is wrong
docs/services.md's Secrets Manager operations table reads | DeleteSecret | Supports ForceDeleteWithoutRecovery |. Nothing decodes that parameter — the handler's input struct has one field, SecretId. The row should be corrected whether or not the rest of this issue is taken, because it tells a reader substrate honours a parameter it discards, in the direction that loses data.
Acceptance criteria
-
DeleteSecretreadsRecoveryWindowInDaysandForceDeleteWithoutRecovery, defaults to a 30-day window, refuses a window outside 7–30 and refuses both parameters in one call. - Without force, the secret is marked rather than removed:
DeletionDateis stamped off theTimeControllerand returned,DescribeSecretreportsDeletedDate, andListSecretsstill reports the secret. -
GetSecretValueon a scheduled secret answersInvalidRequestException/400 naming the scheduled-for-deletion cause — distinguishable fromResourceNotFoundException. -
RestoreSecretis implemented: it clearsDeletionDateandGetSecretValuesucceeds again afterwards. - With
ForceDeleteWithoutRecovery: true, the record is removed as today, and a forced delete of an absent secret answers200rather thanResourceNotFoundException, per AWS's explicit sentence. - The permanent deletion at the end of the window is either driven by the simulated clock or recorded as deliberately unmodelled with AWS's "no guarantee of a specific time" sentence as the reason — one or the other, stated.
- Tests over the wire for each transition, asserting
DeletedDate's presence and absence on raw bytes, per fix(secretsmanager): ResourceNotFoundException is 400, not 404, and DescribeSecret emits members AWS omits #930's precedent. -
docs/services.md'sDeleteSecretrow is corrected, and the section records which of these are AWS's statements and which are substrate's readings;CHANGELOG.mdstates the compatibility break — aDeleteSecretthat removed the record now schedules it, and a caller must passForceDeleteWithoutRecoveryto get the old behaviour.
Provenance
Every quotation is verbatim from API_DeleteSecret, fetched for this issue. The InvalidRequestException cause list is published identically on API_DeleteSecret and API_RotateSecret.
Activity
feat(secretsmanager): DeleteSecret opens a recovery window, and Resto…
feat(secretsmanager): RotateSecret's parameters, VersionId and refusa…
fix(secretsmanager): four operations accepted a secret scheduled for …