mirror of
https://github.com/floci-io/floci.git
synced 2026-12-06 11:38:06 -05:00
fix(iam): check five more services on the resources their requests name (#6810)
Under IAM enforcement, Amazon Data Firehose, Cognito identity pools,
Cloud Map, ACM and CodePipeline requests were checked on `*`, so a
grant scoped to a delivery stream, an identity pool, a namespace or a
service, a certificate, a pipeline or a webhook was refused, and a deny
scoped to one never applied.
The generated table of the resources requests name now reads them, 149
operations, from AWS's Service Reference and botocore as it reads the
first batch: their namespaces move from the generator's NOT_COVERED to
NAMESPACES, and the table is regenerated, nothing in it edited by hand.
Each resource type's ARN format is the one Floci's handler mints, which
the tests check against the ARN each create returns:
- `deliverystream/<name>`, `identitypool/<id>`, `namespace/<id>`,
`service/<id>`, `certificate/<id>` and a pipeline's bare name.
- A CodePipeline webhook: AWS's is `webhook:<name>` (the Service
Reference's format, and the CodePipeline User Guide's
"arn:aws:codepipeline:eu-central-1:ACCOUNT_ID:webhook:my-webhook"),
where Floci minted `webhook/<name>`; it now mints AWS's.
Corrections, each with its reason:
- StartPipelineExecution and GetPipelineState name their pipeline by a
bare `name` ("The name of the pipeline to start"), which the rule
reads only for an operation named after the type, as Step Functions'
StartExecution names its execution, not its state machine, by `name`.
- CreatePipeline and UpdatePipeline name it by `pipeline.name`, and
PutWebhook the webhook by `webhook.name` and the pipeline it connects
to by `webhook.targetPipeline`. `pipeline.roleArn` holds the role
CodePipeline assumes, an IAM role's ARN by botocore's pattern, and
names no pipeline: read as one, a pipeline-shaped value there was the
only resource an UpdatePipeline was checked on, so a grant on one
pipeline let a request change another.
- CreateCustomActionType and DeleteCustomActionType are checked on
`actiontype:Custom/<category>/<provider>/<version>`: a custom action
type's owner is Custom, which the request does not give, and AWS's
CreateCustomActionType example answers "owner": "Custom".
- Cloud Map's CreateService names its namespace by NamespaceId or,
when it gives none or a JSON null, by DnsConfig.NamespaceId, which
botocore keeps ("Use NamespaceId in Service instead") and the handler
reads then; read by NamespaceId alone, a deny on the namespace did
not hold for a request giving it in DnsConfig. A member given a JSON
null now counts as absent in a resource's `when` and `unless`, as a
handler reading it with asText(null) takes it, unless the table reads
it as a value through `absent` (EventBridge's bus, `default`).
For those, the table may fill a variable from a structure's field
(`pipeline.name`), and give a variable no member gives the one value
its handler uses (`fixed`), in the generator, the loader and the
reader.
A create that names another resource beside the one it makes has its
tags checked on the one it makes alone, which the table marks `made`:
the resource of the type, or with an ARN format's leading resource
word, related to the operation's name past its verb. PutWebhook's tags
go on the webhook, not the pipeline it connects to, and CreateService's
on `service/*`, not the namespace; no other operation in the table is
marked.
Application Auto Scaling stays unread, its reason in NOT_COVERED: a
scalable target's ARN ends in an id the service mints, while requests
name the target by ServiceNamespace, ResourceId and ScalableDimension,
and read as a member ResourceId would fill that id.
RequestResourceMembersTest's test of every resource in the table now
expects, with the resource a request names, the resources of its
operation that every request names: Cloud Map's CreateService names
the service it creates with every variable open.
This commit is contained in:
1 parent
3d4fdfe7ca
commit
096d336fab
12 files changed
+746
-65
No files matched your search
+16
-3
@@ -1503,7 +1503,8 @@ action is denied. The routed protocol determines the status, not just the reques
|
||||
A request is checked against the resources it names. Floci builds their ARNs itself for S3, Lambda,
|
||||
SQS, SNS, DynamoDB, Kinesis, SSM, KMS, IAM, Resource Groups, EventBridge Scheduler, EventBridge
|
||||
Pipes, Aurora DSQL, EKS, CloudWatch Logs, Secrets Manager and STS. For Elastic Load Balancing, ECR,
|
||||
Step Functions, EventBridge and Amazon Cognito user pools they come from a table generated from AWS's Service
|
||||
Step Functions, EventBridge, Amazon Cognito user pools and identity pools, Amazon Data Firehose, Cloud
|
||||
Map, ACM and CodePipeline they come from a table generated from AWS's Service
|
||||
Reference and botocore, `src/main/resources/aws/iam-request-resources.json`, which gives each
|
||||
operation's action, the resource types that action acts on with their ARN formats, and the request
|
||||
members that name them: a member holding a resource's ARN, which counts when it matches the format
|
||||
@@ -1525,7 +1526,15 @@ selects the registry its handler acts in, so `repository/<name>` is checked in t
|
||||
`registryId` that is no account id names no repository, while a null one is the caller's, as ECR
|
||||
reads it. `StartExecution` and
|
||||
`StartSyncExecution` take Step Functions Local's `<stateMachineArn>#<test case>` and run the
|
||||
machine before the `#`, so that machine is the one checked. An EventBridge rule is on the event bus
|
||||
machine before the `#`, so that machine is the one checked. `StartPipelineExecution` and
|
||||
`GetPipelineState` name their pipeline by a bare `name`, which is read as the pipeline's;
|
||||
`CreatePipeline` and `UpdatePipeline` by `pipeline.name`, not by `pipeline.roleArn`, which holds the
|
||||
role CodePipeline assumes; `PutWebhook` names the webhook by `webhook.name` and the pipeline it
|
||||
connects to by `webhook.targetPipeline`. A CodePipeline webhook is `webhook:<name>`, the ARN AWS
|
||||
gives it, and a custom action type `actiontype:Custom/<category>/<provider>/<version>`, its owner
|
||||
being `Custom`, which the request does not give. Cloud Map's `CreateService` is checked on the
|
||||
namespace its `NamespaceId` names or, when it gives none or a JSON null, the one its
|
||||
`DnsConfig.NamespaceId` names, as Cloud Map reads them, and on the service it creates. 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
|
||||
@@ -1889,7 +1898,11 @@ resource, so its tags are checked on that one, built from the parent's ARN with
|
||||
`listener/app/<load balancer name>/<load balancer id>/*`, and `CreateRule`'s on the new
|
||||
`listener-rule/...` under its listener. So the AWS Load Balancer Controller's policy, which allows
|
||||
`AddTags` at creation only on target groups and application and network load balancers, and on
|
||||
listeners and rules, holds. Where the tagging action takes
|
||||
listeners and rules, holds. A create that names another resource beside the one it makes tags the
|
||||
one it makes alone, the resource of the type it is named after: Cloud Map's `CreateService` is
|
||||
checked on its namespace and on `service/*`, and its tags on `service/*`; CodePipeline's
|
||||
`PutWebhook` on the webhook and the pipeline it connects to, and its tags on the webhook. Where the
|
||||
tagging action takes
|
||||
its namespace's `CreateAction` key, as `ec2:CreateTags`, `ecs:TagResource`, CloudFormation's
|
||||
`TagResource` and Elastic Load Balancing's `AddTags` do, the key is the operation's name:
|
||||
`ec2:CreateAction` is `RunInstances` for an instance launched with tags. The operation's own action
|
||||
|
||||
Reference in new issue
Block a user