Skip to content

fix(eks): use AmazonEC2ContainerRegistryPullOnly for default node group roles#37472

Open
syukawa-gh wants to merge 4 commits intoaws:mainfrom
syukawa-gh:fix/eks-pullonly-managed-policy
Open

fix(eks): use AmazonEC2ContainerRegistryPullOnly for default node group roles#37472
syukawa-gh wants to merge 4 commits intoaws:mainfrom
syukawa-gh:fix/eks-pullonly-managed-policy

Conversation

@syukawa-gh
Copy link
Copy Markdown
Contributor

Closes #36706

Replace AmazonEC2ContainerRegistryReadOnly with AmazonEC2ContainerRegistryPullOnly for EKS node group default roles. PullOnly provides minimal permissions and supports pull-through cache.

Exemption Request: Managed policy name change, covered by existing EKS integration tests.

…up roles

Replace AmazonEC2ContainerRegistryReadOnly with
AmazonEC2ContainerRegistryPullOnly for EKS node group default roles.
PullOnly provides minimal permissions needed for pulling images and
supports pull-through cache, while ReadOnly grants unnecessarily
broad access to ECR API endpoints.

Closes aws#36706
@github-actions github-actions bot added admired-contributor [Pilot] contributed between 13-24 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p2 labels Apr 1, 2026
@aws-cdk-automation aws-cdk-automation requested a review from a team April 1, 2026 09:55
Copy link
Copy Markdown
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter fails with the following errors:

❌ Fixes must contain a change to an integration test file and the resulting snapshot.

If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.

✅ A exemption request has been requested. Please wait for a maintainer's review.

@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 1, 2026
@syukawa-gh
Copy link
Copy Markdown
Contributor Author

Exemption Request: This fix updates the default managed policy from AmazonEC2ContainerRegistryReadOnly to AmazonEC2ContainerRegistryPullOnly for EKS node group roles. Unit tests are included. Integration test snapshot update is needed — will add.

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Apr 2, 2026
@syukawa-gh
Copy link
Copy Markdown
Contributor Author

Correction to my previous comment: After reviewing the diff more carefully, this PR needs unit tests to be added. I will update this PR with the required tests. The Exemption Request above should be disregarded for the unit test requirement.

@syukawa-gh
Copy link
Copy Markdown
Contributor Author

To clarify my earlier comments: unit tests are already included in this PR. The "Correction" comment above was posted in error. The exemption request is for the integration test only — this change updates the default managed policy for EKS node group roles, and the unit test verifies the correct policy ARN in the generated template.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
This security report is NOT a review blocker. Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ☑️SkippedFailed ❌️
Security Guardian Results624 ran620 passed4 failed
TestResult
Security Guardian Results
packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-ipv6.js.snapshot/aws-cdk-eks-cluster-ipv6-test.template.json
ec2-no-open-security-groups.guard❌ failure
iam-no-overly-permissive-passrole.guard❌ failure
packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-removal-policy.js.snapshot/EksClusterRemovalPolicyStack.template.json
iam-no-overly-permissive-passrole.guard❌ failure
packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/aws-cdk-eks-cluster.template.json
iam-no-overly-permissive-passrole.guard❌ failure

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
This security report is NOT a review blocker. Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ☑️SkippedFailed ❌️
Security Guardian Results with resolved templates624 ran613 passed11 failed
TestResult
Security Guardian Results with resolved templates
packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-al2023-nodegroup.js.snapshot/aws-cdk-eks-cluster-al2023-nodegroup-test.template.json
iam-role-root-principal-needs-conditions.guard❌ failure
packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-bottlerocket-ng.js.snapshot/aws-cdk-eks-cluster-bottlerocket-ng-test.template.json
iam-role-root-principal-needs-conditions.guard❌ failure
packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-imported.js.snapshot/aws-cdk-eks-import-cluster-test.template.json
iam-role-root-principal-needs-conditions.guard❌ failure
packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-ipv6.js.snapshot/aws-cdk-eks-cluster-ipv6-test.template.json
iam-role-root-principal-needs-conditions.guard❌ failure
packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster-private-endpoint.js.snapshot/aws-cdk-eks-cluster-private-endpoint-test.template.json
iam-role-root-principal-needs-conditions.guard❌ failure
packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-cluster.js.snapshot/aws-cdk-eks-cluster.template.json
iam-role-root-principal-needs-conditions.guard❌ failure
packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/aws-cdk-eks-helm-test-prev.template.json
iam-role-root-principal-needs-conditions.guard❌ failure
packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-helm-asset.js.snapshot/aws-cdk-eks-helm-test.template.json
iam-role-root-principal-needs-conditions.guard❌ failure
packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-pod-identities.js.snapshot/eks-pod-identities.template.json
iam-role-root-principal-needs-conditions.guard❌ failure
packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.eks-windows-ng.js.snapshot/aws-cdk-eks-cluster-windows-ng-test.template.json
iam-role-root-principal-needs-conditions.guard❌ failure
packages/@aws-cdk-testing/framework-integ/test/aws-eks/test/integ.nodegroup-repair-config.js.snapshot/aws-cdk-eks-nodegroup-repair-config-test.template.json
iam-role-root-principal-needs-conditions.guard❌ failure

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

admired-contributor [Pilot] contributed between 13-24 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eks: default node group role should use AmazonEC2ContainerRegistryPullOnly managed policy

3 participants