Zero-trust CI/CD: no stored keys, only signed images ship
GitHub Actions hardened with OIDC federation to AWS and Azure, 15-minute credentials scoped to one repository and environment, CycloneDX SBOMs, and Sigstore Cosign signatures verified before deployment.
- Role
- Pipeline design, Terraform and supply-chain security
- Period
- 2026
- Status
- Public reference implementation
- Problem
- Long-lived cloud credentials in CI secrets leak through pull-request injection, debug logs and compromised runners, and carry broad privileges.
- Key decision
- Federate GitHub OIDC tokens with AWS and Entra ID trust policies that match the exact repository and protected environment, and gate deployment on a verified Cosign signature.
- Result
- No static cloud secrets in the pipeline, credentials that expire after 15 minutes, and images that cannot be deployed unless their signature verifies.
Architecture
Components and flows as text
| Component | Kind | Technology | Flows out |
|---|---|---|---|
| Developer | client | push / tag | ⇢ GitHub Actions: commit |
| GitHub Actions | pipeline | secure-deploy.yml | ⇢ GitHub OIDC issuer: request JWT; ⇢ AWS STS / Entra ID: exchange JWT; → GHCR + Sigstore: push signed image; ⇢ Cloud target: deploy after verify |
| GitHub OIDC issuer | external service | token.actions.githubusercontent.com | — |
| AWS STS / Entra ID | secret store | trust: exact repo + environment | ⇢ GitHub Actions: 15-min credentials |
| GHCR + Sigstore | datastore | signed digest · CycloneDX SBOM | — |
| Cloud target | service | least-privilege deployer role | — |
Trust boundaries: Protected production environment (GitHub Actions).
Decisions
OIDC federation instead of access keys
The runner requests a GitHub-signed JWT and exchanges it with AWS STS or Entra ID for short-lived credentials. The trust policy requires the exact repository and the protected production environment.
Options considered
- Access keys in repository secrets: simple, long-lived, and readable by any compromised step.
- Federated identity scoped by claims.
Trade-off accepted
Trust policies must be maintained per repository and environment.
Sign, attest and verify before deploy
Each build produces a CycloneDX SBOM; the image digest is signed and attested keylessly with Cosign and verified against the workflow identity before the deploy step runs.
Options considered
- Trust the registry: anyone with push access can ship.
- Verify provenance cryptographically.
Trade-off accepted
Adds steps and a dependency on Sigstore infrastructure.
Failure modes
| Failure | Detection | Handling | Evidence |
|---|---|---|---|
| A fork or another branch tries to assume the deploy role | STS rejects the token because the subject claim does not match | Trust is bound to repository and environment | terraform/ |
| A tampered image is pushed to the registry | cosign verify fails | The deploy step never runs | secure-deploy.yml |
What I would change next
- Enforce signature verification in-cluster with an admission controller.
Evidence index
Links point to the public repository.