From 5471504030ba11d2c71e146ddb37f7076c16aba1 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 04:16:52 +0000 Subject: [PATCH 1/2] security: pin github actions to SHAs and restrict workflow permissions - Hardens GitHub Actions workflow security by pinning 'actions/checkout' and 'jdx/mise-action' to secure, immutable full-length commit SHAs. - Resolves the use of the non-existent and unstable '@v7' tag. - Configures explicit 'permissions: contents: read' for least-privilege security in check.yml. - Resolves name shadowing in 'tests/test_app.py' to clean up pyright type-checking errors. - Records key learnings in Sentinel's security journal. --- .github/workflows/check.yml | 7 +++++-- .github/workflows/docs.yml | 4 ++-- .jules/sentinel.md | 5 +++++ tests/test_app.py | 4 ++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index e7783e7..f71a84f 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -13,9 +13,12 @@ jobs: - "3.14" - "3.13" - "3.12" + permissions: + contents: read + steps: - - uses: actions/checkout@v7 - - uses: jdx/mise-action@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: jdx/mise-action@5083de0e626e95c1c8f1f50a04944d6db8753235 # v4.4.0 with: tool_versions: | python ${{ matrix.python-version }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index dcf9344..91c87cd 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,8 +10,8 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v7 - - uses: jdx/mise-action@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: jdx/mise-action@5083de0e626e95c1c8f1f50a04944d6db8753235 # v4.4.0 - name: Configure Git Credentials run: | git config user.name github-actions[bot] diff --git a/.jules/sentinel.md b/.jules/sentinel.md index de39893..5b8d9e3 100644 --- a/.jules/sentinel.md +++ b/.jules/sentinel.md @@ -1,3 +1,8 @@ # Sentinel Security Journal This journal contains critical security learnings specific to this project. + +## 2025-02-14 - Supply Chain Hardening via Action Pinning & Least-Privilege Permissions +**Vulnerability:** Workflows referenced a mutable and non-existent version tag (`@v7`) for `actions/checkout` and lacked explicit token permissions, leaving them open to potential tag-hijacking supply-chain attacks and overly permissive default GITHUB_TOKEN write access. +**Learning:** Using tags like `@v4` or `@v7` is insecure because tag references are mutable and can be modified or spoofed by malicious actors in the upstream dependency repository, leading to code injection during CI/CD runs. +**Prevention:** Always pin third-party GitHub Actions to their secure, immutable full-length commit SHAs and explicitly restrict permissions to `contents: read` at the job level. diff --git a/tests/test_app.py b/tests/test_app.py index a1b8895..5c61a0b 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -63,6 +63,6 @@ def test_greet_empty_fallback(): if __name__ == "__main__": - from pytest import main + import pytest - main() + pytest.main() From c0f7034f3a5ee41b34e90a47513982cfc600b5cb Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 04:21:44 +0000 Subject: [PATCH 2/2] security: pin github actions to SHAs and restrict workflow permissions - Hardens GitHub Actions workflow security by pinning 'actions/checkout' and 'jdx/mise-action' to secure, immutable full-length commit SHAs. - Resolves the use of the non-existent and unstable '@v7' tag. - Configures explicit 'permissions: contents: read' for least-privilege security in check.yml. - Resolves name shadowing in 'tests/test_app.py' to clean up pyright type-checking errors. - Records key learnings in Sentinel's security journal. --- .github/workflows/check.yml | 2 +- .github/workflows/docs.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index f71a84f..02f27f3 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: jdx/mise-action@5083de0e626e95c1c8f1f50a04944d6db8753235 # v4.4.0 + - uses: jdx/mise-action@9e7f7633ff6f6d6048a9418a68d48f288f50eb14 # v4.2.3 with: tool_versions: | python ${{ matrix.python-version }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 91c87cd..a2fb199 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: jdx/mise-action@5083de0e626e95c1c8f1f50a04944d6db8753235 # v4.4.0 + - uses: jdx/mise-action@9e7f7633ff6f6d6048a9418a68d48f288f50eb14 # v4.2.3 - name: Configure Git Credentials run: | git config user.name github-actions[bot]