ADR 0005: GitHub OIDC deploy role model
Status: accepted
Context
CI needs to deploy CDK apps into AWS accounts. Long-lived access keys and administrator roles are the two most common shortcuts and both are unacceptable for an open-source default.
Decision
AccountBaselinecreates the GitHub OIDC provider once per account and one deploy role per repository and environment.- Trust policies use the
subclaim:repo:<owner>/<repo>:pull_requestfor preview roles,repo:<owner>/<repo>:environment:<env>for environment roles, and optionallyrepo:<owner>/<repo>:ref:refs/heads/<branch>.- Amendment (October 2026): repositories created after 15 July 2026 use GitHub's immutable subject,
repo:<owner>@<owner-id>/<repo>@<repo-id>:.... When a repository is configured withownerIdandrepoId, its roles trust only that form.
- Amendment (October 2026): repositories created after 15 July 2026 use GitHub's immutable subject,
- Deploy roles are least privilege: they may only
sts:AssumeRoleinto the CDK bootstrap roles (cdk-<qualifier>-deploy-role,file-publishing-role,image-publishing-role,lookup-role) for the account, and read CloudFormation stack descriptions and outputs. The CDK deploy role's own permissions define what CloudFormation may do. - A separate read-only role (
lookup-roleonly, plus describe permissions) is created forcdk diffon pull requests. - Role ARNs are published to SSM and surfaced as GitHub repository variables; workflows never contain account ids.
Consequences
- Compromise of a CI token cannot exceed what the CDK bootstrap roles allow.
- Users who need broader access can pass an explicit policy or a permissions boundary, but must opt in.