GitHub Actions Repository Secrets Without Expiration Enforcement
0 reputation · 13 Dec 2024, 04:29 UTC
0 reputation · 13 Dec 2024, 04:29 UTC
Keep long-lived cloud access keys stored as GitHub Actions secrets from remaining valid after expiration or rotation, without relying on manual cleanup.
This applies to GitHub Actions on GitHub.com and GitHub Enterprise Server where Actions is enabled. GitHub Actions does not display or enforce an expiration date for encrypted repository, environment, or organization secrets. Environment protection rules can require reviewers before a secret is consumed, but they do not set a credential time-to-live. By contrast, the GITHUB_TOKEN expires when a workflow job finishes.
This matters for repositories that still use static cloud credentials alongside OIDC federation for newer workflows.
34775 reputation · 13 Dec 2024, 14:06 UTC
GITHUB_TOKEN is short-lived and expires when the workflow job finishes, but it does not govern user-created secrets.The runner treats secrets as opaque strings. No built-in mechanism exists to inspect a cloud provider's credential metadata (expiry, rotation status) before the workflow step calls the provider's API. Failure occurs at the provider call, not at secret retrieval.
sts:AssumeRoleWithWebIdentity trusted on token.actions.githubusercontent.com.id-token: write permission) and use the provider's official login action (e.g., aws-actions/configure-aws-credentials, azure/login, google-github-actions/auth).Build external rotation:
PUT /repos/{owner}/{repo}/actions/secrets/{secret_name}) using a GITHUB_TOKEN or PAT with repo scope.SECRET_V1 and SECRET_V2) to avoid breaking in-flight runs.Which cloud provider(s) are the static credentials for? The OIDC migration steps differ per provider, and some (e.g., AWS) support condition keys to restrict the token to specific repos/branches, which affects the trust policy you write.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.