Skip to content

feat(aws-stepfunctions-tasks): scope batch SubmitJob IAM to specific resources#37601

Open
Sagargupta16 wants to merge 1 commit intoaws:mainfrom
Sagargupta16:fix/batch-submit-job-iam-permissions
Open

feat(aws-stepfunctions-tasks): scope batch SubmitJob IAM to specific resources#37601
Sagargupta16 wants to merge 1 commit intoaws:mainfrom
Sagargupta16:fix/batch-submit-job-iam-permissions

Conversation

@Sagargupta16
Copy link
Copy Markdown

Issue # (if applicable)

Closes #37214.

Reason for this change

The BatchSubmitJob task currently grants batch:SubmitJob with Resource: *, allowing the state machine execution role to submit jobs to any job definition and queue in the account. This violates the principle of least privilege.

Description of changes

Modified configurePolicyStatements() in submit-job.ts to scope the IAM policy Resource to the specific job definition ARN and job queue ARN when they are concrete values (not JsonPath/JSONata expressions).

When either jobDefinitionArn or jobQueueArn is a dynamic expression (JsonPath/JSONata), we fall back to Resource: * since the actual ARN is only known at runtime.

The existing isJsonPathOrJsonataExpression() utility (already used elsewhere in the codebase) is used to detect dynamic values.

Describe any new or updated permissions being added

The batch:SubmitJob permission is now scoped to specific resources instead of *:

  • Resource: [jobDefinitionArn, jobQueueArn] when both are concrete ARNs
  • Resource: * when either is a JsonPath/JSONata expression (unchanged behavior)

Description of how you validated changes

Added two unit tests:

  • scopes IAM policy to specific job definition and job queue - verifies the Resource array contains the specific job definition ref and job queue ARN when concrete values are provided
  • uses wildcard resource when jobDefinitionArn is a JsonPath expression - verifies Resource remains * when dynamic expressions are used

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

…job definition

Scope the batch:SubmitJob IAM policy to the specific job definition and
job queue ARNs instead of granting access to all job definitions
(job-definition/*). This follows least-privilege principles.

When jobDefinitionArn or jobQueueArn is a JsonPath/JSONata expression,
fall back to wildcard resource since the ARN is unknown at synth time.

Fixes aws#37214
@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1 labels Apr 15, 2026
@aws-cdk-automation aws-cdk-automation added the pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. label Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1 pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-stepfunctions-tasks): Tighter permissions in SubmitBatchJob

2 participants