Files
floci/tools
Priamo Germosen f895b21f52 fix(iam): check Amazon MWAA by its generated routes, resources and passed roles (#10017)
Under enforcement a REST route no vendored model names runs unchecked, and Amazon MWAA was among them: any caller could
create, read, update or delete an environment, get its CLI or web login token, and pass an execution role with no
iam:PassRole. MWAA's model routes are vendored (regen_rest_routes.MODELS, signed airflow), so each request is checked as
its operation's action, and airflow joins the generated tables of request resources, passed roles and tags on create: an
environment by the name its path gives or the ARN its body does, CreateEnvironment's and UpdateEnvironment's
ExecutionRoleArn passed to airflow, and the tags a create carries.

MwaaStoredResourceArns answers the tags MWAA holds on an environment, read in place in the ARN's account and Region, a
pre-multi-account entry under its bare name included, which an aws:ResourceTag condition reads.
StoredResourceArns names it, and now says MSK answers the tags of a cluster alone, as #9973 left MSK.

A namespace the table reads is served on its tag routes only at the ARN its path encodes, so MwaaIntegrationTest's tag
calls send the ARN encoded, as the SDKs do; IamActionRegistryTest's example of a route Floci does not check on a
resource it reads becomes IoT's DescribeThing.

IamRestRouteEnforcementIntegrationTest checks that with no grant an environment's read is refused, that a grant on one
environment reads it and refuses another, and that an aws:ResourceTag condition reads an environment's tags.
IamPassRoleEnforcementIntegrationTest checks that CreateEnvironment and UpdateEnvironment need iam:PassRole on the
execution role they name, passed to airflow.amazonaws.com, which a grant for EC2 does not cover.

An ARN names the account that owns the resource, so a request on another account's resource is cross-account whether
or not its service holds a policy on it. Before, a resource with no supplied policy had no owner, so the caller's own
policies alone decided a call on another account's MWAA environment, and an aws:ResourceTag condition answered on that
environment's tags. ResourcePolicyProviders.ownerAccount now answers the first supplied policy's owner, or else the
ARN's account, and IamEnforcementFilter and RoleResourceAccessAuthorizer judge the request as IAM's cross-account
evaluation logic does: "AWS allows the request only if both account policy evaluations allow the request". An ARN
naming no account, as an S3 bucket's, is judged within the caller's account as before.

So every service that holds a resource-based policy supplies it, read in the account the ARN names: Backup vault access
policies, Bedrock guardrails and guardrail profiles, Bedrock AgentCore, CloudHSM backups, CloudWatch Logs destinations,
DynamoDB tables, ECR repositories and the registry policy, the Glue Data Catalog (for its Data Catalog resources alone,
never a job or crawler), Lambda web functions, Marketplace entities, OAM sinks, Organizations, Payment Cryptography
keys, S3 Tables buckets and tables, S3 Vectors buckets, Secrets Manager secrets, SES identity policies, SSM parameters
and WAF rule groups. An OpenSearch domain's access policy is not among them: AWS applies it to the domain's subresources
only, "not the domain itself", and "accessing the configuration API requires an identity-based policy", while Floci
checks the configuration API alone. Nor is an EFS file system policy, which AWS uses "to control file system data
access" by NFS clients, which Floci does not serve. Nor are the resource policies CloudWatch Logs' PutResourcePolicy
sets, which AWS enforces only for AWS service principals, "not IAM users, roles, or cross-account principals". Nor is a
Redshift cluster's or Serverless namespace's resource policy, which AWS describes as "resource policies that work with
zero-ETL integrations", whose actions Floci does not check. CloudHSM reported every backup ARN in 000000000000; it now
names the caller's account, so the ARN DescribeBackups gives is the caller's own.

A resource with no policy that its service acts on in the account its ARN names (StoredResourceArns.reachedInItsAccount:
a RAM invitation sent to the caller or a share another account owns, an SSM document another account owns, a Redshift
snapshot named by its owner) is judged within the caller's account, its handler answering whether the owner's share lets
the caller use it, as that contract already says. So accepting a RAM invitation, associating a shared SSM document and
restoring a shared Redshift snapshot work as before.

ResourcePolicyProvidersIntegrationTest checks that each provider supplies its policy, owned by the ARN's account, and
nothing for the same ARN in another account, and that the Glue Data Catalog policy is not supplied for a job.
IamRestRouteEnforcementIntegrationTest checks that another account's MWAA environment is refused whatever its tags and
the caller's policies, and that EKS tagging of a foreign ARN is refused; IamRequestResourceEnforcementIntegrationTest
checks that a repository in another registry is refused while its policy grants another account and reaches ECR once it
grants the caller's; LogsArnTagAuthorizationIntegrationTest checks that a foreign log group ARN is refused.

AWS added 24 RDS actions to the Service Reference at 18:02Z on 2026-12-02 (branches, data groups and DB cluster groups,
and ResyncIntegration), which the online verify gate reads from AWS's current copy, so the generated tables take them.

AWS's Service Reference stopped listing iam:PassRole for kinesisanalytics:AddApplicationReferenceDataSource at 05:02Z on
2026-12-03, so the regenerated passed-roles table drops it, and the request-resources table, generated beside it, is
regenerated with it.
2026-12-03 09:38:39 -04:00
..