Skip to content

Commit a6c6024

Browse files
authored
Merge pull request #10399 from Byron/fix
Do not persist credentials during checkout to prevent exfiltration or accidental logging
2 parents d9eedea + 74309c7 commit a6c6024

File tree

6 files changed

+61
-0
lines changed

6 files changed

+61
-0
lines changed

.github/workflows/pr-labeler.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v5
1515
with:
16+
persist-credentials: false
1617
repository: 'gitbutlerapp/gitbutler'
1718
- uses: actions/labeler@v6
1819
with:

.github/workflows/push-e2e-img.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ jobs:
1212
permissions: write-all
1313
steps:
1414
- uses: actions/checkout@v5
15+
with:
16+
persist-credentials: false
1517
- name: Log in to GitHub Container Registry
1618
uses: docker/login-action@v3
1719
with:

.github/workflows/push.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
rust: ${{ steps.filter.outputs.rust }}
2121
steps:
2222
- uses: actions/checkout@v5
23+
with:
24+
persist-credentials: false
2325
- uses: dorny/paths-filter@v3
2426
id: filter
2527
with:
@@ -49,6 +51,8 @@ jobs:
4951
runs-on: ubuntu-latest
5052
steps:
5153
- uses: actions/checkout@v5
54+
with:
55+
persist-credentials: false
5256
- uses: ./.github/actions/init-env-node
5357
- run: pnpm prettier
5458

@@ -58,6 +62,8 @@ jobs:
5862
runs-on: ubuntu-latest
5963
steps:
6064
- uses: actions/checkout@v5
65+
with:
66+
persist-credentials: false
6167
- uses: ./.github/actions/init-env-node
6268
- run: pnpm lint
6369

@@ -67,6 +73,8 @@ jobs:
6773
runs-on: ubuntu-latest
6874
steps:
6975
- uses: actions/checkout@v5
76+
with:
77+
persist-credentials: false
7078
- uses: ./.github/actions/init-env-node
7179
- run: pnpm check
7280

@@ -76,6 +84,8 @@ jobs:
7684
runs-on: ubuntu-latest
7785
steps:
7886
- uses: actions/checkout@v5
87+
with:
88+
persist-credentials: false
7989
- uses: ./.github/actions/init-env-node
8090
- run: pnpm test
8191

@@ -89,6 +99,8 @@ jobs:
8999
CARGO_TERM_COLOR: always
90100
steps:
91101
- uses: actions/checkout@v5
102+
with:
103+
persist-credentials: false
92104
- run: cargo fmt --check --all
93105
- run: cargo check --workspace --all-targets
94106

@@ -102,6 +114,8 @@ jobs:
102114
CARGO_TERM_COLOR: always
103115
steps:
104116
- uses: actions/checkout@v5
117+
with:
118+
persist-credentials: false
105119
# TODO(qix-): we have to exclude the app here for now because for some
106120
# TODO(qix-): reason it doesn't build with the docs feature enabled.
107121
- run: cargo doc --no-deps --all-features --document-private-items -p gitbutler-git
@@ -114,6 +128,8 @@ jobs:
114128
runs-on: ubuntu-latest
115129
steps:
116130
- uses: actions/checkout@v5
131+
with:
132+
persist-credentials: false
117133
- uses: EmbarkStudios/cargo-deny-action@f2ba7abc2abebaf185c833c3961145a3c275caad # v2.0.13
118134
with:
119135
command: check bans licenses sources
@@ -129,6 +145,8 @@ jobs:
129145
shell: bash
130146
steps:
131147
- uses: actions/checkout@v5
148+
with:
149+
persist-credentials: false
132150
- name: Rust Cache
133151
uses: Swatinem/[email protected]
134152
with:
@@ -186,9 +204,40 @@ jobs:
186204
CARGO_TERM_COLOR: always
187205
steps:
188206
- uses: actions/checkout@v5
207+
with:
208+
persist-credentials: false
189209
- name: Rust Cache
190210
uses: Swatinem/[email protected]
191211
with:
192212
shared-key: windows-rust-testing
193213
- name: 'cargo check'
194214
run: cargo check --workspace --all-targets --features windows
215+
216+
# Check that all `actions/checkout` in CI jobs have `persist-credentials: false`.
217+
check-no-persist-credentials:
218+
runs-on: ubuntu-latest
219+
220+
env:
221+
GLOB: .github/workflows/*.@(yaml|yml)
222+
223+
steps:
224+
- uses: actions/checkout@v5
225+
with:
226+
persist-credentials: false
227+
sparse-checkout: '.github/workflows'
228+
- name: Generate workflows list to scan
229+
run: |
230+
shopt -s extglob
231+
printf '%s\n' ${{ env.GLOB }} | grep -v .github/workflows/publish.yaml >workflows.list
232+
cat workflows.list
233+
echo "Note that publish.yaml is excluded until it's ensured to not need this feature"
234+
- name: Scan workflows
235+
run: |
236+
shopt -s extglob
237+
yq '.jobs.*.steps[]
238+
| select(.uses == "actions/checkout@*" and .with.["persist-credentials"]? != false)
239+
| {"file": filename, "line": line, "name": (.name // .uses)}
240+
| .file + ":" + (.line | tostring) + ": " + .name
241+
' -- $(cat workflows.list) >query-output.txt
242+
cat query-output.txt
243+
test -z "$(<query-output.txt)" # Report failure if we found anything.

.github/workflows/test-client-fe-integration.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@ jobs:
1515
timeout-minutes: 60
1616
steps:
1717
- uses: actions/checkout@v5
18+
with:
19+
persist-credentials: false
1820
if: ${{ github.event_name != 'workflow_dispatch' }}
1921
- uses: actions/checkout@v5
2022
if: ${{ github.event_name == 'workflow_dispatch' }}
2123
with:
24+
persist-credentials: false
2225
ref: ${{ github.event.inputs.sha }}
2326
- name: Setup node environment
2427
uses: ./.github/actions/init-env-node

.github/workflows/test-e2e-blackbox.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ jobs:
1919
CARGO_TERM_COLOR: always
2020
steps:
2121
- uses: actions/checkout@v5
22+
with:
23+
persist-credentials: false
2224
if: ${{ github.event_name != 'workflow_dispatch' }}
2325
- uses: actions/checkout@v5
2426
if: ${{ github.event_name == 'workflow_dispatch' }}
2527
with:
28+
persist-credentials: false
2629
ref: ${{ github.event.inputs.sha }}
2730
- name: Install Tauri OS dependencies
2831
run: |

.github/workflows/test-e2e-playwright.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@ jobs:
2727
GIT_CONFIG_GLOBAL: ${{ github.workspace }}/e2e/playwright/fixtures/.gitconfig
2828
steps:
2929
- uses: actions/checkout@v5
30+
with:
31+
persist-credentials: false
3032
if: ${{ github.event_name != 'workflow_dispatch' }}
3133
- uses: actions/checkout@v5
3234
if: ${{ github.event_name == 'workflow_dispatch' }}
3335
with:
36+
persist-credentials: false
3437
ref: ${{ github.event.inputs.sha }}
3538
- name: Rust Cache
3639
uses: Swatinem/[email protected]

0 commit comments

Comments
 (0)