[llvm-branch-commits] [llvm] release/19.x: workflows/release-binaries: Remove .git/config file from artifacts (#106310) (PR #106821)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Aug 30 19:52:37 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-github-workflow

Author: None (llvmbot)

<details>
<summary>Changes</summary>

Backport ef50970204384643acca42ba4c7ca8f14865a0c2

Requested by: @<!-- -->tstellar

---
Full diff: https://github.com/llvm/llvm-project/pull/106821.diff


1 Files Affected:

- (modified) .github/workflows/release-binaries-save-stage/action.yml (+6) 


``````````diff
diff --git a/.github/workflows/release-binaries-save-stage/action.yml b/.github/workflows/release-binaries-save-stage/action.yml
index e2f3eeadd15bea..f08088c7bc56f1 100644
--- a/.github/workflows/release-binaries-save-stage/action.yml
+++ b/.github/workflows/release-binaries-save-stage/action.yml
@@ -10,6 +10,9 @@ inputs:
     required: true
     type: 'string'
 
+permissions:
+  contents: read
+
 runs:
   using: "composite"
   steps:
@@ -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 .

``````````

</details>


https://github.com/llvm/llvm-project/pull/106821


More information about the llvm-branch-commits mailing list