Files
floci/docs
Priamo Germosen 96819a87fd fix(iam): check a Secrets Manager request for the actions its required permissions give (#9758)
The Service Reference lists the actions each Secrets Manager operation is authorized by without saying when each is
needed, so a request was checked as its own action alone: a BatchGetSecretValue using Filters without
secretsmanager:ListSecrets, a CreateSecret adding replica Regions without secretsmanager:ReplicateSecretToRegions and
a ValidateResourcePolicy without secretsmanager:PutResourcePolicy were all let through.

Each operation's page in the API reference says it, in its required permissions: "If you use filters, you must also
have secretsmanager:ListSecrets", "To add replica Regions, you must also have secretsmanager:ReplicateSecretToRegions",
"Required permissions: secretsmanager:ValidateResourcePolicy and secretsmanager:PutResourcePolicy".
tools/aws/fetch_secretsmanager_required_permissions.py copies that paragraph for each operation the Service Reference
lists as authorized by another of its actions, with each clause's action and what it is needed for or on, into
tools/aws/sources/secretsmanager-required-permissions.json. Two generators read it:

- regen_iam_authorized_actions.py: an action needed when the request does something is a companion of the request
  member the clause's words name as the generators' names go (filters is Filters, add replica Regions
  AddReplicaRegions), where the Service Reference lists it for the operation and does not mark it as tagging, which
  the tag-on-create table checks. A companion a request member sets may now carry no session key.
- regen_iam_request_resources.py: actions an operation always needs beside its own are each checked on what the rules
  read for it (ValidateResourcePolicy and PutResourcePolicy on the secret its SecretId names). A request checked by
  parts that names nothing is now checked on * as each action the table checks on the same resources as its own, not
  as its own alone, so a ValidateResourcePolicy naming no secret still needs PutResourcePolicy.

The fetcher refuses a sentence naming a secretsmanager: action in a wording it does not read, so a reworded page fails
rather than dropping a check, and the enforcement test runs on the AWS SDK.

Not read: GetSecretValue for each secret of a batch, which AWS reports per secret in Errors rather than refusing the
call; PutResourcePolicy for a cross-account replica and DeleteResourcePolicy for one stopped replicating, whose words
name no member of the request; and the KMS permissions of a secret on a customer managed key.
2026-11-29 13:12:46 -04:00
..
2026-03-15 17:43:56 -05:00