pipeline.deploy.no-long-lived-cloud-keys
Deployments authenticate with short-lived credentials
CI jobs obtain cloud credentials by assuming a role at run time; no IAM user access key exists for pipeline use.
Assertion
count(access keys on users tagged purpose=ci) == 0 and every session of the deployment role in the window originated from AssumeRoleWithWebIdentityRationale
The credentials a pipeline deploys with are the most valuable secret in the organisation: they can change production. An IAM user access key stored in the forge’s secret store is long-lived, is readable by anyone who can edit a workflow in that repository, and keeps working after the person who created it has left. A role assumed at run time through the forge’s identity provider exists for the duration of one job, is bound to one repository and branch, and leaves a CloudTrail record of exactly which run used it.
Observation
The collector has two halves. The first lists IAM users tagged for pipeline
use and their access keys; the assertion requires none to exist. The second
reads CloudTrail for every session of the deployment role in the collection
window and checks that each originated from AssumeRoleWithWebIdentity, the
API that OIDC federation uses, rather than from AssumeRole with a user’s
long-lived key. A session of the deployment role that cannot be traced to a
workflow run fails the control.
This control is planned. Its collector is defined but not yet scheduled, so no claim is made about any pipeline until it is.
Remediation
Register the forge as an OIDC identity provider in the account, create a
role whose trust policy limits sub to the repository and branch that
deploys, and have the workflow assume it. Then delete the user’s access
keys and the user. The deployment workflow in each repository already
obtains credentials through a shared setup step, so the change is made in
one place.