mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(iam): check Glue requests on the resources they name (#8529)
Glue was one of the namespaces the table of request resources did not read yet, so under enforcement every Glue request was checked on *: a grant scoped to one database or table could not allow anything, and a deny scoped to one did not hold. - Glue moves from NOT_COVERED to NAMESPACES and the generator reads all 314 of its operations. A table operation is checked on the account's Data Catalog, the database and the table, the three types the Service Reference gives glue:GetTable and its kin; a database operation on the catalog and the database; jobs, crawlers, triggers, workflows and connections on the ARNs Glue mints for them. - Where a Glue request names its resources in ways the generator did not read yet, its rules read a little further, each from botocore alone: Input and List drop from a member's stem as Config and plurals do (DatabaseInput.Name, ConnectionNameList); a list whose own list shape is named for the type's names fills it (BatchDeleteTable's TablesToDelete, a BatchDeleteTableNameList); "being" ends a type's name in documentation (GetWorkflowRun's Name, "name of the workflow being run"); a type of no variables of its own, the account's catalog, is no longer dropped as an alternative to the unnamed type a create makes; and a create whose request carries tags and whose action acts on other types alone tags the resource it makes when the request names it in full (CreateConnection's tags on connection/<ConnectionInput.Name>), which the table reader now accepts. - Outside Glue those rules change four entries: Redshift's BatchModifyClusterSnapshots is checked on the snapshots its SnapshotIdentifierList names instead of *, and EventBridge's CreateEventSource and QuickSight's CreateDataSet and CreateTopic gain a makes that changes nothing at runtime. Every other entry is unchanged. - What the table does not read stays as the metadata gives it: a CatalogId is not read, so another account's or a federated catalog is checked on the caller's account's ARNs, and a schema named by its registry and name on schema/<SchemaName>, the Service Reference's format, whose botocore pattern takes no slash. IamRequestResourceEnforcementIntegrationTest checks a table on the catalog, its database and itself, a database and a job on the ARNs Glue gives them, a deny on one table or connection holding inside a batch delete, a database's creation on its DatabaseInput.Name, a connection's tags on its ConnectionInput.Name, and a workflow run on its workflow. The generator's tests cover each rule; iam.md says so.
This commit is contained in:
1 parent
b0625347d8
commit
e6f57d849d
8 files changed
+614
-43
No files matched your search
@@ -306,7 +306,7 @@ final class RequestResourceMembers {
|
||||
|
||||
/**
|
||||
* The file: each operation's resources, the resource types its action acts on, the resources it creates under a
|
||||
* parent and the one a create whose action acts on no type makes ({@code makes}), as
|
||||
* parent and the one a create whose action acts on no type, or on other types alone, makes ({@code makes}), as
|
||||
* {@code <namespace>:<Operation>}, the members a REST operation's request carries outside its body, each
|
||||
* namespace's ARN formats, and the namespaces it reads, those built by hand, those not read yet, and the others
|
||||
* with resource types. A located member is a label of the request's path, {@code {Label}}, or a parameter of its
|
||||
@@ -441,10 +441,10 @@ final class RequestResourceMembers {
|
||||
actsOn.put(operation.getKey(), types);
|
||||
List<Resource> made = new ArrayList<>();
|
||||
for (JsonNode resource : operation.getValue().path("makes")) {
|
||||
if (!types.isEmpty() || !resource.isObject() || resource.size() != 2 || !resource.has("type")
|
||||
|| !resource.has("fill")) {
|
||||
if (!resource.isObject() || resource.size() != 2 || !resource.has("type") || !resource.has("fill")
|
||||
|| types.contains(resource.get("type").asText())) {
|
||||
throw new IllegalStateException(RESOURCE_NAME + " makes " + resource + " for " + operation.getKey()
|
||||
+ ", no type's variables of a create acting on none");
|
||||
+ ", no type's variables of a create acting on none or on other types alone");
|
||||
}
|
||||
made.add(resource(operation.getKey(), resource, formats.getOrDefault(namespace, Map.of())));
|
||||
}
|
||||
|
||||
@@ -306,8 +306,9 @@ public final class RequestResources {
|
||||
|
||||
/**
|
||||
* As {@link #created(String, ContainerRequestContext, String, String, String, Map)}, for a request whose tags need
|
||||
* the {@code tagging} action: a create whose action acts on no resource type tags the resource it makes
|
||||
* ({@code makes}) where that action acts on the resource's type, as AWS checks a tagging action on the resource
|
||||
* the {@code tagging} action: a create whose action acts on no resource type, or on other types alone (Glue's
|
||||
* {@code CreateConnection}), tags the resource it makes ({@code makes}) where that action acts on the resource's
|
||||
* type, as AWS checks a tagging action on the resource
|
||||
* being tagged, and its tags go where the operation is checked otherwise (a Cloud Map namespace, whose
|
||||
* {@code TagResource} acts on no type, on {@code *}); a null {@code tagging}, or one the table does not hold, acts
|
||||
* on it.
|
||||
|
||||
Reference in new issue
Block a user