AWS eventbridge: EventBridge custom bus IAM actions, condition keys, and grantability
Summary
Rewrites the Custom Event Bus IAM reference: adds new condition keys (events:eventBusInvocation, events:SystemMetadata/*, events:PolicyName), documents that UpdateSubscriber/UpdateEventSource re-check the bus when a FilterConfiguration/Configuration is supplied, changes the metadata example to ForAllValues:StringEquals plus Null and adds events:UpdateSubscriber, and corrects cross-account grantability for GetResourcePolicy, ListResourcePolicies, TagResource, UntagResource, and ListTagsForResource to owner-only.
Security assessment
The page is IAM authorization guidance for the custom event bus: it enumerates events: actions, the ARNs they are checked against, whether another account can be granted them, and the condition keys (including events:PolicyName, which lets a principal be limited to the default policy so it cannot share the bus via AWS RAM). It also corrects previously permissive grantability claims (e.g. GetResourcePolicy/ListResourcePolicies/TagResource now owner-only) and documents that UpdateSubscriber/UpdateEventSource re-check the bus, which prevents conditions on CreateSubscriber from being bypassed. This is security documentation of authorization boundaries, not a fix for a specific vulnerability or incident.
Evidence
+`events:PolicyName`| The resource policy that the request acts on, `default` or `AWS_RAM`| `PutResourcePolicy`, `GetResourcePolicy`, `DeleteResourcePolicy`
Diff
diff --git a/eventbridge/latest/userguide/eb-custom-bus-access-actions.md b/eventbridge/latest/userguide/eb-custom-bus-access-actions.md index 4e74d0a..83bef78 100644 --- a//eventbridge/latest/userguide/eb-custom-bus-access-actions.md +++ b//eventbridge/latest/userguide/eb-custom-bus-access-actions.md @@ -11 +11 @@ Condition keysActions and the resources they are checked againstExample identity -Use this page when you write an IAM policy. It lists every `events:` action for the Custom Event Bus, the resource ARN each one is checked against, whether another account can be granted it, and the condition keys you can add. For example, to let a role attach subscribers whose `METADATA` filter names `tenant` as `acme`, grant `events:CreateSubscriber` on the bus with a `ForAnyValue:StringEquals` condition on `events:Metadata/tenant`. +Use this page when you write an IAM policy. It lists every `events:` action for the Custom Event Bus, the resource ARN each one is checked against, whether another account can be granted it, and the condition keys you can add. For example, you can limit a role to subscribers whose `METADATA` filter matches `tenant` to `acme` alone. To do so, grant `events:CreateSubscriber` and `events:UpdateSubscriber` on the bus with `Null` and `ForAllValues:StringEquals` conditions on `events:Metadata/tenant`. @@ -21,3 +21,8 @@ Condition key| Value| Supplied on -`events:Metadata/`key``| The values a `METADATA` filter matches on that key| `CreateSubscriber` -`events:Metadata/`key`/Matcher`| `exact`| `CreateSubscriber` -`events:ContentFilterPresent`| `true` when the subscriber declares a `DATA` filter| `CreateSubscriber` +`events:eventBusInvocation`| `true` for a forwarded event, `false` for a direct publish| `PutEvents`, `PutRawEvents` +`events:SystemMetadata/ContentType`| The content type in the event's system metadata| `PutRawEvents`, and `PutEvents` for a forwarded event +`events:SystemMetadata/AwsSource`| The source of a forwarded event| `PutEvents`, `PutRawEvents`, for a forwarded event only +`events:SystemMetadata/AwsDetailType`| The detail type of a forwarded event| `PutEvents`, `PutRawEvents`, for a forwarded event only +`events:Metadata/`key``| On `PutRawEvents`, the value of that metadata key on the event. On the subscriber actions, the values a `METADATA` filter matches on that key| `PutRawEvents`, `CreateSubscriber`, `UpdateSubscriber` +`events:Metadata/`key`/Matcher`| `exact`| `CreateSubscriber`, `UpdateSubscriber` +`events:ContentFilterPresent`| `true` when the filter configuration declares a `DATA` filter, otherwise `false`| `CreateSubscriber`, `UpdateSubscriber` +`events:PolicyName`| The resource policy that the request acts on, `default` or `AWS_RAM`| `PutResourcePolicy`, `GetResourcePolicy`, `DeleteResourcePolicy` @@ -25 +30,2 @@ Condition key| Value| Supplied on -`aws:RequestTag/`key``, `aws:TagKeys`| The tags in the request| The create operations and `TagResource`, `UntagResource` +`aws:RequestTag/`key``| The value of that tag in the request| The create operations and `TagResource` +`aws:TagKeys`| The tag keys in the request| The create operations, `TagResource`, and `UntagResource` @@ -27 +33 @@ Condition key| Value| Supplied on -A metadata key is supplied as a set of values, so match it with a set operator such as `ForAnyValue:StringEquals`. `METADATA` filters are exact-match only, which is why the matcher value is always `exact`. A `DATA` filter matches arbitrary JSON, so only its presence is exposed, not its content. `UpdateEventSource` re-runs the bus check with `events:source` set from the replacement configuration, so a condition on that key governs a repointed event source as well as a new one. +A _forwarded event_ is one that a rule or subscriber delivers to the bus, under a role that you supplied. EventBridge checks it with `events:eventBusInvocation` set to `true`; see [Events that arrive without a publish call](./eb-custom-bus-sharing.html#eb-custom-bus-access-forwarded). A forwarded AWS service or partner event is checked as `PutEvents`, unless a subscriber transformed it. A subscriber transforms an event when its `Transformer.Type` is `WITH_METADATA` or `JSONATA`. A forwarded event checked as `PutEvents` carries `events:source` and `events:detail-type` with the event's source and detail type. Any other forwarded event is checked as `PutRawEvents`. Either way, `events:SystemMetadata/AwsSource` and `events:SystemMetadata/AwsDetailType` hold the event's source and detail type. Both keys are absent when the event has no source or detail type, or when a subscriber transformed it. So a `Deny` statement that tests the value of one of these keys does not apply to an event that lacks the key. @@ -29 +35,9 @@ A metadata key is supplied as a set of values, so match it with a set operator s -The following resource policy lets account `444455556666` create subscribers on the `orders` bus only when the subscriber's `METADATA` filter matches `tenant` exactly to `acme`. A subscriber with no `METADATA` filter, or one that names another tenant, is denied. EventBridge supplies a metadata condition key only for the fields a filter declares, so the `Null` condition is what denies a filter that omits `tenant`. +On `PutRawEvents`, `events:Metadata/`key`` holds a single value: the event's value for that metadata key. On `CreateSubscriber` and `UpdateSubscriber`, it holds every value that the `METADATA` filter matches on that key. A filter can match several values, so match the key with a set operator. `ForAllValues:StringEquals` matches only when every value is one that you list. `ForAnyValue:StringEquals` matches when any one value is one that you list, so it also allows a filter that adds other values. `ForAllValues` also matches when the filter does not name the key, so add a `Null` condition to require the key. `METADATA` filters are exact-match only, which is why the matcher value is always `exact`. A `DATA` filter matches arbitrary JSON, so only its presence is exposed, not its content. A `SYSTEM_METADATA` filter supplies no condition key. + +`UpdateSubscriber` supplies the three filter keys only when the request includes a `FilterConfiguration`, even one that leaves the filter unchanged. That request is also checked as `events:UpdateSubscriber` against the bus. A condition in a statement that grants only `events:CreateSubscriber` does not apply to that check. So put the same conditions on `events:UpdateSubscriber`. A `FilterConfiguration` of `{}` removes every filter. It supplies `events:ContentFilterPresent` as `false` and no metadata keys, so a `Null` condition on a metadata key denies it. + +When an `UpdateEventSource` request includes a `Configuration`, EventBridge also checks `events:UpdateEventSource` against the bus. It sets `events:source` from that configuration. So put the conditions that you set on `events:CreateEventSource` on `events:UpdateEventSource` as well. A condition on `events:source` then governs a repointed event source as well as a new one. + +Use `events:PolicyName` to limit a principal to one of the bus's two resource policies; see [Write a custom resource policy](./eb-custom-bus-sharing.html#eb-custom-bus-access-policy). The key holds the name of the policy that the request acts on. When you omit `PolicyName` in your own request, the request acts on `default`, and the key is `default`. AWS Resource Access Manager (AWS RAM) writes the `AWS_RAM` policy with the credentials of the principal that changes a resource share. EventBridge checks that write as `events:PutResourcePolicy`, with the key set to `AWS_RAM`. So a principal that you limit to `default` cannot share the bus through AWS RAM. `ListResourcePolicies` reports on both policies, so it does not supply this key. So a `StringEquals` condition on this key never matches `ListResourcePolicies`. Allow that action in a statement without that condition. + +The following resource policy lets account `444455556666` create subscribers on the `orders` bus and change their filters. It allows both only when the subscriber's `METADATA` filter matches `tenant` exactly to `acme`. A subscriber with no `METADATA` filter, or with a filter that names any tenant other than `acme`, is denied. EventBridge supplies a metadata condition key only for the fields a filter declares. So the `Null` condition is what denies a filter that omits `tenant`. The conditions restrict only this statement's grant. If another statement, or an AWS RAM share, also allows `events:CreateSubscriber` for that account, the conditions do not restrict that grant. @@ -39 +53,4 @@ The following resource policy lets account `444455556666` create subscribers on - "Action": "events:CreateSubscriber", + "Action": [ + "events:CreateSubscriber", + "events:UpdateSubscriber" + ], @@ -43 +60 @@ The following resource policy lets account `444455556666` create subscribers on - "ForAnyValue:StringEquals": { "events:Metadata/tenant": "acme" }, + "ForAllValues:StringEquals": { "events:Metadata/tenant": "acme" }, @@ -65 +82 @@ IAM action| Checked against| Grantable to another account -`events:UpdateSubscriber`| The subscriber| The subscriber's owner authorizes it +`events:UpdateSubscriber`| The subscriber, and the bus when the request includes a `FilterConfiguration`| Yes, for the bus check @@ -71 +88 @@ IAM action| Checked against| Grantable to another account -`events:UpdateEventSource`| The event source, and the bus again| Yes, for the bus check +`events:UpdateEventSource`| The event source, and the bus when the request includes a `Configuration`| Yes, for the bus check @@ -75 +92 @@ IAM action| Checked against| Grantable to another account -`events:GetResourcePolicy`| The bus| Yes +`events:GetResourcePolicy`| The bus| No. Bus owner only @@ -77,4 +94,4 @@ IAM action| Checked against| Grantable to another account -`events:ListResourcePolicies`| The bus| Yes -`events:TagResource`| The bus, subscriber, or event source named in the request| Bus: yes. Subscriber or event source: its owner -`events:UntagResource`| The bus, subscriber, or event source named in the request| Bus: yes. Subscriber or event source: its owner -`events:ListTagsForResource`| The bus, subscriber, or event source named in the request| Bus: yes. Subscriber or event source: its owner +`events:ListResourcePolicies`| The bus| No. Bus owner only +`events:TagResource`| The bus, subscriber, or event source named in the request| No. The resource's owner only +`events:UntagResource`| The bus, subscriber, or event source named in the request| No. The resource's owner only +`events:ListTagsForResource`| The bus, subscriber, or event source named in the request| No. The resource's owner only @@ -82 +99 @@ IAM action| Checked against| Grantable to another account -To create a subscriber or an event source on a bus, the caller needs the action on the bus as well as on the new resource. That is what lets a bus owner decide, in the bus's own policy, which accounts may attach anything to it. `CreateSubscriber` makes four separate authorization checks, and all four must allow: `events:CreateSubscriber` on the bus, `events:CreateSubscriber` on the subscriber, `iam:PassRole` on the role in `InvokeConfiguration.RoleArn`, and `events:TagResource` on the subscriber when the request carries tags. `CreateEventSource` runs the same checks without `iam:PassRole`, because an event source has no role. +To create a subscriber or an event source on a bus, the caller needs the action on the bus as well as on the new resource. That is what lets a bus owner decide, in the bus's own policy, which accounts may attach anything to it. `CreateSubscriber` makes four separate authorization checks, and all four must allow: `events:CreateSubscriber` on the bus, `events:CreateSubscriber` on the subscriber, `iam:PassRole` on the role in `InvokeConfiguration.RoleArn`, and `events:TagResource` on the subscriber when the request carries tags. `CreateEventSource` runs the same checks without `iam:PassRole`, because an event source has no role. `UpdateSubscriber` also checks `events:UpdateSubscriber` on the bus when the request includes a `FilterConfiguration`. It also checks `iam:PassRole` on the role in `InvokeConfiguration.RoleArn` when the request includes one. So another account needs `events:CreateSubscriber` and `events:UpdateSubscriber` on your bus to attach subscribers and to update their filters. The AWS RAM managed permissions for attaching subscribers include both. @@ -90 +107 @@ A resource that does not exist yet has no complete ARN, so a create check uses a -A **producer** needs `events:PutEvents`, `events:PutRawEvents`, or both, on the bus ARN. Grant the action that matches the API it calls. A producer to a bus encrypted with a customer managed key also needs access to that key; see [Encryption at Rest for Amazon EventBridge Custom Event Bus](./eb-custom-bus-encryption.html). A **subscriber owner** needs `events:CreateSubscriber` on the bus and on the subscriber, `iam:PassRole` on the delivery role, and the describe, update, and delete subscriber actions on the subscribers it manages. A **bus administrator** needs the create, update, and delete bus actions, the four resource policy actions, and `events:RevokeResource`. +A **producer** needs `events:PutEvents`, `events:PutRawEvents`, or both, on the bus ARN. Grant the action that matches the API it calls. A producer to a bus encrypted with a customer managed key also needs access to that key; see [Encryption at Rest for Amazon EventBridge Custom Event Bus](./eb-custom-bus-encryption.html). A **subscriber owner** needs `events:CreateSubscriber` on the bus and on the subscriber, `iam:PassRole` on the delivery role, and the describe, update, and delete subscriber actions on the subscribers it manages. For an `UpdateSubscriber` request that includes a `FilterConfiguration`, it also needs `events:UpdateSubscriber` on the bus. A **bus administrator** needs the create, update, and delete bus actions, the four resource policy actions, and `events:RevokeResource`.