Skip to content

Commit

Permalink
Problem: persist-credentials might leak github token unintentionally
Browse files Browse the repository at this point in the history
Solution:
- try persist-credentials: false
  • Loading branch information
yihuang committed Oct 16, 2024
1 parent 69a8c50 commit 20ed467
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,17 @@ jobs:
with:
go-version: 1.22
- name: Checkout Comment PR Branch
uses: actions/checkout@v3
uses: actions/checkout@v4
if: github.event_name == 'issue_comment'
with:
submodules: true
persist-credentials: false
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ steps.pr_data.outputs.ref }}
- name: Normal check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
persist-credentials: false
submodules: true
if: github.event_name == 'push' || github.event_name == 'pull_request'
- id: changed-files
Expand Down Expand Up @@ -150,7 +152,9 @@ jobs:
contents: read
security-events: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-22.11
Expand Down Expand Up @@ -213,17 +217,19 @@ jobs:
with:
go-version: 1.22
- name: Checkout Comment PR Branch
uses: actions/checkout@v3
uses: actions/checkout@v4
if: github.event_name == 'issue_comment'
with:
submodules: true
persist-credentials: false
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ needs.build.outputs.ref }}
- name: Normal check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
if: github.event_name == 'push' || github.event_name == 'pull_request'
with:
submodules: true
persist-credentials: false
- id: changed-files
uses: tj-actions/changed-files@v41
with:
Expand Down Expand Up @@ -259,17 +265,19 @@ jobs:
with:
go-version: 1.22
- name: Checkout Comment PR Branch
uses: actions/checkout@v3
uses: actions/checkout@v4
if: github.event_name == 'issue_comment'
with:
submodules: true
persist-credentials: false
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ needs.build.outputs.ref }}
- name: Normal check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
if: github.event_name == 'push' || github.event_name == 'pull_request'
with:
submodules: true
persist-credentials: false
- id: changed-files
uses: tj-actions/changed-files@v41
with:
Expand Down Expand Up @@ -305,17 +313,19 @@ jobs:
with:
go-version: 1.22
- name: Checkout Comment PR Branch
uses: actions/checkout@v3
uses: actions/checkout@v4
if: github.event_name == 'issue_comment'
with:
submodules: true
persist-credentials: false
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ needs.build.outputs.ref }}
- name: Normal check out code
uses: actions/checkout@v3
uses: actions/checkout@v4
if: github.event_name == 'push' || github.event_name == 'pull_request'
with:
submodules: true
persist-credentials: false
- id: changed-files
uses: tj-actions/changed-files@v41
with:
Expand Down Expand Up @@ -411,7 +421,9 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
persist-credentials: false
- id: changed-files
uses: tj-actions/changed-files@v41
with:
Expand Down

0 comments on commit 20ed467

Please sign in to comment.