mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
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:
1 parent
dfefef2437
commit
62527ebaa8
4 files changed
+17
-9
No files matched your search
@@ -1563,8 +1563,8 @@ namespace its `NamespaceId` names or, when it gives none or a JSON null, the one
|
||||
project, which its id names before its `:` (`<project>:<id>`), as CodeBuild authorizes
|
||||
`BatchGetBuilds`, `StopBuild`, `RetryBuild` and `BatchDeleteBuilds`. `CreateBudget` and `UpdateBudget`
|
||||
are checked on the budget their `Budget.BudgetName` or `NewBudget.BudgetName` names, and Cost and Usage
|
||||
Reports' `PutReportDefinition` on the report its `ReportDefinition.ReportName` names, not on the billing
|
||||
view ARN each may carry, which names no budget or report. An EventBridge rule is on the event bus
|
||||
Reports' `PutReportDefinition` and `ModifyReportDefinition` on the report their `ReportDefinition.ReportName`
|
||||
or `ReportName` names, not on the billing view ARN each may carry, which names no budget or report. An EventBridge rule is on the event bus
|
||||
its request's `EventBusName` names, by name or by ARN, and on the default bus when it names none
|
||||
or gives a null, whose rules are `rule/<name>`, with no bus; a bus ARN of another account, the
|
||||
default bus's included, names that account's rule, checked as given and as the caller's own, which
|
||||
|
||||
@@ -336,7 +336,7 @@
|
||||
"cur:DeleteReportDefinition": {"action": "cur:DeleteReportDefinition", "types": ["cur"], "resources": [{"type": "cur", "fill": {"ReportName": "ReportName"}}]},
|
||||
"cur:DescribeReportDefinitions": {"action": "cur:DescribeReportDefinitions", "types": [], "resources": []},
|
||||
"cur:ListTagsForResource": {"action": "cur:ListTagsForResource", "types": ["cur"], "resources": [{"type": "cur", "fill": {"ReportName": "ReportName"}}]},
|
||||
"cur:ModifyReportDefinition": {"action": "cur:ModifyReportDefinition", "types": ["cur"], "resources": [{"types": ["cur"], "arn": "ReportDefinition.BillingViewArn"}, {"type": "cur", "fill": {"ReportName": "ReportName"}}]},
|
||||
"cur:ModifyReportDefinition": {"action": "cur:ModifyReportDefinition", "types": ["cur"], "resources": [{"type": "cur", "fill": {"ReportName": "ReportName"}}]},
|
||||
"cur:PutReportDefinition": {"action": "cur:PutReportDefinition", "types": ["cur"], "resources": [{"type": "cur", "fill": {"ReportName": "ReportDefinition.ReportName"}}]},
|
||||
"cur:TagResource": {"action": "cur:TagResource", "types": ["cur"], "resources": [{"type": "cur", "fill": {"ReportName": "ReportName"}}]},
|
||||
"cur:UntagResource": {"action": "cur:UntagResource", "types": ["cur"], "resources": [{"type": "cur", "fill": {"ReportName": "ReportName"}}]},
|
||||
|
||||
+8
-2
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -264,10 +264,12 @@ CORRECTIONS: dict[str, tuple[list[dict], str]] = {
|
||||
"its ':' (CODEBUILD_BUILD_ID, for example codebuild-demo-project:b1e6661e-...)")
|
||||
for operation, member in (("BatchDeleteBuilds", "ids[]"), ("BatchGetBuilds", "ids[]"), ("RetryBuild", "id"),
|
||||
("StopBuild", "id"))},
|
||||
"cur:PutReportDefinition": ([{"type": "cur", "fill": {"ReportName": "ReportDefinition.ReportName"}}],
|
||||
"the request names the report by ReportDefinition.ReportName ('The name of the report "
|
||||
"that you want to create'), which the rule does not read inside a structure; its "
|
||||
"BillingViewArn is a billing view's ARN, never a report definition's"),
|
||||
**{f"cur:{operation}": ([{"type": "cur", "fill": {"ReportName": member}}],
|
||||
f"the request names the report by {member} ('The name of the report that you want to "
|
||||
"create') alone; its ReportDefinition's BillingViewArn, which the rule reads as a report "
|
||||
"definition's ARN, is a billing view's (arn:aws:billing::<payer account>:billingview/...)")
|
||||
for operation, member in (("ModifyReportDefinition", "ReportName"),
|
||||
("PutReportDefinition", "ReportDefinition.ReportName"))},
|
||||
**{f"codepipeline:{operation}": ([{"type": "pipeline", "fill": {"PipelineName": "pipeline.name"}}],
|
||||
"the request names the pipeline by its pipeline structure's name, which the "
|
||||
"rule does not read inside a structure; its roleArn is the role CodePipeline "
|
||||
|
||||
Reference in new issue
Block a user