mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 22:11:36 -05:00
Under IAM enforcement, a request that handed one of these services a role needed no iam:PassRole on it. A user allowed only ecs:RegisterTaskDefinition and ecs:RunTask could start a task with any role in the account, and with ECS task-role credentials on, the task got that role's credentials. The IAM user guide requires the permission for every role passed to a service. AWS's Service Reference names the service each operation passes its role to, and the check now covers these operations as it already covers Lambda and EC2: - ECS: RegisterTaskDefinition passes its task and execution roles to ecs-tasks.amazonaws.com. RunTask and StartTask pass the task definition's roles and any role override, and CreateService, UpdateService and CreateTaskSet pass the roles of the task definition they name. The infrastructure roles go to ecs.amazonaws.com: a managed EBS volume's role, the service role, the load balancer, lifecycle hook, Service Connect TLS and VPC Lattice roles, and a Managed Instances provider's infrastructure role. A role given by name is the role of that name in the caller's account. - Step Functions: CreateStateMachine and UpdateStateMachine pass roleArn to states.amazonaws.com, in a JSON or a CBOR body, gzip-encoded or not, since the CBOR endpoint decompresses a body before running it. - EventBridge: PutRule passes RoleArn, and PutTargets each target's RoleArn, to events.amazonaws.com. - CloudFormation: CreateStack, UpdateStack, DeleteStack, CreateChangeSet and ContinueUpdateRollback pass RoleARN when the request names one. A later operation that names none reuses the stack's role without the check, as CloudFormation does. CreateStackSet and UpdateStackSet pass AdministrationRoleARN, or the default AWSCloudFormationStackSetAdministrationRole for a self-managed StackSet, as the CloudFormation user guide says. An update goes by the StackSet's own permission model, which Floci keeps whatever PermissionModel the request names. A role override on RunTask is checked as well as the task definition's roles, not instead of them, because Floci runs a task with the definition's task role. The task definition and the StackSet's permission model are looked up through a new PassedRoleLookup interface, which ECS and the StackSet service implement, so the filter does not depend on either service. Three services are left out. Floci authorizes Cloud Control as cloudcontrolapi:*, where AWS uses cloudformation:*, so its RoleArn waits until that namespace is fixed. EventBridge Scheduler and Pipes are REST services that no IAM route rule maps to an action yet, so enforcement does not check their requests at all, iam:PassRole included.