Description:
When creating a Lambda with a SQS trigger, by default, "AWSLambdaSQSQueueExecutionRole" policy is attached to the lambda's execution role which gives access to DeleteMessage from ALL queues.
Steps to reproduce:
Use the following snippet to create a function with an SQS trigger.
MyFunction:
Type: AWS::Serverless::Function
Properties:
Handler: ....
CodeUri: ....
Policies:
- AWSXrayWriteOnlyAccess
- AWSLambdaBasicExecutionRole
- SQSPollerPolicy:
QueueName: !GetAtt MyQueue.QueueName
Events:
TheSQSEvent:
Type: SQS
Properties:
Queue: !GetAtt MyQueue.Arn
Observed result:
Lambda's execution role has the AWSLambdaSQSQueueExecutionRole policy attached to it, which gives access to delete messages from all queues:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"sqs:ReceiveMessage",
"sqs:DeleteMessage",
"sqs:GetQueueAttributes",
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "*"
}
]
}
Expected result:
I'm expecting this to create an execution role to which only 3 policies are attached, since I only specified 3 policies.
Description:
When creating a Lambda with a SQS trigger, by default, "AWSLambdaSQSQueueExecutionRole" policy is attached to the lambda's execution role which gives access to DeleteMessage from ALL queues.
Steps to reproduce:
Use the following snippet to create a function with an SQS trigger.
Observed result:
Lambda's execution role has the AWSLambdaSQSQueueExecutionRole policy attached to it, which gives access to delete messages from all queues:
Expected result:
I'm expecting this to create an execution role to which only 3 policies are attached, since I only specified 3 policies.