Skip to content

Commit 0c13e59

Browse files
committed
docs(awssm): grant BatchGetSecretValue on "*", not a secret ARN
The documented IAM policy put secretsmanager:BatchGetSecretValue in a statement scoped to arn:aws:secretsmanager:*:*:secret:secretspec/*. AWS treats it as an account-level action that takes no resource, so a resource-scoped statement never grants it. get_many() batches through BatchGetSecretValue (awssm.rs:330, reached from secrets.rs:2346), and that is the path check and run resolve through — so anyone copying the policy hit AccessDeniedException on the two most common commands. Split into two statements: the batch action on "*", everything else still scoped to the secretspec prefix. ListSecrets is deliberately not added; the provider addresses secrets with secret_id_list rather than filters, and only the filter form requires it. The note now says why "*" is required and, since granting anything on "*" invites a second look, why it does not widen access: AWS still requires GetSecretValue for every secret a batch returns, and that stays ARN-scoped. Closes #342
1 parent 4b8ae3e commit 0c13e59

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

docs/src/content/docs/providers/awssm.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,28 +53,44 @@ AWS Secrets Manager uses the standard AWS SDK credential chain:
5353
"Version": "2012-10-17",
5454
"Statement": [
5555
{
56+
"Sid": "SecretspecSecrets",
5657
"Effect": "Allow",
5758
"Action": [
5859
"secretsmanager:GetSecretValue",
59-
"secretsmanager:BatchGetSecretValue",
6060
"secretsmanager:CreateSecret",
6161
"secretsmanager:PutSecretValue"
6262
],
6363
"Resource": "arn:aws:secretsmanager:*:*:secret:secretspec/*"
64+
},
65+
{
66+
"Sid": "SecretspecBatchFetch",
67+
"Effect": "Allow",
68+
"Action": "secretsmanager:BatchGetSecretValue",
69+
"Resource": "*"
6470
}
6571
]
6672
}
6773
```
6874

69-
If you use a prefix such as `?prefix=myteam`, adjust the resource ARN:
75+
If you use a prefix such as `?prefix=myteam`, adjust the resource ARN in the
76+
first statement:
7077

7178
```
7279
arn:aws:secretsmanager:*:*:secret:myteam/secretspec/*
7380
```
7481

7582
:::note
76-
The `BatchGetSecretValue` permission is required for batch fetching, which is
77-
used automatically during `check` and `run` commands to reduce API calls.
83+
`BatchGetSecretValue` is used automatically during `check` and `run` to fetch
84+
secrets in batches of 20 instead of one call each.
85+
86+
It must be granted on `"*"`. AWS treats it as an account-level action that takes
87+
no resource, so a statement scoping it to a secret ARN never grants it and those
88+
two commands fail with `AccessDeniedException`.
89+
90+
Granting it on `"*"` does not widen which secrets can be read. AWS requires
91+
`secretsmanager:GetSecretValue` for every secret returned by a batch, and that
92+
permission stays scoped to the ARN above — so the first statement is still what
93+
decides access.
7894
:::
7995

8096
:::note

0 commit comments

Comments
 (0)