feat: Add GitHub Actions OIDC ID token support #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Implements in-process OIDC (OpenID Connect) server to enable keyless authentication for supply chain security tools like SIGSTORE and Witness when running workflows locally with act.
Motivation
GitHub Actions provides OIDC ID tokens through environment variables (
ACTIONS_ID_TOKEN_REQUEST_URLandACTIONS_ID_TOKEN_REQUEST_TOKEN) to enable keyless authentication with external services. This is critical for supply chain security tools like:Without this feature, these tools cannot be tested locally with act.
Implementation
Architecture
The implementation integrates OIDC endpoints into act's existing artifacts server (in-process, no separate service required):
ACTIONS_ID_TOKEN_REQUEST_TOKEN(HMAC-signed JWT) containing all GitHub context/tokenwith the request token/.well-known/jwksKey Components
pkg/common/oidc.goCreateOIDCRequestToken(): Generates request tokens with GitHub contextParseOIDCRequestToken(): Extracts context from request tokensGenerateOIDCToken(): Creates RS256-signed ID tokensGenerateJWKS(): Publishes public keys for token verificationGitHubOIDCClaims: Complete struct with 31 claims matching GitHub's official schemapkg/artifacts/server.goPOST /token: Issues OIDC ID tokens (with optional?audience=parameter)GET /.well-known/jwks: Serves public key setpkg/runner/run_context.goACTIONS_ID_TOKEN_REQUEST_URLandACTIONS_ID_TOKEN_REQUEST_TOKENenvironment variables in workflow containerscmd/root.goToken Schema Compliance
The implementation generates tokens that exactly match GitHub's official OIDC schema:
token.actions.githubusercontent.com/.well-known/openid-configurationStandard JWT Claims
iss:https://token.actions.githubusercontent.comsub:repo:{owner}/{repo}:ref:{ref}aud: Configurable audienceexp,nbf,iat,jti: Standard time/ID claimsGitHub-Specific Claims
workflow,workflow_ref,workflow_sha,job_workflow_ref,job_workflow_sharepository,repository_id,repository_owner,repository_owner_id,repository_visibilityrun_id,run_number,run_attempt,event_name,ref,ref_type,ref_protectedactor,actor_idhead_ref,base_refrunner_environment,shaTesting
Unit Tests
pkg/common/oidc_test.go: Tests for all token generation functionspkg/artifacts/oidc_test.go: Integration tests for HTTP endpointsExample Usage
Running Tests
Compatibility
Security Considerations
Related Work
This implementation was validated against:
🤖 Generated with Claude Code