From b36fd2f0be690183a689641fb86deb12d2e6051c Mon Sep 17 00:00:00 2001 From: Priamo Germosen <6233424+pgermosen@users.noreply.github.com> Date: Sat, 24 Oct 2026 15:58:08 -0400 Subject: [PATCH] fix(iam): authorize Budgets operations as ModifyBudget and ViewBudget (#6436) Under IAM enforcement a Budgets operation other than a budget action was authorized as its own name, budgets:CreateBudget and the like, which is no IAM action. A policy granting budgets:ModifyBudget was denied CreateBudget, and one granting budgets:ViewBudget was denied DescribeBudgets, while a policy naming the operation, which grants nothing on AWS, let it through. AWS's Service Reference authorizes these operations as budgets:ModifyBudget or budgets:ViewBudget. Beside that action it lists the aws-portal Billing console permissions and, for CreateBudget, the tag-on-create budgets:TagResource, so the authorized-action generator counted two or three actions and left them out. It now counts neither: the aws-portal actions gate the Billing console, and the Billing and Cost Management user guide says programmatic requests to AWS Budgets are not affected by them; a namespace's tagging action beside exactly one other is the tag-on-create permission. That adds the 15 Budgets operations and IoT FleetWise BatchCreateVehicle, which Floci does not serve, to the vendored map. Not checked: budgets:TagResource when CreateBudget or CreateBudgetAction carries tags. --- docs/services/iam.md | 10 +++-- .../services/iam/IamAuthorizedActions.java | 5 ++- .../resources/aws/iam-authorized-actions.json | 22 +++++++++- ...rizedActionEnforcementIntegrationTest.java | 40 +++++++++++++++++++ .../iam/IamAuthorizedActionsTest.java | 9 +++++ tools/aws/regen_iam_authorized_actions.py | 37 ++++++++++++++++- .../aws/test_regen_iam_authorized_actions.py | 32 ++++++++++++++- 7 files changed, 147 insertions(+), 8 deletions(-) diff --git a/docs/services/iam.md b/docs/services/iam.md index 7fbc9f52b9..c6ef377b77 100644 --- a/docs/services/iam.md +++ b/docs/services/iam.md @@ -1668,9 +1668,13 @@ or on the `x-amz-cbor-1.1` one, names its resource and condition keys (a queue U authorizes an operation as a single action of another name, Floci does the same: `SendMessageBatch` is checked as `sqs:SendMessage` and `PublishBatch` as `sns:Publish`, so a policy granting the single-message action covers the batch call, and one naming the batch operation, which is not an -IAM action, grants nothing. The mapping is taken from AWS's Service Reference and vendored in -`src/main/resources/aws/iam-authorized-actions.json`. DynamoDB `TransactGetItems`, which AWS checks -as `dynamodb:GetItem`, is checked item by item, as described under +IAM action, grants nothing. Budgets operations other than its budget actions are checked as +`budgets:ModifyBudget` or `budgets:ViewBudget`, which the Service Reference lists for them beside the +`aws-portal` Billing console permissions. Those are not checked: the Billing and Cost Management user +guide, on moving off them, says "Programmatic requests to AWS Cost Explorer, AWS Cost and Usage +Reports, and AWS Budgets remains unaffected". The mapping is taken from AWS's Service Reference and +vendored in `src/main/resources/aws/iam-authorized-actions.json`. DynamoDB `TransactGetItems`, which +AWS checks as `dynamodb:GetItem`, is checked item by item, as described under [Condition keys floci populates](#condition-keys-floci-populates): each `Get` as `dynamodb:GetItem` on its own table, with its own `dynamodb:LeadingKeys`. diff --git a/src/main/java/io/github/hectorvent/floci/services/iam/IamAuthorizedActions.java b/src/main/java/io/github/hectorvent/floci/services/iam/IamAuthorizedActions.java index f9173f526e..2d11b4b7d0 100644 --- a/src/main/java/io/github/hectorvent/floci/services/iam/IamAuthorizedActions.java +++ b/src/main/java/io/github/hectorvent/floci/services/iam/IamAuthorizedActions.java @@ -25,7 +25,10 @@ import java.util.Set; *
The file is generated by {@code tools/aws/regen_iam_authorized_actions.py} from the
* {@code Operations} AWS's Service Reference publishes per service, which name the actions each SDK
* operation is authorized by. It carries only operations authorized by exactly one action of their
- * own namespace under another name; the generator documents the shapes it leaves out and why.
+ * own namespace under another name, counting neither a Billing console permission nor a
+ * tag-on-create permission beside that action: Budgets {@code CreateBudget} is authorized as
+ * {@code budgets:ModifyBudget} and {@code DescribeBudgets} as {@code budgets:ViewBudget}. The generator
+ * documents the shapes it leaves out and why.
* {@code make iam-authorized-actions-check} gates its shape offline and
* {@code make iam-authorized-actions-verify} checks every entry against AWS. A namespace Floci
* authorizes under a name other than the IAM namespace matches nothing here, and its operations keep
diff --git a/src/main/resources/aws/iam-authorized-actions.json b/src/main/resources/aws/iam-authorized-actions.json
index b677ec7531..b2c39fa661 100644
--- a/src/main/resources/aws/iam-authorized-actions.json
+++ b/src/main/resources/aws/iam-authorized-actions.json
@@ -2,7 +2,7 @@
"_source": {
"generator": "tools/aws/regen_iam_authorized_actions.py",
"reference": "https://servicereference.us-east-1.amazonaws.com/",
- "retrieved": "2026-10-14",
+ "retrieved": "2026-10-24",
"note": "make iam-authorized-actions-verify checks every entry against AWS."
},
"authorizedActions": {
@@ -140,6 +140,23 @@
"InvokeModelWithBidirectionalStream": "bedrock:InvokeModel",
"RetrieveAndGenerateStream": "bedrock:RetrieveAndGenerate"
},
+ "budgets": {
+ "CreateBudget": "budgets:ModifyBudget",
+ "CreateNotification": "budgets:ModifyBudget",
+ "CreateSubscriber": "budgets:ModifyBudget",
+ "DeleteBudget": "budgets:ModifyBudget",
+ "DeleteNotification": "budgets:ModifyBudget",
+ "DeleteSubscriber": "budgets:ModifyBudget",
+ "DescribeBudget": "budgets:ViewBudget",
+ "DescribeBudgetNotificationsForAccount": "budgets:ViewBudget",
+ "DescribeBudgetPerformanceHistory": "budgets:ViewBudget",
+ "DescribeBudgets": "budgets:ViewBudget",
+ "DescribeNotificationsForBudget": "budgets:ViewBudget",
+ "DescribeSubscribersForNotification": "budgets:ViewBudget",
+ "UpdateBudget": "budgets:ModifyBudget",
+ "UpdateNotification": "budgets:ModifyBudget",
+ "UpdateSubscriber": "budgets:ModifyBudget"
+ },
"cassandra": {
"GetKeyspace": "cassandra:Select",
"GetTable": "cassandra:Select",
@@ -194,6 +211,9 @@
"ListDataQualityStatistics": "glue:GetDataQualityResult",
"PublishDataQualityResultV2": "glue:PublishDataQuality"
},
+ "iotfleetwise": {
+ "BatchCreateVehicle": "iotfleetwise:CreateVehicle"
+ },
"lakeformation": {
"GetTemporaryDataLocationCredentials": "lakeformation:GetDataAccess"
},
diff --git a/src/test/java/io/github/hectorvent/floci/services/iam/IamAuthorizedActionEnforcementIntegrationTest.java b/src/test/java/io/github/hectorvent/floci/services/iam/IamAuthorizedActionEnforcementIntegrationTest.java
index 2279564f58..ed77021cc6 100644
--- a/src/test/java/io/github/hectorvent/floci/services/iam/IamAuthorizedActionEnforcementIntegrationTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/iam/IamAuthorizedActionEnforcementIntegrationTest.java
@@ -151,6 +151,35 @@ class IamAuthorizedActionEnforcementIntegrationTest {
.body(containsString("dynamodb:GetItem"));
}
+ @Test
+ void aBudgetIsChangedUnderModifyBudgetAndReadUnderViewBudget() {
+ String budget = "authorized-" + UUID.randomUUID().toString().substring(0, 8);
+ String create = """
+ {"AccountId": "%s", "Budget": {"BudgetName": "%s", "BudgetType": "COST", "TimeUnit": "MONTHLY",
+ "BudgetLimit": {"Amount": "100", "Unit": "USD"}}}
+ """.formatted(ACCOUNT_ID, budget);
+ String named = """
+ {"AccountId": "%s", "BudgetName": "%s"}
+ """.formatted(ACCOUNT_ID, budget);
+
+ // CreateBudget is no IAM action, so a policy naming it grants nothing.
+ budgets(userAllowed("budgets:CreateBudget"), "CreateBudget", create)
+ .statusCode(400)
+ .body("__type", equalTo("AccessDeniedException"))
+ .body(containsString("budgets:ModifyBudget"));
+ budgets(userAllowed("budgets:ModifyBudget"), "CreateBudget", create).statusCode(200);
+ cleanup.register(() -> budgets(ACCOUNT_ID, "DeleteBudget", named).statusCode(200));
+
+ String reader = userAllowed("budgets:ViewBudget");
+ budgets(reader, "DescribeBudget", named)
+ .statusCode(200)
+ .body("Budget.BudgetName", equalTo(budget));
+ budgets(reader, "DeleteBudget", named)
+ .statusCode(400)
+ .body("__type", equalTo("AccessDeniedException"))
+ .body(containsString("budgets:ModifyBudget"));
+ }
+
private String createTable() {
String table = "authorized-" + UUID.randomUUID();
dynamoDb(ACCOUNT_ID, "CreateTable", """
@@ -219,6 +248,17 @@ class IamAuthorizedActionEnforcementIntegrationTest {
.then();
}
+ private static ValidatableResponse budgets(String accessKeyId, String operation, String body) {
+ return given()
+ .header("Authorization", auth(accessKeyId, "budgets"))
+ .header("X-Amz-Target", "AWSBudgetServiceGateway." + operation)
+ .contentType("application/x-amz-json-1.1")
+ .body(body)
+ .when()
+ .post("/")
+ .then();
+ }
+
private static ValidatableResponse sqsQuery(String accessKeyId, String action, Map