Replies: 8 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. |
Beta Was this translation helpful? Give feedback.
-
@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. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
@xazhao I would also really appreciate to get a possibility to not attach the AWSLambdaSQSQueueExecutionRole role. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
Is there any update on this issue? |
Beta Was this translation helpful? Give feedback.
-
We can't simply narrow down the resource constraint as it might break existing apps. |
Beta Was this translation helpful? Give feedback.
-
I just ran into this as well. I don't know how it can be solved since it's already out in the wild. But I'd love to see a possible change where SAM doesn't create this overly permissive role. |
Beta Was this translation helpful? Give feedback.
-
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.
Beta Was this translation helpful? Give feedback.
All reactions