mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 14:10:49 -05:00
Under IAM enforcement a REST request whose route no rule maps is let through unchecked. No EKS
route had a rule, so any signed caller could create, read, change or delete clusters, node groups,
Fargate profiles, add-ons, access entries and Pod Identity associations with no EKS permission, and
without iam:PassRole on the roles they named. A Pod Identity association hands its service
account's pods the credentials of its role, so a caller could have pods run as any role in the
account.
Every operation of the eks model now has a rule and is checked as the action of its own name, as
the Service Authorization Reference gives it, including the routes Floci does not serve yet, and
IamRestRouteCoverageTest checks the whole model. Floci takes an access entry's principal as the
rest of the path, so a GET or DELETE under an entry reads or deletes an entry: the entry's access
policy routes, which Floci does not serve, run as DescribeAccessEntry and DeleteAccessEntry and are
checked as those.
Each is checked against the resource the reference gives it, in the caller's account, where EKS
looks everything up:
- a cluster against the ARN EKS holds it under, or cluster/<name> in the request's Region for one
it holds none of, and CreateCluster against the cluster its body names, as the EKS user guide's
example policy for creating a cluster grants it;
- a node group, Fargate profile, add-on, access entry or Pod Identity association against the ARN
EKS holds it under, which ends in an id the request does not carry, read through
EksService.findResourceArn with the lookups its handlers make; listing and creating them, and the
other routes under a cluster, against the cluster;
- DescribeUpdate against the add-on the update was made to, since the updates Floci keeps are its
add-ons' and EKS returns one whether or not the request names its add-on, and otherwise the
cluster;
- a tagging request against the caller's cluster named after the ARN's last /, as EKS tags it.
The roles each operation passes need iam:PassRole, with iam:PassedToService the value the Service
Reference gives: the cluster role, node role, Fargate pod execution role and an add-on's service
account and Pod Identity roles go to eks.amazonaws.com, a Pod Identity association's roleArn to
pods.eks.amazonaws.com ("The IAM principal that is creating the association must have
iam:PassRole."), and an EC2_LINUX or EC2_WINDOWS access entry's principal to ec2.amazonaws.com.
The router also matches a path with a trailing slash as the path without it, while the rules
matched the slash: POST /clusters/, GET /schedules/ and GET /2015-03-31/functions/<name>/ reached
their operation unchecked. A route is now matched without its trailing slash, as the router
matches it. An S3 path is matched as sent, as before: an S3 key may end in a slash, as a folder
marker's does, and S3's rules already take a bucket's one trailing slash.
docs/services/iam.md says which EKS routes are mapped, what each is checked against and the roles
they pass.