Claus Ibsen created CAMEL-27360:
-----------------------------------
Summary: camel-aws2-eventbridge - the SQS queue the consumer
creates should only accept messages from its own EventBridge rule
(aws:SourceArn condition)
Key: CAMEL-27360
URL: https://issues.apache.org/jira/browse/CAMEL-27360
Project: Camel
Issue Type: Bug
Components: camel-aws2
Reporter: Claus Ibsen
Fix For: 4.24.0
With {{autoCreateQueue}}, the EventBridge consumer creates an SQS queue, adds
it as a target of the rule, and sets this queue policy
({{EventbridgeConsumer.buildQueuePolicy}}):
{code}
{"Effect":"Allow","Principal":{"Service":"events.amazonaws.com"},"Action":"sqs:SendMessage","Resource":"<queue
arn>"}
{code}
The policy has no {{Condition}}, so any EventBridge rule may send to the queue,
not only the rule the consumer is for. AWS recommends limiting a service
principal with {{aws:SourceArn}} (and {{aws:SourceAccount}}):
https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-use-resource-based.html#eb-sqs-permissions
Expected: the policy only allows the rule of the consumer, for example:
{code}
"Condition":{"ArnEquals":{"aws:SourceArn":"<rule arn>"}}
{code}
The consumer can get the rule ARN with {{DescribeRule}} (rule name and event
bus) before it sets the policy. A user-provided queue ({{queueUrl}}) keeps its
own policy.
Found while adding the {{aws-eventbridge-source}} Kamelet
(apache/camel-kamelets#3334).
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)