Allow passing of a roleArn to Scheduler by alexw23 · Pull Request #12889 · serverless/serverless
Summary
This PR addresses the issues highlighted in PR #11707 concerning the incorrect implementation of roleARN support for schedulers.
Problem
The current implementation defaults to using the Lambda function's role, which presents several logical and security concerns:
- A scheduler should not have the same permission boundaries as the Lambda function itself.
- Assigning
InvokeFunctionpermissions to the function's role means that the function could potentially call itself—an unintended and potentially dangerous behavior.
Solution
This PR introduces the ability to override the default behavior by allowing roleARN to be explicitly specified, similar to the approach taken by AWS SAM (reference).