INFRASTRUCTURE LEARNINGINFRASTRUCTURE LEARNING
インフラ大全インフラ大全IT INFRASTRUCTURE / LEARNING
Infrastructure learning guide
Find a lesson or lab/

Esc to close · Search terms stay on your device

LEARNING日本語

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.

What you will learn

Separate untrusted validation from privileged deployment and explain role trust independently of API permissions.

Prerequisite

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

Five boundaries in a deployment request
CODE
Code to execute

Isolate unreviewed code from privileges.

JOB
Execution context

Identify repository, ref and environment.

TRUST
Identity trust

Only eligible executions may assume the role.

SESSION
Temporary credentials

Protect the session while it remains usable.

OPERATION
Resource operation

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

Fictional publication-file destination
ExecutionRequired workPrivileges withheld
External PR validationTest untrusted changes in isolation; read necessary source.AWS deployment, secrets or privileged runner access.
Trusted-revision buildProduce an artifact from selected source and reviewed inputs.Administrator rights for hypothetical future work.
Eligible deployment jobSend 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

Credential purposes and risks
MaterialRoleBoundary to inspect
GITHUB_TOKENGitHub API token for a job.Needed repository permissions; not an AWS API credential.
OIDC identity tokenCommunicate identity and context to an external party.Issuer, audience and subject conditions; requesting a token differs from AWS access.
Temporary AWS credentialsMake AWS requests through an authorized role session.Lifetime, role privileges, resource and additional restrictions.
Long-lived access keyCredential 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.

Read three requests separately
RequestI2 outcomeReason
External-PR validation attempts role assumptionIneligibleNot the trusted deployment context.
Eligible job writes intended publication filesEvaluate both trust and API authorizationAssumption and writing are separate; no live success is asserted.
Same job edits IAM rolesNot granted as required workUnneeded 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

  1. Identify who can change code, workflows and dependencies.
  2. Separate untrusted execution from deployment.
  3. Define trusted repository, revision and environment context.
  4. Specify required actions, resources, conditions and lifetime.
  5. Inspect obsolete credentials, logs and persistent runner state.
  6. 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.

Should I1 external-PR validation receive AWS deployment privileges?
Read the answer and reason

Answer: No; isolate privileges needed for validation. · Keep unreviewed code outside the deployment trust boundary.

Does id-token: write alone permit writes to a publication bucket?
Read the answer and reason

Answer: No; role trust and write authorization remain separate. · Identity evidence does not automatically establish AWS authorization.

Are short-lived administrator credentials sufficient for a file-delivery-only job?
Read the answer and reason

Answer: No; restrict actions and resources to required work. · Short lifetime and least privilege solve different problems.

An authenticated deployment job fetches A. May it count as deploying candidate B?
Read the answer and reason

Answer: No; match the candidate artifact and provenance too. · Artifact identity must be verified in addition to authentication and authorization.

Check, then explain in your own words

  1. Separate I1 validation and deployment privileges.
  2. Distinguish the three token/credential purposes.
  3. Explain I2 eligible and ineligible requests.
  4. 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.