aboutsummaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorAlex <aleksandrosansan@gmail.com>2022-12-01 15:23:17 +0200
committerGitHub <noreply@github.com>2022-12-01 14:23:17 +0100
commitc909d6b1ff444e68618b6da13d9c21714f681925 (patch)
tree1766d79a171d660aad13b57ab77e40c6bf9fd16e /.github
parent5266f23cf49c9329bddce4d4af6cb5fbbd1e0383 (diff)
downloadjquery-c909d6b1ff444e68618b6da13d9c21714f681925.tar.gz
jquery-c909d6b1ff444e68618b6da13d9c21714f681925.zip
Build: Limit permissions for GitHub workflows
Add explicit permissions section[^1] to workflows. This is a security best practice because by default workflows run with extended set of permissions[^2] (except from `on: pull_request` from external forks[^3]. By specifying any permission explicitly all others are set to none. By using the principle of least privilege the damage a compromised workflow can do (because of an injection[^4] or compromised third party tool or action) is restricted. It is recommended to have most strict permissions on the top level[^5] and grant write permissions on job level[^6] on a case by case basis. [^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-jobs Closes gh-5119
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/codeql-analysis.yml7
-rw-r--r--.github/workflows/node.js.yml3
2 files changed, 10 insertions, 0 deletions
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index bc31d6a3c..68f55358f 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -6,9 +6,16 @@ on:
schedule:
- cron: '0 4 * * 6'
+permissions:
+ contents: read # to fetch code (actions/checkout)
+
jobs:
CodeQL-Build:
+ permissions:
+ contents: read # to fetch code (actions/checkout)
+ security-events: write # (github/codeql-action/autobuild)
+
runs-on: ubuntu-latest
steps:
diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml
index c2c02ce9f..9600af215 100644
--- a/.github/workflows/node.js.yml
+++ b/.github/workflows/node.js.yml
@@ -2,6 +2,9 @@ name: CI
on: [push, pull_request]
+permissions:
+ contents: read # to fetch code (actions/checkout)
+
jobs:
build:
runs-on: ubuntu-latest