Skip to content

Commit 8164940

Browse files
neilnaveenjsjoeio
authored andcommitted
Set permissions for GitHub actions (coder#5090)
- Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs [Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much. Signed-off-by: neilnaveen <[email protected]> Co-authored-by: Joe Previte <[email protected]>
1 parent 836b4ac commit 8164940

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

.github/workflows/ci.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,9 @@ jobs:
495495
run: rm -rf ./release-packages ./test/test-results
496496

497497
trivy-scan-repo:
498+
permissions:
499+
contents: read # for actions/checkout to fetch code
500+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
498501
runs-on: ubuntu-20.04
499502
steps:
500503
- name: Checkout repo

.github/workflows/codeql-analysis.yml

+7
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,15 @@ concurrency:
1717
group: ${{ github.workflow }}-${{ github.ref }}
1818
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
1919

20+
permissions:
21+
contents: read
22+
2023
jobs:
2124
analyze:
25+
permissions:
26+
actions: read # for github/codeql-action/init to get workflow details
27+
contents: read # for actions/checkout to fetch code
28+
security-events: write # for github/codeql-action/autobuild to send a status report
2229
name: Analyze
2330
runs-on: ubuntu-20.04
2431

.github/workflows/installer.yml

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ concurrency:
1919
group: ${{ github.workflow }}-${{ github.ref }}
2020
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
2121

22+
permissions:
23+
contents: read
24+
2225
jobs:
2326
ubuntu:
2427
name: Test installer on Ubuntu

0 commit comments

Comments
 (0)