Skip to content

Commit 99d2496

Browse files
committed
Don't persist credentials when not needed, and save verbose test results
persist-credentials defaults to true (see actions/checkout#485). It looks like pull_request workflows run without token access, but it's not clear from https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ if that means persist-credentials doesn't leave a secret in the .git directory where a malicious PR could access it.
1 parent 8b74bc6 commit 99d2496

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,18 @@ jobs:
3838
runs-on: ubuntu-latest
3939
steps:
4040
- uses: actions/checkout@v4
41+
with:
42+
persist-credentials: false
4143
- uses: actions/setup-go@v5
4244
with:
4345
go-version-file: go.mod
4446
cache: true
4547
- name: Test
46-
run: go test ./...
48+
run: go test -v ./... | tee "${RUNNER_TEMP}/go-test-results.txt"
49+
- uses: actions/upload-artifact@v4
50+
with:
51+
name: go-test-results
52+
path: "${{ env.RUNNER_TEMP }}/go-test-results.txt"
4753

4854
build:
4955
needs: test
@@ -62,6 +68,7 @@ jobs:
6268
steps:
6369
- uses: actions/checkout@v4
6470
with:
71+
persist-credentials: false
6572
fetch-depth: 0
6673
fetch-tags: true
6774
- uses: actions/setup-go@v5

.github/workflows/release.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ jobs:
3333
runs-on: ubuntu-latest
3434
steps:
3535
- uses: actions/checkout@v4
36+
with:
37+
persist-credentials: false
3638
- uses: actions/setup-go@v5
3739
with:
3840
go-version: '>=1.18'
3941
cache: true
4042
- name: Test
41-
run: go test ./...
43+
run: go test -v ./...
4244

4345
build:
4446
needs: test
@@ -56,6 +58,8 @@ jobs:
5658

5759
steps:
5860
- uses: actions/checkout@v4
61+
with:
62+
persist-credentials: false
5963
- uses: actions/setup-go@v5
6064
with:
6165
go-version: '>=1.18'

0 commit comments

Comments
 (0)