Files
floci/tools
Priamo Germosen 5c303afac6 fix(iam): check four more services on the resources their requests name (#7365)
Under IAM enforcement, DataSync, EMR, Rekognition and IAM Identity
Center requests were checked on `*`, so a grant scoped to a DataSync
agent, an EMR cluster, an Identity Center permission set or a
Rekognition custom model was refused, and a deny scoped to one never
applied.

The generated table of the resources requests name now reads them, 276
operations, from AWS's Service Reference and botocore as it reads the
earlier batches: their namespaces move from the generator's
NOT_COVERED to NAMESPACES and the table is regenerated, nothing in it
edited by hand; 1385 operations over 33 namespaces. Each resource
type Floci serves has the ARN format it mints: DataSync's
`agent/agent-<id>`, `location/loc-<id>` and `task/task-<id>`, EMR's
`cluster/<id>`, and IAM Identity Center's instances and permission
sets, with no Region or account. Of Rekognition, Floci serves the image
analyses alone, which act on no resource but a custom model.

Corrections, each with its reason:

- EMR requests naming a cluster by its job flow id, JobFlowId or
  JobFlowIds (AddInstanceGroups, AddJobFlowSteps, DescribeJobFlows,
  TerminateJobFlows and the four Set operations), are checked on that
  cluster: a job flow's id is the cluster's.
- EMR's AddTags and RemoveTags are checked on the cluster their
  ResourceId names, the one Floci tags, not on the one their ClusterId
  gives, which only scopes a session-scoped resource's tags. Read as
  generated, a ClusterId the grant covers would have let a request tag
  another cluster.
- EMR's ModifyInstanceGroups may leave out its ClusterId ("Required:
  No") and name each instance group by its id alone, which EMR then
  finds the cluster of. Such a request is checked on the cluster each
  group is in, where it was checked on `*`; a null ClusterId is read as
  none, as the handler reads it. An InstanceGroups that is not a list
  names no group to the check, and the handler now refuses it as naming
  none, where it modified the groups an object's values named.
- Rekognition's stream processor operations are checked on
  `streamprocessor/<Name>`: the Developer Guide's example gives a
  processor named streamProcessorForCam the ARN
  `...:streamprocessor/streamProcessorForCam`.
- IAM Identity Center's CreateAccountAssignment,
  DeleteAccountAssignment and ProvisionPermissionSet are also checked on
  the account their TargetId names, `account/<id>`, which the action
  acts on beside the instance and the permission set. A
  ProvisionPermissionSet for ALL_PROVISIONED_ACCOUNTS names no TargetId
  and provisions the permission set to every account it is provisioned
  to (the User Guide: up to 3,500 accounts that way, one with
  AWS_ACCOUNT), so it is checked on each of them, where a grant on the
  instance and the permission set alone let it through. Its TargetId
  names the account only for AWS_ACCOUNT, so a null one with
  ALL_PROVISIONED_ACCOUNTS names none.

The two lookups are the existing `through` entries, which named the
cluster or workgroup a Redshift Data session runs on: one may now read
each value of a list's field, and apply only `when` the request names
its resource no other way. StoredResourceArns.through gives a list of
ARNs, which EmrService and SsoAdminService now answer from what they
store, EmrService under the lock its handlers change clusters under.

Fixes the new formats needed:

- DataSync's ARN formats, and IAM Identity Center's applications' and
  trusted token issuers', name their account `${AccountId}` where every
  other format has `${Account}`. The generator now reads that slot as
  `${Account}`, so the caller's account fills it; a new Identity Center
  application was otherwise checked on `arn:aws:sso::*:application/*/*`,
  which no account-scoped grant matches.
- Identity Center's application providers are AWS's own,
  `arn:aws:sso::aws:applicationProvider/<id>`. An ARN of a type whose
  format fixes the account as `aws` is now checked in that account
  alone, not also as the caller's own copy, which does not exist and
  which a grant on the provider did not cover. An ARN of any other type
  giving the account `aws` is still checked as the caller's too.
- A permission set, an application or a trusted token issuer an
  Identity Center create makes is in the instance its InstanceArn
  names, whose id its ARN carries, `permissionSet/<instance id>/<id>`.
  It was checked with both ids open, which no grant scoped to an
  instance's permission sets matched. The generator now fills a variable
  no member fills from the ARN of another type the action acts on whose
  format is that variable alone, given by the ARN member named after it.

Left as generated, on `*`: Rekognition's CreateStreamProcessor and
StartMediaAnalysisJob, which name their collection or model two
structures deep, where the table reads none, and which Floci does not
serve.

Elastic Beanstalk and Redshift Serverless, which have as few resource
types, stay unread, each with its reason: an environment's ARN carries
an application name its requests do not give, and Redshift Serverless'
ARNs end in ids its requests name by name, so both need the stored
ARNs found first.

iam.md lists the four services, and AWS Payment Cryptography, which
the table already read, and gives the corrections, the rule for an
AWS-owned resource's ARN, and the cluster, accounts and instance the
lookups and the creates are checked on.
2026-11-03 17:14:32 -06:00
..