Skip to content

feat(s3-deployment): apply least privilege to destination bucket policies 2#36992

Open
amandladev wants to merge 14 commits intoaws:mainfrom
amandladev:feature/s3-deployment-permissions-least-privilege
Open

feat(s3-deployment): apply least privilege to destination bucket policies 2#36992
amandladev wants to merge 14 commits intoaws:mainfrom
amandladev:feature/s3-deployment-permissions-least-privilege

Conversation

@amandladev
Copy link
Copy Markdown
Contributor

Introduction

This change improves security by scoping IAM policies to the specific
destination key prefix instead of granting access to all bucket objects.

Changes:

IAM policies now grant access to /<destinationKeyPrefix>/* instead of /*
When destinationKeyPrefix is specified (e.g., 'deploy/here/', 'efs/'),
the Lambda execution role only receives permissions for that specific prefix
Deployments without a prefix continue to work as before with /* access
Applies to both standard deployments and EFS-backed deployments

Security Benefits:

Follows the principle of least privilege
Multiple deployments to the same bucket are now isolated by prefix
Reduces blast radius if deployment Lambda credentials are compromised
Prevents accidental cross-deployment modifications

Affected Use Cases:
✅ Deployment with prefix: destinationKeyPrefix: 'deploy/here/'
✅ EFS-backed deployment: destinationKeyPrefix: 'efs/', useEfs: true
✅ Multiple deployments to same bucket with different prefixes
✅ Deployments without prefix (unchanged behavior)

Testing:

Updated integration tests for all deployment scenarios
Verified snapshots for standard, EFS, and prefixed deployments
All existing functionality preserved with improved security posture

Fixes #35610

@github-actions github-actions bot added effort/medium Medium work item – several days of effort beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK feature-request A feature should be added or improved. p1 labels Feb 14, 2026
@aws-cdk-automation aws-cdk-automation requested a review from a team February 14, 2026 17:41
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 14, 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 Results96 ran96 passed
TestResult
No test annotations available

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 14, 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 templates96 ran96 passed
TestResult
No test annotations available

@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 Feb 14, 2026
@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

This PR has been in the MERGE CONFLICTS state for 3 weeks, and looks abandoned. Note that PRs with failing linting check or builds are not reviewed, please ensure your build is passing

To prevent automatic closure:

  • Resume work on the PR
  • OR request an exemption by adding a comment containing 'Exemption Request' with justification e.x "Exemption Request: "
  • OR request clarification by adding a comment containing 'Clarification Request' with a question e.x "Clarification Request: "

This PR will automatically close in 14 days if no action is taken.

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/medium Medium work item – several days 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-s3-deployment): BucketDeployment grants itself wider permissions than needed

3 participants