Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): respect host-stack permissions boundary for ref-time custom resource roles #33467

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jstephenson
Copy link

@jstephenson jstephenson commented Feb 16, 2025

Issue # (if applicable)

Closes #30179

Reason for this change

The permissions boundary applied to a stack is not propagated to roles created by custom resources where these enter the assembly at reference-resolution time. Examples of this are cross-stack references and references to list values which must be JSON stringified.

Presently various custom-resource-backed CDK features cannot be deployed into environments which require a permissions boundary on workload-created roles.

Please see my comment on the issue for a bit more detail.

Description of changes

This change exposes the PB assigned to a stack and uses this to apply a custom resource's host stack PB to its roles.

The change is straightforward but it changes the API surface of Stack, and as such I propose this as a solution sketch and do not expect it to be accepted in its current form. I am not sufficiently familiar with the design of the codebase to know where best to solve this, though, so would welcome contributor/maintainer views.

Some thoughts:

  • PermissionsBoundary is accepted by Stack as a prop as it stands. Perhaps this could be returned from a public field on Stack and plumbed into the proposed solution instead.
  • The ARN calculation logic in Stack could be factored out to somewhere else and used in both places

Describe any new or updated permissions being added

None. Existing PB configuration now respected, however.

Description of how you validated changes

Simple unit tests added

Checklist


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

The permissions boundary applied to a stack is not propagated to roles created
by custom resources where these enter the assembly at reference-resolution
time. Examples of this are cross-stack references and references to list values
which must be JSON stringified.

This change exposes the PB assigned to a stack and uses this to apply a custom
resource's host stack PB to its roles.
@jstephenson jstephenson requested a review from a team as a code owner February 16, 2025 11:05
@aws-cdk-automation aws-cdk-automation requested a review from a team February 16, 2025 11:05
@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p1 labels Feb 16, 2025
Copy link
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.

(This review is outdated)

@kaizencc kaizencc changed the title fix: respect host-stack permissions boundary for ref-time custom resource roles fix(core): respect host-stack permissions boundary for ref-time custom resource roles Mar 7, 2025
@kaizencc kaizencc added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Mar 7, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review March 7, 2025 16:42

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: d47b3cf
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Mar 7, 2025
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 bug This issue is a bug. effort/medium Medium work item – several days of effort p1 pr/needs-maintainer-review This PR needs a review from a Core Team Member pr-linter/exempt-integ-test The PR linter will not require integ test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

core: permissions boundary not being applied to custom resource role
3 participants