Unverified 提交 091b6640 authored 作者: Ben Mares's avatar Ben Mares 提交者: GitHub

Audit GHA workflows with zizmor (#1136)

* Don't persist credentials in pypi.yml Ref: <https://woodruffw.github.io/zizmor/audits/#artipacked> * Don't persist credentials This is an insecure default on GitHub that increases the chances of credential leakage. <https://unit42.paloaltonetworks.com/github-repo-artifacts-leak-tokens/> * Add zizmor exception for RTD pull_request_target trigger * Create zizmor workflow
上级 581f65a1
......@@ -13,6 +13,8 @@ jobs:
shell: bash -leo pipefail {0}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: "1.5.10-0" # until https://github.com/mamba-org/setup-micromamba/issues/225 is resolved
......
......@@ -26,6 +26,7 @@ jobs:
with:
fetch-depth: 0
submodules: true
persist-credentials: false
- name: Build SDist
run: pipx run build --sdist
......@@ -45,6 +46,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: hynek/build-and-inspect-python-package@v2
build_wheels:
......@@ -60,6 +62,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Build wheels
uses: pypa/cibuildwheel@v2.22.0
......@@ -76,6 +79,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
......
name: Read the Docs Pull Request Preview
on:
pull_request_target:
# See <https://github.com/readthedocs/actions/issues/45>
pull_request_target: # zizmor: ignore[dangerous-triggers]
types:
- opened
permissions:
pull-requests: write
jobs:
documentation-links:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: readthedocs/actions/preview@v1
with:
......
......@@ -25,6 +25,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: dorny/paths-filter@v3
id: changes
with:
......@@ -56,6 +57,8 @@ jobs:
python-version: ["3.10", "3.12"]
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
......@@ -146,6 +149,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@v2
with:
......@@ -229,6 +233,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python 3.10
uses: mamba-org/setup-micromamba@v2
with:
......@@ -286,6 +291,8 @@ jobs:
if: ${{ needs.changes.outputs.changes == 'true' && needs.all-checks.result == 'success' }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
......
# https://github.com/woodruffw/zizmor
name: zizmor GHA analysis
on:
push:
branches: ["main"]
pull_request:
branches: ["**"]
jobs:
zizmor:
name: zizmor latest via PyPI
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- uses: hynek/setup-cached-uv@v2
- name: Run zizmor 🌈
run: uvx zizmor --format sarif . > results.sarif
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v3
with:
# Path to SARIF file relative to the root of the repository
sarif_file: results.sarif
# Optional category for the results
# Used to differentiate multiple results for one commit
category: zizmor
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论