fix(iam): check ModifyReportDefinition on the report it names alone (#6935)

The generated table of the resources requests name checked Cost and
Usage Reports' ModifyReportDefinition on the report its ReportName
names and also on its ReportDefinition.BillingViewArn, read as a report
definition's ARN. That member is a billing view's ARN
(arn:aws:billing::<payer account>:billingview/...), never a report's,
so a request carrying a report's ARN there was checked on a report it
does not act on. PutReportDefinition's correction already leaves it
out.

A correction now reads ModifyReportDefinition's report from ReportName
alone, sharing PutReportDefinition's reason, and the table is
regenerated; nothing in it is edited by hand.
This commit is contained in:
Priamo Germosen authored and GitHub committed 2026-10-29 18:04:35 -05:00
1 parent dfefef2437
commit 62527ebaa8
4 files changed
+17 -9

No files matched your search

@@ -809,17 +809,23 @@ class IamRequestResourceEnforcementIntegrationTest {
/**
* A Cost and Usage Report definition is checked on {@code definition/<name>}, a put on the one its
* {@code ReportDefinition.ReportName} names, not on one its billing view ARN gives.
* {@code ReportDefinition.ReportName} names and a modify on the one its {@code ReportName} names, neither on one
* its billing view ARN gives.
*/
@Test
void aReportDefinitionIsCheckedOnTheArnItsNameGives() {
String name = "res-report-" + suffix();
String arn = "arn:aws:cur:" + REGION + ":" + ACCOUNT + ":definition/" + name;
User user = user("res-report");
user.policy(allowOn("cur:PutReportDefinition", arn) + "," + allowOn("cur:DeleteReportDefinition", arn));
user.policy(allowOn("cur:PutReportDefinition", arn) + "," + allowOn("cur:ModifyReportDefinition", arn) + ","
+ allowOn("cur:DeleteReportDefinition", arn));
refusedJson(cur(user, "PutReportDefinition", "{\"ReportDefinition\":" + reportDefinition(name + "-other", arn)
+ "}"), "cur:PutReportDefinition");
cur(user, "PutReportDefinition", "{\"ReportDefinition\":" + reportDefinition(name, null) + "}").statusCode(200);
cur(user, "ModifyReportDefinition", "{\"ReportName\":\"" + name + "\",\"ReportDefinition\":"
+ reportDefinition(name, arn + "-other") + "}").statusCode(200);
refusedJson(cur(user, "ModifyReportDefinition", "{\"ReportName\":\"" + name + "-other\",\"ReportDefinition\":"
+ reportDefinition(name + "-other", arn) + "}"), "cur:ModifyReportDefinition");
cur(user, "DeleteReportDefinition", "{\"ReportName\":\"" + name + "\"}").statusCode(200);
}