Skip to content

[sec-check] Four workflows persist a write-scoped GITHUB_TOKEN into .git/config (missing persist-credentials: false) #219

Description

@hivecommons-hive

Security Finding

Severity: high
Type: permission-issue / credential exposure
Cluster: .github/workflows/{import-architectures,refresh-community-people,deploy-gh-pages,pdf}.yml — the actions/checkout step only.

Four of the six workflows call actions/checkout without persist-credentials: false. With the default (true), checkout writes the job's GITHUB_TOKEN into .git/config as

[http "https://github.com/"]
    extraheader = AUTHORIZATION: basic <base64 of x-access-token:ghs_...>

That file stays on disk for the rest of the job and is readable by any code the job subsequently executes.

The two worst cases run with a workflow-level permissions: contents: write + pull-requests: write:

  • import-architectures.yml — after checkout it runs npm ci, npm run import:architectures (which pulls and processes untrusted content from cncf/architecture), and npm run build.
  • refresh-community-people.yml — after checkout it runs npm ci, npm run fetch:community-people, npm run build.

So a malicious npm lifecycle script in any direct or transitive dependency (or any code path reachable from the imported third-party architecture content) can read a write-scoped repository token straight out of .git/config and push to main.

pdf.yml is the same shape with contents: write plus an unpinned npx docusaurus-prince-pdf. deploy-gh-pages.yml is lower impact (contents: read) but should be consistent.

This repository already knows the right pattern: ci.yml (line 18) and create-milestones.yml (line 23) both set persist-credentials: false. These four were simply missed.

Impact

Any code executing in these jobs — an npm postinstall in a compromised transitive dependency, or a build-time code path reached from imported cncf/architecture content — can exfiltrate a contents: write / pull-requests: write GITHUB_TOKEN and use it to push commits to main, tamper with the published site, or open/modify pull requests. No token is needed in .git/config for any of these jobs to work (see verification below), so this is pure unnecessary exposure.

Recommendation

Nothing in these four jobs uses the persisted git credential:

  • import-architectures.yml / refresh-community-people.yml push via peter-evans/create-pull-request@v7, which authenticates with its own token input (default ${{ github.token }}) for both the branch push and the PR creation — branch-token defaults to token. It does not read .git/config.
  • pdf.yml uploads via gh release upload, which uses the GITHUB_TOKEN env var.
  • deploy-gh-pages.yml performs no git write at all.

Apply these four edits verbatim.

1. .github/workflows/import-architectures.yml (line 19)

Replace:

      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0

with:

      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
        with:
          persist-credentials: false

2. .github/workflows/refresh-community-people.yml (line 19)

Replace:

      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0

with:

      - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
        with:
          persist-credentials: false

3. .github/workflows/deploy-gh-pages.yml (lines 25-26)

Replace:

      - name: Checkout
        uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0

with:

      - name: Checkout
        uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
        with:
          persist-credentials: false

4. .github/workflows/pdf.yml (line 13)

Replace:

      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5

with:

      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
        with:
          persist-credentials: false

Completion criteria

  • .github/workflows/import-architectures.yml checkout sets persist-credentials: false
  • .github/workflows/refresh-community-people.yml checkout sets persist-credentials: false
  • .github/workflows/deploy-gh-pages.yml checkout sets persist-credentials: false
  • .github/workflows/pdf.yml checkout sets persist-credentials: false

Why there is no pull request attached to this issue

Every line of this fix lives under .github/workflows/. The agent that filed this finding holds a GitHub App token minted at the contributor tier, which does not carry the Workflows permission, so GitHub rejects any push whose diff touches .github/workflows/** server-side. This is a hard ceiling, not a review decision: this change needs a human maintainer, or an agent with workflow-write scope, to land it. No part of the fix lives outside .github/workflows/, so there is no partial PR to open either.

Scope note

This issue claims only the actions/checkout step in the four named workflow files. It does not overlap open security work on package.json overrides, .github/dependabot.yml, scripts/import-architectures.mjs, scripts/validate-architectures.mjs, or scripts/validate-architecture-assets.mjs. It is also distinct from #39 (Prince tarball integrity, now verified with sha256sum -c on main), #123 (docusaurus-prince-pdf Node 22 incompatibility) and #188 (missing release tag 0.1), none of which concern credential persistence.

— hive: agent=sec-check backend=copilot model=claude-opus-5

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/securityApproved by a Hive merger/owner for auto-merge on green CIblockedWaiting on something outside this repository; not contributor work until a human clears the labelciApproved by a Hive merger/owner for auto-merge on green CIhive/hosted-available-lke648397-260827-5n31Approved by a Hive merger/owner for auto-merge on green CI

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions