Access Analyzer's routes are vendored, but the table of request
resources did not read the namespace, so a route of an action AWS
checks on an analyzer, GetAnalyzer, CreateAnalyzer and DeleteAnalyzer
among the ones Floci serves, was left unchecked under enforcement: a
caller with no grant on the analyzer was let through and a deny on it
never applied.
- access-analyzer moves from NOT_COVERED to NAMESPACES: 39 operations,
1544 over 35 namespaces, no other entry changed. An analyzer is read
as analyzer/<analyzerName> from the path or the body, the ARN Floci
mints, an archive rule as analyzer/<analyzerName>/archive-rule/<ruleName>,
and the operations naming an analyzer by its ARN, in the body or the
query, on that ARN.
- With every operation of the scope in the table, the routes check
each by the resources-read half of the join rule. No vendored route
is left unchecked: every routed scope is read, built by hand, or of
an action of no resource type.
- The REST reason of the namespaces not read yet no longer says the
path is not read: RequestResources reads it from the vendored routes,
which do not have those namespaces' models yet.
- access-analyzer is read by the tag-on-create table too, so a
CreateAnalyzer carrying tags also needs access-analyzer:TagResource
on the analyzer it names, and its own action is checked with them as
aws:RequestTag and aws:TagKeys, as the Service Reference lists. The
regeneration also takes Config's PutServiceLinkedConfigurationRecorder,
which the reference has listed with config:TagResource since the last
sync; Floci does not serve it.
IamRestRouteEnforcementIntegrationTest creates an analyzer and checks
GetAnalyzer, CreateAnalyzer and DeleteAnalyzer on the ARN Access
Analyzer gives it, a grant scoped to it, another analyzer refused and
a deny holding; the vendored-route test's unchecked example is gone.
IamActionRegistryTest checks the analyzer routes and keeps an unread
example on a fixture (Backup's GetBackupPlan); RequestResourcesTest
reads an analyzer from a path label and a body and an archive rule from
both; IamRestRouteCoverageTest pins the five operations Floci serves;
IamTagOnCreateEnforcementIntegrationTest checks a tagged CreateAnalyzer
needs TagResource on its analyzer and meets a request-tag condition,
and an untagged one CreateAnalyzer alone.
iam.md and access-analyzer.md say so.
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.
* fix(accessanalyzer): route GetAnalyzer through GET /analyzer/<name>
Adds getAnalyzer service method and GET /analyzer/{analyzerName} endpoint
in AccessAnalyzerController to return analyzer details. Returns
ResourceNotFoundException (404) when analyzer does not exist. Adds
integration tests for retrieval and not found cases.
Fixes#5353
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* docs(accessanalyzer): sync the action table for GetAnalyzer
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(accessanalyzer): share not-found helper and align docs/service matrix
Extract a shared analyzerNotFound helper that returns ResourceNotFoundException
with resourceId/resourceType (analyzer) for both get/delete. Remove trailing
blank lines from the controller. Update docs/services/index.md to list 4
operations. Run make docs-sync to keep action tables in sync.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* fix(accessanalyzer): reuse getAnalyzer in deleteAnalyzer and assert not-found fields
deleteAnalyzer repeated getAnalyzer's validate-and-lookup; it now calls
getAnalyzer before deleting, so the lookup and the not-found error live in
one place. The 404 test now checks the resourceId and resourceType the
shared helper adds, and the stray blank line before the class's closing
brace is gone.
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
---------
Signed-off-by: Matheus Oliveira <matheus.6148@gmail.com>
* feat(accessanalyzer): add analyzer lifecycle
* fix(accessanalyzer): complete service contracts
* test(accessanalyzer): make SDK cleanup best effort
* test(accessanalyzer): use project logging for cleanup