Skip to content

Commit 6f53558

Browse files
chore: Set permissions for GitHub actions (#1230)
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. - 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/) Signed-off-by: naveen <[email protected]> Co-authored-by: Todd Leonhardt <[email protected]>
1 parent 755c780 commit 6f53558

File tree

5 files changed

+19
-0
lines changed

5 files changed

+19
-0
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ on:
99
schedule:
1010
- cron: '0 6 * * 4'
1111

12+
permissions:
13+
contents: read
14+
1215
jobs:
1316
analyze:
17+
permissions:
18+
actions: read # for github/codeql-action/init to get workflow details
19+
contents: read # for actions/checkout to fetch code
20+
security-events: write # for github/codeql-action/autobuild to send a status report
1421
name: Analyze
1522
runs-on: ubuntu-latest
1623

.github/workflows/doc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ name: Doc
44

55
on: [push, pull_request]
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
doc:
912
strategy:

.github/workflows/format.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ name: Format
44

55
on: [push, pull_request]
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
lint:
912
strategy:

.github/workflows/lint.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ name: Lint
44

55
on: [push, pull_request]
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
lint:
912
strategy:

.github/workflows/mypy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ name: MyPy
44

55
on: [push, pull_request]
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
mypy:
912
strategy:

0 commit comments

Comments
 (0)