diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d41b3443..4a09c81e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -12,13 +12,19 @@ updates: directory: "/" patterns: ["*"] multi-ecosystem-group: "dependencies" + cooldown: + default-days: 7 - package-ecosystem: "pip" directory: "/" patterns: ["*"] multi-ecosystem-group: "dependencies" + cooldown: + default-days: 7 - package-ecosystem: "pre-commit" directory: "/" patterns: ["*"] multi-ecosystem-group: "dependencies" + cooldown: + default-days: 7 diff --git a/.github/workflows/check-pr-template.yml b/.github/workflows/check-pr-template.yml index 9196bacb..31dccfdf 100644 --- a/.github/workflows/check-pr-template.yml +++ b/.github/workflows/check-pr-template.yml @@ -4,6 +4,9 @@ on: pull_request: types: [opened, edited, reopened, synchronize] +permissions: + contents: read + jobs: check-pr-template: name: Check PR template diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8063748..33729111 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: + contents: read + defaults: run: shell: bash # https://github.com/beeware/briefcase/pull/912 @@ -31,12 +34,13 @@ jobs: timeout-minutes: 5 steps: - name: Checkout - uses: actions/checkout@v7.0.1 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 1 + persist-credentials: false - name: Set up Python - uses: actions/setup-python@v7.0.0 + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: "3.X" cache: pip diff --git a/.github/workflows/new-issue.yml b/.github/workflows/new-issue.yml index e4a99c00..58e6d181 100644 --- a/.github/workflows/new-issue.yml +++ b/.github/workflows/new-issue.yml @@ -11,8 +11,11 @@ jobs: add-to-project: name: Add issue to BeeWare project runs-on: ubuntu-latest + # The add-to-project action authenticates with BRUTUS_PAT_TOKEN, so the + # job's own GITHUB_TOKEN needs no permissions. + permissions: {} steps: - - uses: actions/add-to-project@v2.0.0 + - uses: actions/add-to-project@5afcf98fcd03f1c2f92c3c83f58ae24323cc57fd # v2.0.0 with: project-url: https://github.com/orgs/beeware/projects/1 github-token: ${{ secrets.BRUTUS_PAT_TOKEN }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1a6dadfc..74ec5eba 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,6 +10,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: + contents: write + defaults: run: shell: bash # https://github.com/beeware/briefcase/pull/912 @@ -26,12 +29,13 @@ jobs: timeout-minutes: 5 steps: - name: Checkout - uses: actions/checkout@v7.0.1 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 1 + persist-credentials: false - name: Set up Python - uses: actions/setup-python@v7.0.0 + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: "3.X" cache: pip @@ -49,7 +53,7 @@ jobs: run: python -m tox -e docs-all - name: Deploy the built files - uses: JamesIves/github-pages-deploy-action@v4.8.0 + uses: JamesIves/github-pages-deploy-action@d92aa235d04922e8f08b40ce78cc5442fcfbfa2f # v4.8.0 with: folder: _build/html # The folder the action should deploy. branch: gh-pages # The branch to which the action should deploy. diff --git a/.github/workflows/translate.yml b/.github/workflows/translate.yml index 3d864860..73a270d5 100644 --- a/.github/workflows/translate.yml +++ b/.github/workflows/translate.yml @@ -16,15 +16,21 @@ jobs: name: Update Translations if: github.actor != 'brutusthebee' runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Checkout - uses: actions/checkout@v7.0.1 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 1 token: ${{ secrets.BRUTUS_PAT_TOKEN }} + # Don't persist the token in .git/config (avoids the artipacked + # credential-leak vector); pushes are authenticated via the gh + # credential helper configured in "Configure git" below. + persist-credentials: false - name: Set up Python - uses: actions/setup-python@v7.0.0 + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: "3.X" cache: pip @@ -39,9 +45,14 @@ jobs: run: python -m pip install --group 'translate' - name: Configure git + env: + GH_TOKEN: ${{ secrets.BRUTUS_PAT_TOKEN }} run: | git config --local user.email "$(git log --pretty='%ae' -1)" git config --local user.name "brutusthebee[bot]" + # Authenticate git via the gh credential helper using BRUTUS_PAT_TOKEN, + # rather than a token persisted by actions/checkout. + gh auth setup-git - name: Configure Weblate env: diff --git a/.github/zizmor.yml b/.github/zizmor.yml new file mode 100644 index 00000000..b834affd --- /dev/null +++ b/.github/zizmor.yml @@ -0,0 +1,9 @@ +rules: + unpinned-uses: + config: + # Allow BeeWare-provided actions to be unpinned. If an attacker is in a + # position to exploit those action, they're probably able to exploit + # repositories directly; and it's significantly easier for our internal + # actions to automatically be the most recent versions. + policies: + beeware/*: ref-pin diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bb2d5d2c..2dbac6c9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,3 +14,7 @@ repos: hooks: - id: rumdl args: [] + - repo: https://github.com/zizmorcore/zizmor-pre-commit + rev: v1.26.1 + hooks: + - id: zizmor