Files
floci/tools/aws/sources/secretsmanager-required-permissions.json
T
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

98 lines
4.9 KiB
JSON

{
"_source": {
"pages": [
"https://servicereference.us-east-1.amazonaws.com/v1/secretsmanager/secretsmanager.json",
"https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_AssociateCrossAccountReplica.html",
"https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_BatchGetSecretValue.html",
"https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_CreateSecret.html",
"https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_StopReplicationToReplica.html",
"https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_ValidateResourcePolicy.html"
],
"fetcher": "tools/aws/fetch_secretsmanager_required_permissions.py",
"retrieved": "2026-11-29",
"note": "The required permissions paragraph of each operation's API reference page the Service Reference lists as authorized by an action beside its own, copied as it stands, with each action it gives and what it is needed for."
},
"required": [
{
"operation": "AssociateCrossAccountReplica",
"paragraph": "Required permissions: secretsmanager:AssociateCrossAccountReplica, secretsmanager:GetSecretValue on the primary secret, and secretsmanager:AcceptCrossAccountReplication on the replica secret. You must also have kms:Decrypt permission for the AWS Key Management Service (AWS KMS) key that encrypts the primary secret, and kms:Encrypt permission for the AWS AWS KMS key that encrypts the replica secret. If you supply ReplicationRoleARN, you also need iam:PassRole for that role. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.",
"permissions": [
{
"action": "secretsmanager:AssociateCrossAccountReplica"
},
{
"action": "secretsmanager:GetSecretValue",
"on": "primary secret"
},
{
"action": "secretsmanager:AcceptCrossAccountReplication",
"on": "replica secret"
}
]
},
{
"operation": "BatchGetSecretValue",
"paragraph": "Required permissions: secretsmanager:BatchGetSecretValue, and you must have secretsmanager:GetSecretValue for each secret. If you use filters, you must also have secretsmanager:ListSecrets. If the secrets are encrypted using customer-managed keys instead of the AWS managed key aws/secretsmanager, then you also need kms:Decrypt permissions for the keys. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.",
"permissions": [
{
"action": "secretsmanager:BatchGetSecretValue"
},
{
"action": "secretsmanager:GetSecretValue",
"each": "secret"
},
{
"action": "secretsmanager:ListSecrets",
"when": "filters"
}
]
},
{
"operation": "CreateSecret",
"paragraph": "Required permissions: secretsmanager:CreateSecret. If you include tags in the secret, you also need secretsmanager:TagResource. To add replica Regions, you must also have secretsmanager:ReplicateSecretToRegions. To create a cross-account replica secret, you must also have secretsmanager:PutResourcePolicy permissions. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.",
"permissions": [
{
"action": "secretsmanager:CreateSecret"
},
{
"action": "secretsmanager:TagResource",
"when": "tags"
},
{
"action": "secretsmanager:ReplicateSecretToRegions",
"when": "add replica Regions"
},
{
"action": "secretsmanager:PutResourcePolicy",
"when": "create a cross-account replica secret"
}
]
},
{
"operation": "StopReplicationToReplica",
"paragraph": "Required permissions: secretsmanager:StopReplicationToReplica. For cross-account replica secrets, you must also have secretsmanager:DeleteResourcePolicy permissions. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.",
"permissions": [
{
"action": "secretsmanager:StopReplicationToReplica"
},
{
"action": "secretsmanager:DeleteResourcePolicy",
"for": "cross-account replica secrets"
}
]
},
{
"operation": "ValidateResourcePolicy",
"paragraph": "Required permissions: secretsmanager:ValidateResourcePolicy and secretsmanager:PutResourcePolicy. For more information, see IAM policy actions for Secrets Manager and Authentication and access control in Secrets Manager.",
"permissions": [
{
"action": "secretsmanager:ValidateResourcePolicy"
},
{
"action": "secretsmanager:PutResourcePolicy"
}
]
}
]
}