mirror of
https://github.com/floci-io/floci.git
synced 2026-11-26 23:29:28 -05:00
A REST request gets its IAM action from IamActionRegistry's hand-written rules, and a route no rule maps gets none, which the caller allows: under enforcement such a request runs unchecked. IamRestRoutes (#7085) reads botocore's routes at runtime, but only for the operations a hand-written list enrolls, ValidatePolicy alone, and only by literal paths. A request no rule maps is now the operation whose route in botocore's model it matches, and it is checked as that operation's action (IamAuthorizedActions), as a Query or JSON request naming its operation is, when Floci checks it on the resources AWS does: those its request names, which ResourceArnBuilder builds for its namespace or the vendored request resources read for the operation, or none, when the Service Reference gives the action no resource type, as AWS authorizes such an action on `*`. An action AWS checks on a resource Floci neither builds nor reads stays unchecked, as before: checked on `*`, a grant scoped to its resource would be refused. That is the reason #7085 gave for enrolling ValidatePolicy alone, now read from generated data instead of a list. - The actions of no resource type come from the Service Reference's Actions, through regen_iam_authorized_actions.py, into iam-authorized-actions.json, for each credential scope whose routes rest-routes.json reads: 88 over 7 scopes. They are read from Actions, not Operations, because the reference lists one SDK client's operations per namespace, OpenSearch's `es` client alone. --check fails until a scope rest-routes.json adds is listed, and --verify fails when AWS gives a listed action a resource type. - IamRestRoutes now matches every route of a model: literal segments, a label taking one segment, a greedy label the rest of the path, and the query a route names, which must be on the request. Of the routes a request matches, the most specific wins, segment by segment from the left a literal, then a segment mixing a literal and a label, then a label, then a greedy label; then the route naming more of the query. The path is the one the rules match, still percent-encoded and without a trailing slash, and a segment may still end in a matrix parameter, which the router ignores. - The rules come first, so nothing they map changes. S3 and API Gateway are listed as handRouted, with their reasons, and routed by their rules alone: S3 tells apart the operations of one route by their query and headers, and API Gateway is checked by HTTP method. The route generator fails when one route names two operations of any other scope. - OpenSearch Service's models, both API versions, are read under `es`: 59 of their 147 operations are checked by their routes (29 of the `es` model's 51, 30 of the `opensearch` model's 96), 53 of which ran unchecked, ListDomainNames and ListVersions among them. The other six are the VPC endpoint operations #7351 mapped by hand: their rules are removed, as their routes give the same actions. - Access Analyzer's 9 operations of no resource type are checked by their routes, ListAnalyzers among those Floci serves, where ValidatePolicy alone was; its analyzer operations are not. Lambda's, EKS's, Scheduler's, Pipes' and DSQL's resources are built by hand and their routes all mapped by their rules, so none is checked differently. IamRestRouteCoverageTest checks every route of a scope not hand-routed: by the vendored routes alone it is its own operation, and through the registry it is its action when its resources are built by hand or read, or its action has no resource type, and unmapped otherwise. iam.md and access-analyzer.md say which routes are checked.