-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve security of our GitHub Actions (#18413)
Recently CPython introduced this new tool: https://github.com/python/cpython/blob/8eebe4e6d02bb4ad3f1ca6c52624186903dce893/.pre-commit-config.yaml#L64-L67 Which finds different security related problems with GitHub Actions. I added this tool to our `.pre-commit-config.yaml` and followed all its recommendations. Changes: - I added `persist-credentials: false` to all `checkout` actions, see `# Whether to configure the token or SSH key with the local git config` in https://github.com/actions/checkout - I moved all permissions from workflow level to job level - I changed `.github/workflows/mypy_primer_comment.yml` to be a reusable workflow, see https://woodruffw.github.io/zizmor/audits/#dangerous-triggers
- Loading branch information
Showing
9 changed files
with
41 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,10 +16,11 @@ repos: | |
- id: ruff | ||
args: [--exit-non-zero-on-fix] | ||
- repo: https://github.com/python-jsonschema/check-jsonschema | ||
rev: 0.30.0 | ||
rev: 0.31.0 | ||
hooks: | ||
- id: check-dependabot | ||
- id: check-github-workflows | ||
- id: check-github-actions | ||
- id: check-readthedocs | ||
- repo: https://github.com/rhysd/actionlint | ||
rev: v1.7.6 | ||
hooks: | ||
|
@@ -29,5 +30,20 @@ repos: | |
-ignore=property "allow_failure" is not defined, | ||
-ignore=SC2(046|086), | ||
] | ||
additional_dependencies: | ||
# actionlint has a shellcheck integration which extracts shell scripts in `run:` steps from GitHub Actions | ||
# and checks these with shellcheck. This is arguably its most useful feature, | ||
# but the integration only works if shellcheck is installed | ||
- "github.com/wasilibs/go-shellcheck/cmd/[email protected]" | ||
- repo: https://github.com/woodruffw/zizmor-pre-commit | ||
rev: v1.0.1 | ||
hooks: | ||
- id: zizmor | ||
# Should be the last one: | ||
- repo: meta | ||
hooks: | ||
- id: check-hooks-apply | ||
- id: check-useless-excludes | ||
|
||
ci: | ||
autoupdate_schedule: quarterly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters