Octo STS Overview
Learn about Octo STS, an open source security token service for GitHub that uses OIDC federation to eliminate long-lived …
This page answers frequently asked questions about Octo STS, including setup, security, troubleshooting, and common use cases.
Octo STS is a GitHub App developed by Chainguard that acts as a Security Token Service for GitHub. It allows workloads with OIDC tokens from various identity providers (GitHub Actions, cloud providers, Kubernetes, etc.) to exchange those tokens for short-lived GitHub access tokens. The primary goal is to eliminate the need for long-lived Personal Access Tokens (PATs).
Personal Access Tokens pose security risks as they allow provide persistent access to resources and are not tied to a given workload. Attackers regularly abuse leaked PATs to gain access to systems and resources.
By comparison, Octo STS tokens are short-lived (1 hour) and typically tightly scoped to the workload in question. This vastly reduces the scope for abuse.
GitHub Actions provides a GITHUB_TOKEN automatically, but it has limitations:
Octo STS tokens can:
Yes, Octo STS is open source and the hosted service at octo-sts.dev is free to use. You can also self-host Octo STS if you prefer.
Yes, Octo STS is open source and can be self-hosted. See the Octo STS repository for deployment instructions.
Install the GitHub App:
Then create trust policies in your repositories at .github/chainguard/{name}.sts.yaml.
Octo STS requests a superset of permissions to support a large range of use cases. However, it only creates tokens with the specific permissions defined in your trust policies. The app needs contents: read to read trust policy files, but all other permissions are only granted based on your policies.
If you install Octo STS but don’t create trust policies, the app cannot issue any tokens. Trust policies are required to specify which identities are trusted and what permissions to grant them.
Yes, Octo STS works with both public and private repositories. The app needs access to read the repository’s trust policy files.
Edit the trust policy file in your repository, commit, and push the changes. The new permissions take effect immediately for subsequent token exchanges. Existing tokens retain their original permissions until they expire.
Yes, you can create multiple policy files with different names:
.github/chainguard/renovate.sts.yaml.github/chainguard/deploy.sts.yaml.github/chainguard/ci.sts.yamlEach policy can have different identity requirements and permissions. Specify which policy to use via the identity parameter when exchanging tokens.
Octo STS tokens are as safe as the trust policies you create. They’re short-lived (1 hour), reducing the window of opportunity if compromised.
No. Branch protection rules are enforced by GitHub regardless of the token type. Even with contents: write permission, Octo STS tokens must follow branch protection requirements like pull request reviews and status checks.
Prefer exact subject matching when possible:
# Better: Exact match
subject: repo:org/repo:ref:refs/heads/mainUse pattern matching only when you need flexibility:
# When necessary: Pattern match
subject_pattern: "repo:org/repo:ref:refs/heads/.*"Exact matching is more secure because it’s harder to accidentally grant broader access than intended.
Yes, Octo STS works with any system that can:
The key is having an OIDC identity provider that Octo STS can validate.
Use Terraform’s external data source to exchange tokens:
data "external" "github_token" {
program = ["bash", "-c", <<-EOT
OIDC_TOKEN=$(get_oidc_token)
RESPONSE=$(curl -s -H "Authorization: Bearer $OIDC_TOKEN" \
"https://octo-sts.dev/sts/exchange?scope=org/repo&identity=terraform")
echo $RESPONSE | jq '{token: .access_token}'
EOT
]
}
provider "github" {
token = data.external.github_token.result.token
}Yes, use organization trust policies with a repositories field:
issuer: https://token.actions.githubusercontent.com
subject: repo:org/automation-repo:ref:refs/heads/main
permissions:
contents: read
repositories:
- org/repo-one
- org/repo-two
- org/repo-threeThe resulting token can access all listed repositories.
Common causes:
.github/chainguard/{identity}.sts.yamlBy default, tokens expire after 1 hour.
No, Octo STS tokens cannot be refreshed. When a token expires, exchange a new OIDC token with Octo STS to obtain a new GitHub token. This is intentional - short-lived tokens should be regularly renewed.
Octo STS periodically adds or removes GitHub permissions to support new use cases. When this happens:
Yes, you can use both during a transition period. This allows gradual migration and rollback capability if issues arise.
Report bugs in the Octo STS GitHub repository.
Octo STS is open source. Contributions are welcome:
See the repository for contribution guidelines.
Last updated: 2025-12-22 15:04