Skip to content

Commit 9c3fab1

Browse files
committed
workflows: don't persist credentials
By default, the `actions/checkout` action stores the credentials in the local Git config file. This is not really very secure and a credential manager would be a much better idea, but Actions has not yet done so. In the mean time, since we don't need those credentials to perform more Git operations, let's make sure to not persist them in the config, which means that it's less likely we'll accidentally expose them, such as by shipping them in an artifact.
1 parent cbb41e0 commit 9c3fab1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
- uses: actions/checkout@v4
1616
with:
1717
fetch-depth: 0
18+
persist-credentials: false
1819
- run: git fetch origin "+${GITHUB_REF}:${GITHUB_REF}"
1920
if: ${{ github.ref_type == 'tag' }}
2021
# We update the current tag as the checkout step turns annotated tags
@@ -53,6 +54,7 @@ jobs:
5354
- uses: actions/checkout@v4
5455
with:
5556
fetch-depth: 0
57+
persist-credentials: false
5658
- run: git fetch origin "+${GITHUB_REF}:${GITHUB_REF}"
5759
if: ${{ github.ref_type == 'tag' }}
5860
- uses: actions/setup-go@v5
@@ -66,6 +68,7 @@ jobs:
6668
- uses: actions/checkout@v4
6769
with:
6870
fetch-depth: 0
71+
persist-credentials: false
6972
- run: git fetch origin "+${GITHUB_REF}:${GITHUB_REF}"
7073
if: ${{ github.ref_type == 'tag' }}
7174
shell: bash
@@ -134,6 +137,7 @@ jobs:
134137
- uses: actions/checkout@v4
135138
with:
136139
fetch-depth: 0
140+
persist-credentials: false
137141
- uses: actions/setup-go@v5
138142
with:
139143
go-version: '1.23.x'
@@ -158,6 +162,7 @@ jobs:
158162
- uses: actions/checkout@v4
159163
with:
160164
fetch-depth: 0
165+
persist-credentials: false
161166
- uses: actions/setup-go@v5
162167
with:
163168
go-version: '1.23.x'
@@ -179,6 +184,7 @@ jobs:
179184
- uses: actions/checkout@v4
180185
with:
181186
fetch-depth: 0
187+
persist-credentials: false
182188
- run: git fetch origin "+${GITHUB_REF}:${GITHUB_REF}"
183189
if: ${{ github.ref_type == 'tag' }}
184190
- uses: ruby/setup-ruby@v1
@@ -196,6 +202,7 @@ jobs:
196202
- uses: actions/checkout@v4
197203
with:
198204
fetch-depth: 0
205+
persist-credentials: false
199206
- run: git fetch origin "+${GITHUB_REF}:${GITHUB_REF}"
200207
if: ${{ github.ref_type == 'tag' }}
201208
- uses: ruby/setup-ruby@v1

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
- uses: actions/checkout@v4
1717
with:
1818
fetch-depth: 0
19+
persist-credentials: false
1920
- run: git fetch origin "+${GITHUB_REF}:${GITHUB_REF}"
2021
shell: bash
2122
# We update the current tag as the checkout step turns annotated tags
@@ -108,6 +109,7 @@ jobs:
108109
- uses: actions/checkout@v4
109110
with:
110111
fetch-depth: 0
112+
persist-credentials: false
111113
- run: git fetch origin "+${GITHUB_REF}:${GITHUB_REF}"
112114
- uses: ruby/setup-ruby@v1
113115
- run: gem install asciidoctor
@@ -147,6 +149,7 @@ jobs:
147149
- uses: actions/checkout@v4
148150
with:
149151
fetch-depth: 0
152+
persist-credentials: false
150153
- run: git fetch origin "+${GITHUB_REF}:${GITHUB_REF}"
151154
- uses: ruby/setup-ruby@v1
152155
- run: gem install asciidoctor
@@ -178,6 +181,7 @@ jobs:
178181
- uses: actions/checkout@v4
179182
with:
180183
fetch-depth: 0
184+
persist-credentials: false
181185
- run: git fetch origin "+${GITHUB_REF}:${GITHUB_REF}"
182186
- uses: ruby/setup-ruby@v1
183187
- run: gem install packagecloud-ruby
@@ -199,6 +203,7 @@ jobs:
199203
- uses: actions/checkout@v4
200204
with:
201205
fetch-depth: 0
206+
persist-credentials: false
202207
- run: git fetch origin "+${GITHUB_REF}:${GITHUB_REF}"
203208
- uses: ruby/setup-ruby@v1
204209
- run: gem install packagecloud-ruby

0 commit comments

Comments
 (0)