Skip to content

ci: harden github actions checkout with persist-credentials - #33772

Open
ShraddhaZoman wants to merge 1 commit into
angular:mainfrom
ShraddhaZoman:harden-checkout-persist-credentials
Open

ci: harden github actions checkout with persist-credentials#33772
ShraddhaZoman wants to merge 1 commit into
angular:mainfrom
ShraddhaZoman:harden-checkout-persist-credentials

Conversation

@ShraddhaZoman

Copy link
Copy Markdown

What

Adds persist-credentials: false to the actions/checkout step in three workflows that didn't set it:

  • .github/workflows/docs-preview-deploy.yml
  • .github/workflows/google-internal-tests.yml
  • .github/workflows/preview-deploy-dev-app.yml

Why

actions/checkout authenticates git by writing a credential into the job's git configuration so later steps don't need to re-authenticate. Unless persist-credentials: false is set, this credential remains in place for the rest of the job, usable by any process with filesystem access — not just git commands.

Concretely, per affected file:

  • docs-preview-deploy.yml — requests pull-requests: write. The step immediately after checkout runs unpinned npx -y firebase-tools@latest, resolved fresh from npm on every run. If that package (or a transitive dependency) were ever compromised at install time, it would have ambient access to a pull-requests: write-scoped token it was never explicitly given.
  • preview-deploy-dev-app.yml — same pull-requests: write exposure, same structural risk for any current or future step added after checkout.
  • google-internal-tests.yml — requests statuses: write. A compromised later step here could set arbitrary commit statuses using the same implicitly-available credential.

In all three cases, impact is bounded by the job's own declared permissions (each already follows least privilege for its purpose) — this isn't a path to contents: write or secrets exfiltration beyond the ambient token itself. It's a defense-in-depth gap: the credential was never intended to be available past the checkout step, but in practice is available to everything that runs after it.

Every other checkout in this repo already sets persist-credentials: false directly, or routes through dev-infra's checkout-and-setup-node action, which sets it internally. These three were the only gap.

Found while reviewing the repo's GitHub Actions configuration. This is a defense-in-depth fix rather than a demonstrated live exploit — it closes a gap where a credential persists longer than any of these jobs actually need it.

No behavior change expected — CI should be unaffected.

@pullapprove
pullapprove Bot requested a review from josephperrott September 6, 2026 08:23
@angular-robot angular-robot Bot added the area: build & ci Related the build and CI infrastructure of the project label Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: build & ci Related the build and CI infrastructure of the project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant