Skip to content
Launchr Space Journal

Engineering Analysis · Global

Before rotating a CI key, test who can deploy

Replace long-lived deployment keys with short-lived credentials, then prove the wrong job cannot access production.

By Launchr Space ·

Illustration: Job identity → Trust check → Narrow role.
Illustration: Job identity → Trust check → Narrow role.

When a deployment key is stored as a long-lived secret, rotating it can break a pipeline you rarely run. GitHub Actions can instead use OpenID Connect to exchange proof of a job’s identity for a short-lived credential from a cloud provider. The migration is a chance to ask a more important question: which jobs should be able to deploy in the first place?

The provider decides which token claims it trusts and what a role can do after the exchange. GitHub documents claims describing the repository, job context and environment. A short lifetime reduces the exposure window, but it does not reduce the permissions attached to a role or make a permissive trust rule acceptable.

Inventory real deployers before changing policy

List the workflows that reach staging and production, including rollback, scheduled work and manual recovery. Keep a separate role for each environment and grant only the resources and operations that deployer needs. Limit token issuance to the deploy job, keep untrusted build work separate, and restrict which branches or tags can use the protected environment. Match the exact documented claim that your provider supports; an environment-bound subject and a branch-bound subject are not interchangeable.

Make denial an expected result

In a non-production account, exercise the intended repository and environment, then run an equivalent dry test from a context that should not be trusted. Check that the provider denies credential exchange and that the allowed role cannot access an unrelated resource. Keep the test narrow and use identities and resources you control. Verify the relevant provider audit event without printing raw tokens or credentials to logs.

Remove the old route after proving recovery

Run one end-to-end deployment and one rollback with the new role. Confirm that the production role is not used to ship a preview and that the previous key is not still required by a separate manual script. Then retire the old key rather than leaving it indefinitely as a silent fallback. Document which team owns the cloud-side trust and record the change in the same review that owns the workflow.

Sources

Keep reading