in this guide
  1. who can read a pipeline secret
  2. the pull request that runs as you
  3. keys with no end date
  4. swap stored keys for short-lived ones
  5. what a short-lived token does not fix
  6. who owns this at your size

A deploy has to log in somewhere. So at some point a developer pasted a cloud access key, an npm publish token or an SSH deploy key into the CI settings, gave it a name like AWS_SECRET_ACCESS_KEY, and the pipeline has used it on every run since. Nobody types that key again. Nobody sees it in a password manager. It sits in the build system with write access to production, and it works whether the person who pasted it is still at the company or left two years ago.

The question this guide answers is who can read it. GitHub’s own security reference for Actions is blunt: anyone with write access to a repository can read every secret configured in it. So can any third-party action the workflow calls, any install script a build step runs, and anyone who can change what the workflow does. The pipeline is an identity with production rights, and its keys are readable by a much wider circle than the people who would be allowed to hold them.

This is the pipeline layer of the GitHub identity audit. It pairs with the token that lives forever: a pipeline key is one of those tokens, only with a deploy button attached. The examples are GitHub Actions because the documentation is public and detailed; the same questions apply to any CI system.

On the record: Nx (s1ngularity), 2025 and Cline, 2026.

who can read a pipeline secret

GitHub masks secrets in the logs it shows. Code running inside the job still sees the real value, because the job needs it to deploy.

who can reach a secret stored in a GitHub Actions pipeline

  • anyone with write accesscan edit a workflow to use the secret, per GitHub's secure-use reference
  • every third-party action in the joba compromised action has access to all secrets configured on the repository, per the same reference
  • every package the build installsinstall scripts run inside the job, next to the secret
  • a pull request on a privileged triggerpull_request_target runs with the base repository's secrets
  • pull requests from forks, by defaultsecrets are not passed to forked workflows, apart from the built-in token
  • the CI vendor itselfa breach there reaches what you stored there

can read the secretkept out by default

Write access is secret access. At a software company, write access to the main repository can cover most of the engineering team, plus contractors. Each of those accounts, and each personal access token those accounts have created, can change a workflow file to print or send a secret. Organisation secrets can be limited to a list of named repositories, per GitHub’s documentation, which shrinks the circle to the repositories that deploy.

Actions and packages run with the same rights as your code. In March 2025 CISA warned that the compromise of tj-actions/changed-files, an action used in many pipelines, exposed secrets including access keys, GitHub personal access tokens, npm tokens and private RSA keys, and told users to rotate any secret it found. The tj-actions case covers how version tags were moved. GitHub’s reference recommends pinning actions to a full commit hash, and the repository settings include an option to require it.

Masking has limits. GitHub’s reference notes that structured data can cause redaction in logs to fail. A secret printed as part of a JSON blob or encoded once can come out readable.

The vendor holds a copy. CircleCI’s incident report of January 2023 says malware on an engineer’s laptop stole a single sign-on session backed by two-factor authentication, and that customer environment variables, keys and tokens were taken. The data was encrypted, but CircleCI says the attacker extracted the encryption keys from a running process. Every customer was asked to rotate every secret. The CircleCI case has the timeline, and the laptop guide explains why an engineer’s signed-in laptop is worth so much to an attacker.

the pull request that runs as you

The defaults on GitHub are careful about strangers. A workflow triggered by a pull request from a fork gets no secrets and a read-only token, and first-time contributors need approval before their workflows run at all, according to GitHub’s repository settings documentation. Two switches undo this.

The pull_request_target trigger. It exists so that a workflow can label or comment on a contributor’s pull request, which needs write rights. GitHub Security Lab explained in August 2021 that it runs in the context of the target repository, with write permission and access to secrets, and called combining it with a checkout of the pull request’s code “a dangerous practice”. GitHub’s current reference says to avoid it with untrusted pull requests or code.

Three projects learned this the expensive way:

  • Nx, August 2025. A workflow on pull_request_target placed the pull request’s title inside a shell command, with a read/write token. Nx’s advisory says it believes an attacker used it to send the npm publish token to a webhook, and notes that reverting the workflow on the main branch was not enough because older branches still carried it. The Nx incident has the full story.
  • PostHog, November 2025. PostHog’s post-mortem says a workflow had been switched to pull_request_target in September 2025 while still running code from the pull request. A pull request on 18 November changed that code to post secrets to an attacker’s webhook. With a stolen bot token, the attacker then pushed a commit that changed another workflow to send out every GitHub secret in the CI runners, including the npm publish token. Twelve hours later, on 24 November 2025, malicious PostHog packages went out in the second Shai-Hulud wave. PostHog writes that the trigger “only ensures the workflow is being run as defined in the PR target”, and that a static analysis alert on the change had been dismissed.
  • TanStack, May 2026. Covered below, because it beat a pipeline that had already removed its tokens.

The private repository settings. For private repositories GitHub offers two options that send write tokens and secrets to workflows from fork pull requests. The second, per GitHub’s documentation, makes all secrets available to the pull request. If a contractor or a partner can open pull requests from a fork, those switches decide what they can reach.

keys with no end date

Some pipeline credentials outlive everything around them.

Deploy keys. GitHub’s documentation says a deploy key is an SSH key for a single repository, read-only by default. With write access it can do what an organisation member with admin access can do. It is not tied to organisation membership, it stays active when the person who created it is removed from the repository, and it has no expiry date. GitHub itself recommends a GitHub App instead, whose tokens are scoped and expire.

Cloud keys in secrets. A cloud access key stored as a pipeline secret can belong to a cloud user created for CI years ago, sometimes with broad rights so that the first deploy would not fail. It is a service account that can escape review because it lives in two places at once: the cloud console and the CI settings.

The built-in token. Each GitHub Actions run gets a GITHUB_TOKEN. GitHub’s changelog of 2 February 2023 says new organisations and repositories default to a read-only token from then on, and that existing enterprises, organisations and repositories keep their setting. An organisation created before February 2023 may still hand every workflow a read and write token unless someone changed the setting.

swap stored keys for short-lived ones

The cloud providers and GitHub now document a way to deploy without storing a cloud key at all. GitHub calls it OpenID Connect: the workflow asks GitHub for a signed token that says which repository, branch and environment it is running in, and the cloud provider exchanges it for credentials valid only for that job. Nothing long-lived sits in the CI settings to steal.

two ways a pipeline can log in to the cloud

federated login (OIDC)

a token minted per job

  • Nothing stored in the CI settings
  • Credentials valid for one job
  • The cloud checks the repository and branch before issuing
  • Leaked value expires on its own

a stored key

the common setup

  • Pasted once into the CI settings
  • Valid until someone rotates it
  • Works from any machine that has a copy
  • Outlives the person who created it

Each cloud documents it:

  • AWS. The IAM user guide says a role trusted by GitHub must check the sub claim, and IAM rejects a trust policy where that check is missing or a bare wildcard. Its warning is direct: without a limit to your organisation or repository, GitHub Actions from organisations you do not control can assume the role. AWS recommends limiting it to specific repositories or branches. The console leaves repository and branch as wildcards if you skip those fields.
  • Microsoft. Entra workload identity federation supports GitHub Actions and describes stored app secrets and certificates as a security risk that must be stored securely and rotated. The issuer, subject and audience must match exactly.
  • Google Cloud. Its documentation for deployment pipelines says you must use a condition that restricts access to tokens issued by your GitHub organisation, and advises matching on numeric IDs, since names can be typosquatted.
  • npm. Trusted publishing lets GitHub Actions, GitLab CI/CD and CircleCI cloud publish with short-lived tokens tied to a workflow. npm recommends restricting token-based publishing once it works. Nx’s advisory says it moved its packages to it after its incident, and PostHog’s post-mortem says it is moving its release packages to it.

A federated login is only as narrow as the condition someone wrote on the cloud side.

what a short-lived token does not fix

TanStack had no long-lived npm token to steal. On 11 May 2026, per the GitHub advisory, 84 malicious versions of 42 @tanstack packages were published anyway. TanStack’s post-mortem describes the chain: a pull_request_target workflow ran code from a fork, that code poisoned the shared Actions cache, the release workflow restored the poisoned cache on the next push to main, and the malware read the OIDC token from the runner’s memory and published directly. TanStack states that no npm tokens were stolen and that the publish workflow itself was not compromised. It ran through the legitimate trusted publishing link.

Short-lived credentials limit how long a theft is useful. Code that runs inside the release job can still use the job’s rights while the job runs. Two GitHub controls narrow that:

  • Environments. Secrets attached to an environment are only available to jobs that use it, and GitHub’s reference says a job cannot read them until a required reviewer approves. Deployment branch rules limit which branches can deploy, and “prevent self-review” stops someone approving their own run. Check your plan: GitHub’s reference says that on Free, Pro and Team plans, required reviewers only work in public repositories, while Pro and Team get branch rules for private ones.
  • Least privilege for the built-in token. GitHub recommends setting the default GITHUB_TOKEN to read-only and granting write or id-token permission only to the jobs that need it.

who owns this at your size

At a company of 50 or 300 people, the pipeline may have been set up by whoever shipped the first deploy, with keys created under their name or a shared cloud user. The secrets page may not have been opened since. The questions are short:

  • Which secrets are stored in each repository and organisation, and who created each one?
  • Which of them are long-lived cloud keys, deploy keys or publish tokens that could be replaced by a federated login?
  • Which workflows use pull_request_target, and do any of them run code from the pull request?
  • Who has write access to the repositories that deploy to production?

If someone opened a pull request against your busiest repository tonight, which secret could their code reach first?

on the record

all myths →

sources

  1. GitHub Docs: Secure use reference (GitHub Actions)
  2. GitHub Docs: Using secrets in GitHub Actions
  3. GitHub Docs: Managing GitHub Actions settings for a repository
  4. GitHub changelog: GitHub Actions, updating the default GITHUB_TOKEN permissions to read-only (2 February 2023)
  5. GitHub Docs: Managing environments for deployment
  6. GitHub Docs: Deployments and environments (reference)
  7. GitHub Docs: Managing deploy keys
  8. GitHub Docs: OpenID Connect
  9. GitHub Security Lab: Keeping your GitHub Actions and workflows secure part 1, preventing pwn requests (3 August 2021)
  10. AWS IAM User Guide: Create a role for OpenID Connect federation (configuring a role for GitHub OIDC identity provider)
  11. Microsoft Learn: Workload identity federation (Microsoft Entra Workload ID)
  12. Google Cloud IAM: Configure workload identity federation with deployment pipelines
  13. npm Docs: Trusted publishing for npm packages
  14. Nx: Malicious versions of Nx and some supporting plugins were published (GitHub security advisory GHSA-cxm3-wv7p-598c, 27 August 2025)
  15. PostHog: Post-mortem of Shai-Hulud attack on November 24th, 2025 (26 November 2025)
  16. TanStack: npm supply chain compromise postmortem (11 May 2026, updated 15 May 2026)
  17. GitHub Advisory Database: GHSA-g7cv-rxg3-hmpx, malware in @tanstack/* packages (12 May 2026)
  18. CircleCI: CircleCI incident report for January 4, 2023 security incident
  19. CISA: Supply chain compromise of third-party tj-actions/changed-files (CVE-2025-30066) and reviewdog/action-setup (18 March 2025, revised 26 March 2025)