(cli): Support a least-privilege diff-only IAM role for `cdk diff`
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- aws, typescript
調査の方向性
CDK CLI の cdk diff エントリポイントから開始し、その change-set、deploy-role、asset-publishing ロールの引き受けを追跡します。これらの経路を提案されている diff-role オプションと比較します。完了の定義は、明示的および自動の選択が解決され、cdk diff が、deployment または execute の権限なしに change set と必要なアセットを作成できる least-privilege ロールを使用できることです。
索引モデルが issue の本文から書いたものです。
説明
Describe the feature
There is currently no way to run cdk diff using a read-only or least-privilege IAM role when using the AWS CDK CLI.
Even though cdk diff is a non-deploying operation, the CLI requires permissions equivalent to deployment roles (including assuming deploy and asset publishing roles). This makes it difficult to use cdk diff safely in CI environments.
I am proposing support in the CDK CLI for a diff-only IAM role that allows secure execution of cdk diff without granting full deployment capabilities.
Use Case
In CI pipelines, I want to run cdk diff automatically to provide visibility into infrastructure changes without introducing a manual approval gate.
Using a role with deployment-level permissions in CI is risky: if the workflow is modified or compromised, the role could be abused to deploy or modify infrastructure.
Today, there is no secure alternative:
cdk diffcreates a CloudFormation change set- This requires assuming the deploy role
- For stacks with assets, the CLI also attempts to assume file-publishing and image-publishing roles
As a result, it is currently impossible to run cdk diff with a read-only or least-privilege role using the CDK CLI, unless one builds a custom diff workflow outside the CLI.
Proposed Solution
Add first-class support in the CDK CLI for a diff-only role with limited permissions.
Conceptually, this role would:
- Allow creation of CloudFormation change sets
- Explicitly deny
cloudformation:ExecuteChangeSet - Allow asset-related actions required for diffing:
- S3 uploads for
Code.fromAsset - Optional asset handling only when relevant
- S3 uploads for
- Have no permissions to deploy, update, or delete stacks
Possible implementation approaches:
- Bootstrap an optional
diff-rolealongside existing toolkit roles - Allow explicitly specifying a diff role via CLI flags (e.g.
cdk diff --role-arn ...) - Automatically select a diff role when running
cdk diff
This would preserve accurate change-set–based diffs while significantly improving security for CI usage.
Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
CDK version used
2.1105.0
Environment details (OS name and version, etc.)
Ubuntu 24.04
- 主要言語
- TypeScript
- スター
- 110
- フォーク
- 138
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 55
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
aws/aws-cdk-cli のほかの issue
-
aws-cdk bug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
aws/aws-cdk-cli#2179 ·
メンテナーはふだん 1 日以内に返信
-
(cli): deploy waits forever when an AWS API call gets no response, because requestTimeout only logs a warning対応中かも @abhiramshaji-cyber が 27 日前に担当しました。 オープンaws-cdk bug p2
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
aws/aws-cdk-cli#2097 ·
メンテナーはふだん 1 日以内に返信
-
(bootstrap) FilePublishingRoleDefaultPolicy permission incorrect when FileAssetsBucketKmsKeyId is an ARN value対応中かも @lemon0333 が 95 日前に担当しました。 オープンbug p2
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
aws/aws-cdk-cli#921 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
(garbage-collection): cdk gc takes hours on a large bootstrap bucket対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
aws/aws-cdk-cli#2165 ·
メンテナーはふだん 1 日以内に返信
-
(cli): cdk flags --set always reports no template differences before applying flags対応中かも @go-to-k が 10 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
aws/aws-cdk-cli#2153 ·
メンテナーはふだん 1 日以内に返信
aws/aws-cdk-cli の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
GetStream/stream-chat-react#3467 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
vercel-labs/ui#1139 ·
メンテナーはふだん 1 日以内に返信
-
generate_image reference URL guard lets through IPv4-mapped IPv6 hosts and 100.64.0.0/10対応中かも @goranai が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
bot:ai-assisted component:platform-js status:untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
midnightntwrk/platform-js#93 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100