mirror of
https://github.com/floci-io/floci.git
synced 2026-11-22 21:50:46 -05:00
Under IAM enforcement a request that names a role is checked for iam:PassRole only where PassedRoles has a case for its operation, so most of the operations AWS's Service Reference lists with iam:PassRole went through without it: a caller allowed to create a CodeBuild project, a Firehose stream, a Glue job or an SSM association could hand it any role in the account. Adding a case per operation took one pull request per few services. The Service Reference names, for each operation, the services its role goes to, but not the request member that names it; botocore's models give the members. tools/aws/regen_iam_passed_roles.py joins the two into src/main/resources/aws/iam-passed-roles.json: every operation listing iam:PassRole in the namespaces Floci serves over JSON, Query and Smithy RPC v2 CBOR, and in the REST services whose routes are authorized as operations, each either read from the table, read by hand in PassedRoles, or not read with a reason. Generation fails on an operation in none of the three. A member names a role when its name ends in Role, RoleArn or RoleName (a plural, or one followed by Update or Override) and it holds a string or a list or map of them, not an enum. A member whose documentation says it takes a role by name is checked on the ARN IAM holds the role under. A role the Service Reference passes to no named service, as it does Cognito's, is checked with no iam:PassedToService. The generator records its corrections with their reasons: members that pass no role (the roles a Budgets action attaches a policy to, a CodePipeline action's role, which the pipeline's role assumes, SSM target accounts' execution roles, the roles a Glue job's generated nodes assume with STS, Firehose's Snowflake role), members the rule does not see (a Cognito user pool's SMS caller roles, a Glue connection's ROLE_ARN property and a view's definer, Service Catalog's AssumeRole and LAUNCH_ROLE keys), and which service a member's role goes to where the reference names several. PassedRoles reads a table member from a JSON or CBOR body, or from Query form parameters in either list form. Its own cases now return null for an operation they do not read, and the table covers the rest. New cases read SNS's role attributes (a topic's delivery status roles, a platform application's, a Firehose subscription's and the SMS one, as the SNS handlers read the map; an attribute with no value names none), a CloudWatch Logs subscription filter policy's RoleArn, a Service Catalog launch constraint's role, by the type Service Catalog holds for the constraint on an update and in any case, since Floci keeps the type as given, and an SWF decision's Lambda role from the attributes its type names. Not read: requests that name no role, roles that are a runbook's parameter, operations whose roles go to several services without the reference saying which member goes where (EMR RunJobFlow, EKS UpdateClusterConfig, CloudWatch Logs CreateImportTask, SageMaker CreateTrainingSession), XML bodies (S3 PutBucketReplication), EC2's RequestSpotFleet, and REST services whose routes no rule maps yet. make iam-passed-roles-check, part of aws-data-check, re-derives every member from the pinned botocore; make iam-passed-roles-verify, part of iam-data-verify, checks every operation against AWS; the IAM data drift workflow now also runs on a change to the table or its generator. PassedRoleNamespacesIntegrationTest fails for a namespace Floci serves that the table neither reads nor names as not read yet.