Topic lessonTopic: CI/CD design: from checks to release and recovery
CI/CD identity design: jobs, credentials and AWS role permissions
Design CI/CD access by deciding which execution to trust and which operations it may request. A test job need not share deployment credentials. Use a fictional destination to separate executing code, authentication and authorization.
Separate untrusted validation from privileged deployment and explain role trust independently of API permissions.
An IAM role can be assumed to obtain permissions. OIDC communicates an external execution identity. This lesson designs boundaries; the existing OIDC lesson owns the concrete GitHub/AWS setup.
Separate executing code from authenticated identity
Isolate unreviewed code from privileges.
Identify repository, ref and environment.
Only eligible executions may assume the role.
Protect the session while it remains usable.
Evaluate action, resource and conditions separately.
Conceptual authorization boundaries. Establishing identity does not permit every operation.
Code running on a runner is distinct from a person’s interactive sign-in. Review who can edit workflows, which inputs become executed code and what persists on the runner. Reading a repository, proposing a PR and using deployment privileges are different authorities.
I1: separate validation and deployment jobs
| Execution | Required work | Privileges withheld |
|---|---|---|
| External PR validation | Test untrusted changes in isolation; read necessary source. | AWS deployment, secrets or privileged runner access. |
| Trusted-revision build | Produce an artifact from selected source and reviewed inputs. | Administrator rights for hypothetical future work. |
| Eligible deployment job | Send a verified artifact to the designated environment/prefix. | Unrelated buckets, IAM administration or unnecessary deletes. |
If the job only publishes files to a designated prefix, enumerate the actions and resources that work requires. Listing, encryption-key use and other ancillary privileges depend on the delivery method; do not add broad permissions without justification. This is not a complete live policy.
Credential type alone does not define allowed operations
| Material | Role | Boundary to inspect |
|---|---|---|
| GITHUB_TOKEN | GitHub API token for a job. | Needed repository permissions; not an AWS API credential. |
| OIDC identity token | Communicate identity and context to an external party. | Issuer, audience and subject conditions; requesting a token differs from AWS access. |
| Temporary AWS credentials | Make AWS requests through an authorized role session. | Lifetime, role privileges, resource and additional restrictions. |
| Long-lived access key | Credential usable until expiry or revocation as applicable. | Storage, exposure, rotation and eliminating unnecessary keys. |
Where OIDC federation fits an external CI-to-AWS design, it avoids storing a long-lived AWS key in CI. Broad trust or excessive role permissions still create exposure. Short-lived credentials must not be printed into logs.
I2: role assumption is followed by authorization
I2 trusts only a specified deployment context in owner/repository. An external-PR validation context is excluded even within that repository. Verify the actual subject format and environment protections for the configuration and current documentation instead of copying a generic subject string.
| Request | I2 outcome | Reason |
|---|---|---|
| External-PR validation attempts role assumption | Ineligible | Not the trusted deployment context. |
| Eligible job writes intended publication files | Evaluate both trust and API authorization | Assumption and writing are separate; no live success is asserted. |
| Same job edits IAM roles | Not granted as required work | Unneeded for file delivery; short lifetime does not justify administration. |
An authenticated job can still select the wrong artifact. Verify provenance and content associations so it does not deploy another run’s output or modified bytes. Identity and artifact verification complement each other.
Describe the permission path before implementation
- Identify who can change code, workflows and dependencies.
- Separate untrusted execution from deployment.
- Define trusted repository, revision and environment context.
- Specify required actions, resources, conditions and lifetime.
- Inspect obsolete credentials, logs and persistent runner state.
- Define allow/deny cases and verify results with records.
Use the related GitHub Actions/AWS OIDC lesson for concrete setup details. This page teaches permission boundaries and neither accepts nor stores live tokens, policies or credentials.
Check trust and authorization boundaries
Choose an option to see the result and explanation.
Check, then explain in your own words
- Separate I1 validation and deployment privileges.
- Distinguish the three token/credential purposes.
- Explain I2 eligible and ineligible requests.
- Verify both execution identity and artifact selection.
Check your understanding: Role trust allowed assumption. Must every desired API request succeed?
No. Requests remain subject to role permissions, resources, conditions and other restrictions. Also check artifact selection and excessive privileges even for an eligible job.
Connect trusted identity, allowed operations and selected artifact with distinct evidence.
Sources and conditions checked
The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.
Scope and conditionsWeb identity token exchange for temporary credentials without pre-existing AWS credentials for the request. Documentation review, not live-environment validation.
Used in this lessonSeparate executing code from authenticated identity Credential type alone does not define allowed operations
Scope and conditionsProvider, role trust, subsequent permissions and GitHub subject restrictions. Documentation review, not live-environment validation.
Used in this lessonSeparate executing code from authenticated identity
- GitHub: Secure use referenceChecked:
Scope and conditionsImmutable action references plus review, and separation of untrusted code/input from privileges. Documentation review, not live GitHub/AWS validation.
Used in this lessonSeparate executing code from authenticated identity Describe the permission path before implementation
- GitHub Actions: GITHUB_TOKENChecked:
Scope and conditionsPer-job repository-scoped token, distinct from AWS credentials. Documentation review, not live-environment validation.
Used in this lessonCredential type alone does not define allowed operations
Scope and conditionsIssuer, audience, subject contexts and immutable formats introduced after July 15, 2026; GHES differs. Documentation review, not live-environment validation.
Used in this lessonCredential type alone does not define allowed operations I2: role assumption is followed by authorization
Scope and conditionsAudience and subject in the documented AWS integration; arbitrary custom claims are not assumed supported. Documentation review, not live-environment validation.
Used in this lessonCredential type alone does not define allowed operations I2: role assumption is followed by authorization
- GitHub: Managing environmentsChecked:
Scope and conditionsEnvironment protections and secret access; plan/visibility availability and administrator bypass configuration differ. Documentation review, not live GitHub/AWS validation.
Used in this lessonI2: role assumption is followed by authorization