Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc909d6b

Browse files
authored
Build: Limit permissions for GitHub workflows
Add explicit permissions section[^1] to workflows. This is a securitybest practice because by default workflows run with extended setof permissions[^2] (except from `on: pull_request` from external forks[^3].By specifying any permission explicitly all others are set to none. By usingthe principle of least privilege the damage a compromised workflow can do(because of an injection[^4] or compromised third party tool or action) isrestricted. It is recommended to have most strict permissions on the toplevel[^5] and grant write permissions on job level[^6] on a case by casebasis.[^1]:https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions[^2]:https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token[^3]:https://securitylab.github.com/research/github-actions-preventing-pwn-requests/[^4]:https://securitylab.github.com/research/github-actions-untrusted-input/[^5]:https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions[^6]:https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobsClosesgh-5119
1 parent5266f23 commitc909d6b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

‎.github/workflows/codeql-analysis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ on:
66
schedule:
77
-cron:'0 4 * * 6'
88

9+
permissions:
10+
contents:read# to fetch code (actions/checkout)
11+
912
jobs:
1013
CodeQL-Build:
1114

15+
permissions:
16+
contents:read# to fetch code (actions/checkout)
17+
security-events:write# (github/codeql-action/autobuild)
18+
1219
runs-on:ubuntu-latest
1320

1421
steps:

‎.github/workflows/node.js.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: CI
22

33
on:[push, pull_request]
44

5+
permissions:
6+
contents:read# to fetch code (actions/checkout)
7+
58
jobs:
69
build:
710
runs-on:ubuntu-latest

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp