Skip to content

Commit c21b039

Browse files
tstellartru
authored andcommitted
workflows/release-binaries: Remove .git/config file from artifacts (#106310)
The .git/config file contains an auth token that can be leaked if the .git directory is included in a workflow artifact. (cherry picked from commit ef50970)
1 parent eba1ef5 commit c21b039

File tree

1 file changed

+6
-0
lines changed
  • .github/workflows/release-binaries-save-stage

1 file changed

+6
-0
lines changed

.github/workflows/release-binaries-save-stage/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ inputs:
1010
required: true
1111
type: 'string'
1212

13+
permissions:
14+
contents: read
15+
1316
runs:
1417
using: "composite"
1518
steps:
@@ -18,6 +21,9 @@ runs:
1821
- name: Package Build and Source Directories
1922
shell: bash
2023
run: |
24+
# Remove .git/config to avoid leaking GITHUB_TOKEN stored there.
25+
# See https://unit42.paloaltonetworks.com/github-repo-artifacts-leak-tokens/
26+
rm -Rf .git/config
2127
# Windows does not support symlinks, so we need to dereference them.
2228
tar --exclude build/ ${{ (runner.os == 'Windows' && '-h') || '' }} -c . | zstd -T0 -c > ../llvm-project.tar.zst
2329
mv ../llvm-project.tar.zst .

0 commit comments

Comments
 (0)