Skip to content

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

Closed
jstephenson wants to merge 2 commits intoaws:mainfrom
jstephenson:propagate-perm-boundary-to-custom-res
Closed

fix(core): respect host-stack permissions boundary for ref-time custom resource roles#33467
jstephenson wants to merge 2 commits intoaws:mainfrom
jstephenson:propagate-perm-boundary-to-custom-res

Conversation

@jstephenson
Copy link
Copy Markdown

@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
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.

(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
Copy Markdown
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
@godwingrs22 godwingrs22 added the skip-abstractions-board signal to automated workflow to skip adding to project board label Mar 18, 2025
@kaizencc
Copy link
Copy Markdown
Contributor

kaizencc commented Mar 4, 2026

Thank you for this PR @jstephenson. As you can see, I haven't had time to dive deep into the initial problem or your potential solution (which you admit isn't ready for prime time in its current form). What needs to happen is for us to properly investigate the issue and then follow the idea you've proposed here, but this effort is not prioritized at the moment. I am going to close this PR to keep our open PR list somewhat cleaner; this PR can always be revived if/when we decide to invest in a solution for #30179. Sorry for the disappointing news.

@kaizencc kaizencc closed this Mar 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 4, 2026

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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 skip-abstractions-board signal to automated workflow to skip adding to project board

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core: permissions boundary not being applied to custom resource role

6 participants