Skip to content

ci: do not persist GITHUB_TOKEN in test checkouts [SEC-2544] - #108

Open
oliverlaz wants to merge 4 commits into
masterfrom
oliverlazoroski/sec-2544-workflow-sweep
Open

oliverlaz wants to merge 4 commits into
masterfrom
oliverlazoroski/sec-2544-workflow-sweep

Conversation

@oliverlaz

Copy link
Copy Markdown
Member

Follow-up to SEC-2544 (CI-12). The audit of this repo's workflows found it already hardened: read-only top-level permissions, per-job grants, event data passed through env:, and a release-only guard that checks head repo, author and branch. One gap remained.

Change

  • run_tests.yml and run_integration.yml: actions/checkout now sets persist-credentials: false. Both lanes check out the repository and run its code without ever pushing. Leaving GITHUB_TOKEN in .git/config let that code, or a dependency it installs, reuse the token.

regen.yml keeps its credentials because it pushes, and SEC-2541 owns that file.

Verification

actionlint is clean apart from the known client-id false positive on create-github-app-token@v3. zizmor --offline --persona=auditor no longer reports artipacked for these files.

The unit and integration lanes check out the repository and then run its
code, but never push. Leaving the token in .git/config lets that code, or
anything it pulls in, reuse it.

SEC-2544
@oliverlaz
oliverlaz requested a review from mogita November 25, 2026 11:36
@oliverlaz
oliverlaz marked this pull request as ready for review November 25, 2026 12:39
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Should Fix] Once master is merged in, this file has a second checkout that still keeps the token. The test-guzzle-8 job (added in #103, after this branch last merged master) has a bare actions/checkout@v4 with no persist-credentials: false; in the merged tree it is run_tests.yml:61.

That job runs composer update "guzzlehttp/guzzle:^8.0" --with-all-dependencies, so it installs unpinned dependencies with GITHUB_TOKEN still in .git/config, which is the exact case this PR closes.

Fix: merge master and add the same with: persist-credentials: false to that checkout.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 29e87d9

test-guzzle-8 runs composer update with unpinned dependencies, so the
checkout must not leave GITHUB_TOKEN in .git/config.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants