Skip to content

Commit 63f42c9

Browse files
EliahKaganclaude
andcommitted
ci: stop actions/checkout from persisting credentials
By default, `actions/checkout` persists the job's `GITHUB_TOKEN` so later Git commands can use it. Since v6, it writes the token to a credentials file under `$RUNNER_TEMP` and adds `includeIf` entries that include that file to the checked-out repository's `.git/config`. Nine checkout steps did this, in `alpine-test.yml`, `codeql.yml`, `cygwin-test.yml`, `dependencies.yml`, `git-cli.yml` (twice, including the `git/git` checkout in `.git-source`), `lint.yml`, and `pythonpackage.yml` (twice). zizmor reports these as `artipacked`. No step in these jobs needs the token after checkout. They push nothing, and their only network Git operations are reads of public repositories, which need no credentials. The other checkouts, in `backend-benchmark.yml`, `downstream.yml`, the `uv-sync` job in `dependencies.yml`, and `zizmor.yml`, already use `persist-credentials: false`. Keeping the token is also riskier here than in most projects. GitPython runs Git operations, and its test suite uses this checkout as a repository: the tests read it, clone it, and run Git commands against it. A test or library bug could then use the token, or expose the configuration that refers to it, whether through test output or a retained artifact such as `pythonpackage.yml`'s test results. The `includeIf` entries and the configuration they include can also change how Git behaves in it, coupling test results to how CI checked out the code. Set `persist-credentials: false` on every checkout that lacked it. It is added to the existing `with:` block where there is one, after the other inputs, as in `backend-benchmark.yml`. The disabled `codeql.yml` workflow is included, so it is safe if it is enabled again. zizmor 1.31.1 at the `pedantic` level no longer reports any `artipacked` findings. `actionlint` reports no problems. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 3d3fba9 commit 63f42c9

7 files changed

Lines changed: 13 additions & 0 deletions

File tree

‎.github/workflows/alpine-test.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3636
with:
3737
fetch-depth: 0
38+
persist-credentials: false
3839

3940
- name: Set workspace ownership
4041
run: |

‎.github/workflows/codeql.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ jobs:
4949
steps:
5050
- name: Checkout repository
5151
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
52+
with:
53+
persist-credentials: false
5254

5355
# Add any setup steps before running the `github/codeql-action/init` action.
5456
# This includes steps like installing compilers or runtimes (`actions/setup-node`

‎.github/workflows/cygwin-test.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3232
with:
3333
fetch-depth: 0
34+
persist-credentials: false
3435

3536
- name: Install Cygwin
3637
uses: cygwin/cygwin-install-action@3f0a3f9f988f7e96b8c18098ae05eaec175f5b52 # v6.0.2

‎.github/workflows/dependencies.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2929
with:
3030
fetch-depth: 0
31+
persist-credentials: false
3132
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
3233
with:
3334
python-version: ${{ matrix.python-version }}

‎.github/workflows/git-cli.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ jobs:
1616
GIT_PYTHON_BACKEND: cli
1717
steps:
1818
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
19+
with:
20+
persist-credentials: false
1921
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2022
with:
2123
repository: git/git
2224
ref: v2.52.0
2325
path: .git-source
26+
persist-credentials: false
2427
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
2528
with:
2629
python-version: '3.12'

‎.github/workflows/lint.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515

1616
steps:
1717
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
18+
with:
19+
persist-credentials: false
1820

1921
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
2022
with:

‎.github/workflows/pythonpackage.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
6363
with:
6464
fetch-depth: 0
65+
persist-credentials: false
6566

6667
- name: Set up Python ${{ matrix.python-version }}
6768
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
@@ -266,6 +267,8 @@ jobs:
266267
GIT_PYTHON_BACKEND: cli
267268
steps:
268269
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
270+
with:
271+
persist-credentials: false
269272
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
270273
with:
271274
python-version: ${{ matrix.python }}

0 commit comments

Comments
 (0)