Repository navigation
Description
Secrets Manager answers ResourceNotFoundException with HTTP 404. AWS publishes it as HTTP
400 on every operation that carries it.
Same class as #921 (ACM ResourceNotFoundException) and #923 (KMS), both filed rather than folded into
their service's resolution row for the same reason: correcting which resource an identifier names
is a different change from correcting what status a refusal carries, and mixing them makes a
regression in either hard to attribute.
Verified error lists
From the Secrets Manager API Reference:
| Operation | Errors |
|---|---|
DescribeSecret |
InternalServiceError 500, InvalidParameterException 400, ResourceNotFoundException 400 |
TagResource |
the above plus InvalidRequestException 400 |
UntagResource |
the above plus InvalidRequestException 400 |
ResourceNotFoundException is reachable from all ten SecretId-taking operations —
DescribeSecret, GetSecretValue, PutSecretValue, UpdateSecret, DeleteSecret, TagResource,
UntagResource, RotateSecret, ListSecretVersionIds and (until #929) ListTagsForResource — and
substrate answers 404 at every one, through the single smSecretNotFound helper in
emulator/secretsmanager_tags.go. One helper means one fix.
DescribeSecret also emits members AWS omits
AWS states: "Secrets Manager only returns fields that have a value in the response." #928's pass
corrected Tags, which was emitted as null on an untagged secret, because that is the member the
tagging row is read through. The others were left, and are the rest of this issue: Description,
KmsKeyId and RotationEnabled are emitted unconditionally, so a caller sees "Description": ""
where AWS sends no member at all.
RotationEnabled needs its own decision rather than the same treatment — AWS's own type page marks it
Required: No, and a false value is not obviously "no value", so whether it is omitted or always
sent should be recorded as substrate's reading either way.
Acceptance criteria
-
smSecretNotFoundanswers 400, so all ten operations change together. -
DescribeSecretomitsDescription,KmsKeyIdand any other member with no value, per AWS's
published sentence; theRotationEnableddecision is recorded indocs/services.mdprose. - A test asserts the status on raw bytes for at least the two tag operations and
DescribeSecret, and asserts member absence on the raw body rather than through a decoded
struct — the distinction a struct cannot make.
Compatibility
A consumer asserting 404 for an absent secret will need to assert 400. That is the point: the
assertion was passing against substrate and would have failed against AWS.
Activity
fix(secretsmanager): a SecretId resolves to the secret its own ARN na…
fix(ssm): a tag call resolves to the resource type it names (#932) (#934
scttfrdmn commentedon Sep 16, 2026
Two premise corrections before the diff, from re-fetching
API_DescribeSecretverbatim rather than working from the earlier paraphrase. AC 1 holds exactly; AC 2's member list is wrong in both directions.AC 1 holds
ResourceNotFoundExceptionis 400 on every one of the tenSecretId-taking operations, andAPI_DescribeSecretpublishes exactly three codes:InternalServiceErrorInvalidParameterExceptionResourceNotFoundExceptionConfirming the issue's own note:
InvalidRequestExceptionandDecryptionFailureare not onDescribeSecret's list. OnesmSecretNotFoundhelper, one fix.AC 2 is wrong about
Description, and the omit-vs-null split is finer than "omits members with no value"The blanket sentence is real and quoted correctly — "Retrieves the details of a secret. It does not include the encrypted secret value. Secrets Manager only returns fields that have a value in the response." — but the per-member text does not distribute uniformly across the three members the issue names. AWS says two different things, in different words, about different members:
"this field is omitted" —
DeletedDate("If it is not scheduled for deletion, this field is omitted"),KmsKeyId("If the secret is encrypted with the AWS managed keyaws/secretsmanager, this field is omitted"),LastAccessedDate("This field is omitted if the secret has never been retrieved in the Region"),RotationRules("If the secret never had rotation turned on, this field is omitted")."Secrets Manager returns null" —
LastRotatedDate("If the secret isn't configured for rotation or rotation has been disabled"),NextRotationDate(same condition),RotationEnabled("If the secret has never been configured for rotation").No statement at all —
ARN,CreatedDate,Description,LastChangedDate,Name,OwningService,PrimaryRegion,ReplicationStatus,RotationLambdaARN,Tags,VersionIdsToStages.So:
Descriptionshould not be in AC 2's list. Its per-member text is "The description of the secret. Type: String. Length Constraints: Maximum length of 2048." — nothing about omission. It falls only under the blanket sentence, which is the weakest possible basis, and treating it as equivalent toKmsKeyId's explicit "this field is omitted" would blend AWS's statement with substrate's reading. Omitting an emptyDescriptionis defensible under the blanket sentence and is what this PR will do, but it must be labelled substrate's reading, not AWS's, andKmsKeyIdmust be labelled AWS's.RotationEnabledis already answered, and the issue's worry is the wrong way round. The page states it explicitly: "If the secret has never been configured for rotation, Secrets Manager returns null." So AWS's own answer isnull, not omitted, and notfalse— the opposite of the treatmentDescriptionandKmsKeyIdget, on the same page. The issue asks for a decision to be "recorded as substrate's reading either way"; no reading is needed, because AWS published one. TheRequired: Noon the type page is about the shape, not about whatDescribeSecretsends.DeletedDate,LastAccessedDateandRotationRulesall carry an explicit "this field is omitted", andLastRotatedDate/NextRotationDatean explicit "returns null". Whether substrate emits any of them unconditionally has to be checked, since they are the same defect with a stronger citation thanDescription's.A finding beyond the issue: three published response members substrate does not model
API_DescribeSecret's Response Syntax has twenty-one members, and three are absent from substrate:Type— "The exact string that identifies the partner that holds the external secret." Length 0–256.ExternalSecretRotationRoleArn— "The Amazon Resource Name (ARN) of the role that allows Secrets Manager to rotate a secret held by a third-party partner." Length 20–2048.ExternalSecretRotationMetadata— "The metadata needed to successfully rotate a managed external secret. A list of key value pairs in JSON format specified by the partner." Array ofExternalSecretRotationMetadataItem.All three belong to managed external secrets, which substrate models nothing of. They are not added here: under the sentence this issue is built on, a secret with no value for them correctly sends no member, so substrate's output is already right for every secret it can create. That is worth stating rather than leaving as a silent gap — it is filed separately, because adding them means modelling external-secret rotation, and this issue is about statuses and omissions.
What the PR will do
smSecretNotFound→ 400, all ten operations at once.DescribeSecretomits a member with no value, with each member's provenance recorded separately: AWS's forKmsKeyId,DeletedDate,LastAccessedDateandRotationRules, which carry an explicit "this field is omitted"; substrate's reading forDescriptionand anything else resting only on the blanket sentence.RotationEnabled,LastRotatedDateandNextRotationDatefollow AWS's publishednull, which is a different treatment from omission and is why they are called out separately.It ships together with #929, since both change one plugin and #929 removes an operation whose only in-tree read path is the
Tagsmember this issue touches.fix(secretsmanager): remove an operation AWS does not publish, and re…
feat(secretsmanager): RotateSecret's parameters, VersionId and refusa…
fix(secretsmanager): four operations accepted a secret scheduled for …