fix(iam): authorize an operation as the action AWS checks for it (#5604)

Under enforcement a request naming its operation, in a Query Action or an
X-Amz-Target header, was authorized as <namespace>:<Operation>, the operation's
own name. AWS authorizes some operations as an action of another name: SQS
SendMessageBatch, DeleteMessageBatch and ChangeMessageVisibilityBatch as
sqs:SendMessage, sqs:DeleteMessage and sqs:ChangeMessageVisibility, and SNS
PublishBatch as sns:Publish. None of the batch names is an IAM action, so a policy
AWS honours for a batch call was denied, and a policy naming the batch operation
granted something AWS does not check.

AWS publishes the mapping in the Operations of each Service Reference file.
tools/aws/regen_iam_authorized_actions.py vendors the operations authorized by
exactly one action of their own namespace under another name, 235 over 33
namespaces, into src/main/resources/aws/iam-authorized-actions.json. Everything else
keeps its own name. The generator leaves out operations that list:
- several actions, whose extras apply only when tags or a role are passed;
- no action, which is missing data;
- an action of another namespace;
- another action while one of the operation's own name exists;
- a tagging action alone;
- the same action for several SDK clients, which AWS can authorize differently,
  as S3 and S3 Control's GetPublicAccessBlock;
or whose name is listed again with another answer. A record of the wrong shape
fails the run instead of being skipped.
make iam-authorized-actions-check gates the file's shape on pull requests that touch it, and
iam-authorized-actions-verify, run by the IAM Data Drift workflow, checks every
entry against AWS.

IamAuthorizedActions reads the file through the new core.common
VendoredResources, rather than adding one more copy of the read-or-fail block a
dozen catalogs carry, and the Query and X-Amz-Target paths ask it for the action.
DynamoDB TransactGetItems, which AWS authorizes as dynamodb:GetItem, keeps its own
name: the transaction check recognizes the call by it and checks every Get as
dynamodb:GetItem on its own table, with its own dynamodb:LeadingKeys. Renamed, the
call would skip that check and be authorized as one GetItem whose body has no
top-level Key, which a ForAllValues condition accepts, so a fine-grained policy
would grant every key.

The check for operations AWS serves without credentials reads the Query action
directly, rather than through resolve with a placeholder scope, now that resolve
returns the authorized action. A Query request naming no action is not one of them.

An SDK compatibility test covers SendMessageBatch and PublishBatch, granted by
the single-item action and refused under the batch name, with enforcement on.
This commit is contained in:
Priamo Germosen authored and GitHub committed 2026-10-13 22:29:06 -05:00
1 parent c6c2c609c3
commit eba058266b
15 files changed
+1618 -17

No files matched your search

+9 -5
View File
@@ -1,17 +1,18 @@
name: IAM Data Drift
# Checks the two vendored files that come from AWS's live service reference rather than from a
# pinned dependency: the IAM service namespace list, and the map of which resource each IAM action
# is authorized against. That needs the live service reference index, so unlike every other check here it can
# Checks the three vendored files that come from AWS's live service reference rather than from a
# pinned dependency: the IAM service namespace list, the map of which resource each IAM action is
# authorized against, and the map of operations AWS authorizes as an action of another name. That
# needs the live service reference index, so unlike every other check here it can
# fail without anything in the repository having changed: an AWS outage, or a namespace AWS has
# retired. It therefore runs on its own, never as part of a job that ordinary changes trigger.
#
# Two triggers, for two different failures:
#
# - On a pull request that touches either vendored file or its generator, which is where a
# - On a pull request that touches a vendored file or its generator, which is where a
# hand-typed or mistyped entry would enter the repository. A pull request that does not touch
# them cannot introduce one, so it does not run and cannot be failed by an outage.
# - Weekly, because both files also go stale without anyone touching them: AWS ships services
# - Weekly, because the files also go stale without anyone touching them: AWS ships services
# and actions, and occasionally retires them. Tying the only upstream check to pull request
# activity would mean a quiet month is a month with no drift detection at all.
#
@@ -32,6 +33,9 @@ on:
- 'tools/aws/test_regen_service_namespaces.py'
- 'tools/aws/regen_iam_action_resources.py'
- 'tools/aws/test_regen_iam_action_resources.py'
- 'src/main/resources/aws/iam-authorized-actions.json'
- 'tools/aws/regen_iam_authorized_actions.py'
- 'tools/aws/test_regen_iam_authorized_actions.py'
- '.github/workflows/iam-data-drift.yml'
schedule:
# Mondays at 06:00 UTC, before the working week rather than during it.
+5
View File
@@ -108,6 +108,11 @@ jobs:
- name: Check the vendored IAM action resource map is well-formed
run: make iam-action-resources-check
# And for the map of operations AWS authorizes under another action's name: a malformed
# entry would authorize a request as an action AWS does not check for it.
- name: Check the vendored map of operations to their IAM actions is well-formed
run: make iam-authorized-actions-check
# Also offline: the service-linked role table is checked against the vendored managed
# policy documents in the repository, never against AWS. The half that comes from a
# recorded create cannot be re-derived without the snapshot, which is why every row in