CI/CD & GitHub Actions (50 Qs)•Part 2: Advanced Workflows, Security & Containerization (Mid-Level)
How does Keyless Cloud Authentication work with OpenID Connect (OIDC)?
mid LevelCode ExampleSecurity & AuthDocker & Containers
In Simple Words: Traditionally, CI pipelines needed hardcoded, long-lived AWS IAM access keys stored in GitHub Secrets. If leaked, attackers gained persistent cloud access. With OIDC, GitHub acts as an Identity Provider (IdP):
- The GitHub Runner requests a short-lived JSON Web Token (JWT) from GitHub's OIDC provider.
- The runner presents this JWT to AWS Security Token Service (STS) or Google Cloud Workload Identity.
- The cloud provider validates the token signature and repository claims (
repo:org/app:ref:refs/heads/main). - If valid, the cloud provider issues temporary credentials (valid for 1 hour) without storing any static secrets in GitHub!
yaml
permissions:
id-token: write # Mandatory for requesting OIDC JWT
contents: read
steps:
- name: Configure AWS Credentials with OIDC
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::123456789012:role/GitHubActionsDeployRole
aws-region: us-east-1