Skip to content
Enterprise Tech Logic

Independent analysis for technology leaders

Cybersecurity

GitHub Actions OIDC: remove the secret without widening cloud access

A DevOps guide to replacing stored AWS keys with OIDC while restricting the repository, deployment context and cloud permissions that can release to production.

By Enterprise Tech Logic

Enterprise technology, security and IT leadership

· 5 min read

Laptop displaying code on a desk

At a glance

  • Token permission, role trust and cloud permissions are separate.
  • Match the repository’s actual subject format and deployment context.
  • Test rejected callers as well as successful releases.

Removing the AWS access key from GitHub Actions is a useful security improvement. It is also an opportunity to discover how many workflows were relying on the same identity. For the DevOps lead, the difficult part of adopting OpenID Connect is deciding exactly which release jobs should inherit that access.

A migration is incomplete if it replaces one stored credential with a trust policy that accepts every repository in the organisation. The operational goal is a deployment route that remains easy to run and difficult to invoke from the wrong context.

Separate the three permissions questions

GitHub’s AWS integration lets a workflow obtain an OIDC token and exchange it for short-lived AWS access through aws-actions/configure-aws-credentials. The job needs id-token: write to request that token. GitHub explicitly notes that this setting does not itself authorise writes to cloud resources.

There are three distinct decisions: can the job request a token; will AWS accept its identity for a particular role; and what can that role do? Treating them as one “OIDC enabled” setting makes review unnecessarily vague.

AWS distinguishes the role’s trust policy from its permissions policy. The first controls who may assume it; the second defines the permitted AWS actions and resources. A carefully restricted deployment identity can still be excessively powerful after assumption. Equally, a narrowly permissioned role can be exposed to too many callers.

Use that separation in the design review. The platform team should be able to name the accepted workflow context and explain each cloud capability independently. “It deploys the application” is insufficient if the role also permits unrelated administrative work inherited from the old IAM user.

Match the identity your job actually presents

For the standard AWS integration, GitHub documents the audience as sts.amazonaws.com and recommends checking the token’s sub claim in the IAM trust policy. A branch-based subject and an environment-based subject are different. When a job references a GitHub environment, the subject includes that environment rather than simply expressing the branch.

This makes the environment configuration part of the access boundary. A production role tied to a production environment depends on meaningful controls over which branches or tags can deploy there. GitHub recommends environment protection rules alongside OIDC; the name “production” alone does not express your release policy.

Do not copy an old subject string without checking the repository’s current configuration. GitHub’s OIDC reference says repositories created after 15 July 2026 use an immutable default subject format containing owner and repository IDs. Older repositories retain the previous format unless opted in; renames and transfers after that date also move to the immutable format. The rollout excludes GitHub Enterprise Server.

The practical implication is to inspect the expected claim structure for the repository and deployment context before finalising the trust condition. Verify selected non-secret claim values in a controlled diagnostic step; do not print the complete bearer token into job logs. Keep any subject-format migration coordinated with the cloud policy change, so a security improvement does not unexpectedly stop releases.

A successful deployment is only half the proof

Consider a hypothetical organisation with separate application and documentation repositories. Its application release job should update the production service. Its documentation build should have no route into that production role, even though both repositories have the same owner.

The acceptance exercise should include the intended production job and several nearby cases that must fail: a job in the documentation repository, an unapproved application branch, and a job that does not meet the required environment conditions. If the legitimate job succeeds and these alternatives are denied for the expected reason, the team has evidence about the boundary rather than merely connectivity.

Then test the permission boundary after successful assumption. Use a harmless permitted action against the deployment target and a harmless check against an unrelated target that should be denied. Run these exercises in an isolated setup with representative policies before changing production. They are design checks, not a reason to broaden access until every diagnostic command works.

AWS rejects GitHub trust policies whose subject condition is missing, null or solely a wildcard. That validation is useful, but it does not decide which of your organisation’s repositories ought to release to production. A policy may satisfy the platform’s basic validation and still admit more of your workflows than the business intends.

Keep exceptions from becoming the standard route

Some migrations stall because a shared release workflow serves several teams. Resist resolving that complexity with a single organisation-wide production role. First identify whether the jobs genuinely need the same resources and approval path. Separate roles can make ownership and incident containment clearer, even if a shared workflow implements the mechanics.

Record the small set of facts that lets an operator understand the relationship: repository, deployment context, cloud role, permitted targets and accountable owner. Make changes to those facts part of normal release-platform maintenance. A repository transfer, environment rename or new deployment target deserves an access review rather than an emergency wildcard.

Retire the superseded long-lived credential after verifying that all legitimate consumers have migrated. Leaving it available indefinitely preserves a second route that the new trust policy does not govern. Where a fallback is necessary during transition, give it an owner, an explicit removal condition and a short review interval.

This deployment-specific work belongs within non-human identity ownership and lifecycle management. The connection matters because the release team may change while the cloud role continues to exist.

Start with one production deployment whose current credential is shared. Map its legitimate consumers, define the narrow replacement identity and test the allowed and denied paths before removing the old key. The result should be a smaller, explainable access relationship that the next platform engineer can maintain.

Your next step

Non-human identities need an owner beyond the next secret rotation

Place deployment roles within non-human identity ownership and lifecycle management.

Read the guide

Keep reading

Related insights