Skip to content

Commit

Permalink
workflows/release-binaries: Remove .git/config file from artifacts (l…
Browse files Browse the repository at this point in the history
…lvm#106310)

The .git/config file contains an auth token that can be leaked if the
.git directory is included in a workflow artifact.
  • Loading branch information
tstellar authored Aug 31, 2024
1 parent 4f9ea25 commit ef50970
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/release-binaries-save-stage/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ inputs:
required: true
type: 'string'

permissions:
contents: read

runs:
using: "composite"
steps:
Expand All @@ -18,6 +21,9 @@ runs:
- name: Package Build and Source Directories
shell: bash
run: |
# Remove .git/config to avoid leaking GITHUB_TOKEN stored there.
# See https://unit42.paloaltonetworks.com/github-repo-artifacts-leak-tokens/
rm -Rf .git/config
# Windows does not support symlinks, so we need to dereference them.
tar --exclude build/ ${{ (runner.os == 'Windows' && '-h') || '' }} -c . | zstd -T0 -c > ../llvm-project.tar.zst
mv ../llvm-project.tar.zst .
Expand Down

0 comments on commit ef50970

Please sign in to comment.