-
Notifications
You must be signed in to change notification settings - Fork 2.4k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extra policy is attached to Lambda's execution role for SQS event #2118
Comments
@xazhao Could I know why this is tagged as a feature, please? This seems like a bug to me. That is, a policy gets attached where it shouldn't be. |
@gheibia I believe we attach AWSLambdaSQSQueueExecutionRole by default in case some users forgot to attach it. I tagged it as a feature because if we simply fix it, it might break other's template. A safer workaround would be finding a way to disable attach policies by default. Also I will be talking about this issue with the team. I will update the labels once I have some better ideas from the team. |
Thanks for the update @xazhao. To me attaching a policy like that violates the principle of least privilege. That is, without my consent, my function is receiving a wide open access (DELETE, of all access rights) to all queues. |
@xazhao I would also really appreciate to get a possibility to not attach the AWSLambdaSQSQueueExecutionRole role. |
When SAM is creating roles for event sources to the serverless function it is currently not scoping them to that eventsource (even when in addition the customer supplies appropriately scoped policies). This falls into the class of changes that ideally we should do but may not be able to do for fear of unexpectedly breaking customers who are relying on this behaviour (and probably not supplying any policies). I will bring this back to the team with a suggestion that we provide a way to achieve the desired result without breaking existing customers. |
Is there any update on this issue? |
We can't simply narrow down the resource constraint as it might break existing apps. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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.
The text was updated successfully, but these errors were encountered: