From 5b1d60a22d2ec60f53383e44395438d9f851a6b5 Mon Sep 17 00:00:00 2001 From: ilovepixelart Date: Tue, 17 Nov 2026 17:03:08 +0100 Subject: [PATCH 1/3] Harden CI workflows: timeouts, zizmor, aggregate CI job - timeout-minutes on every job in pr-check, publish, codeql and pi-canary. - pr-check: npm audit signatures after install; a zizmor job (pinned setup-uv, zizmor 1.32.0, .github/zizmor.yml requiring SHA pins); a final CI job that needs every other job and fails unless each one succeeded. - publish: fixed concurrency group with cancel-in-progress false, and package-manager-cache: false on every setup-node so no cache is restored in a release run (zizmor cache-poisoning). - pi-canary: the npm install of @latest pi packages carries an inline zizmor ignore for adhoc-packages, since installing the newest release is the purpose of that job. --- .github/workflows/codeql.yaml | 1 + .github/workflows/pi-canary.yaml | 5 +++- .github/workflows/pr-check.yaml | 49 +++++++++++++++++++++++++++++++- .github/workflows/publish.yaml | 15 +++++++++- .github/zizmor.yml | 6 ++++ 5 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 .github/zizmor.yml diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index 7680b778..365cc6e9 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -17,6 +17,7 @@ jobs: analyze: name: Analyze runs-on: ubuntu-latest + timeout-minutes: 15 permissions: contents: read security-events: write diff --git a/.github/workflows/pi-canary.yaml b/.github/workflows/pi-canary.yaml index 0095de9c..2a4dbca4 100644 --- a/.github/workflows/pi-canary.yaml +++ b/.github/workflows/pi-canary.yaml @@ -15,6 +15,7 @@ jobs: canary: name: Check against latest pi runs-on: ubuntu-latest + timeout-minutes: 15 steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -31,7 +32,9 @@ jobs: run: npm ci --ignore-scripts - name: Upgrade pi packages to latest - run: npm install --no-save --ignore-scripts @earendil-works/pi-agent-core@latest @earendil-works/pi-ai@latest @earendil-works/pi-coding-agent@latest @earendil-works/pi-tui@latest + # Installing the newest unlocked release is the point of this job; it holds + # only contents: read and runs no install scripts. + run: npm install # zizmor: ignore[adhoc-packages] --no-save --ignore-scripts @earendil-works/pi-agent-core@latest @earendil-works/pi-ai@latest @earendil-works/pi-coding-agent@latest @earendil-works/pi-tui@latest - name: Report the versions under test run: npm ls @earendil-works/pi-coding-agent @earendil-works/pi-ai || true diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml index 89128b75..fc819cf4 100644 --- a/.github/workflows/pr-check.yaml +++ b/.github/workflows/pr-check.yaml @@ -15,7 +15,7 @@ permissions: # A superseded push to a pull request is dead weight; cancel it. Every main commit needs # its own result and its own Sonar main-branch analysis, so a push gets a group of its own: # a shared group holds one pending run, and a third push replaced the second's. -# Releases are unaffected (publish.yaml has no concurrency group). +# Releases are unaffected (publish.yaml has a group of its own). concurrency: group: pr-check-${{ github.event_name == 'pull_request' && github.ref || github.sha }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} @@ -24,6 +24,7 @@ jobs: check: name: Biome, Types & Tests runs-on: ${{ matrix.os }} + timeout-minutes: 15 permissions: contents: read strategy: @@ -55,6 +56,9 @@ jobs: # execute in every PR. run: npm ci --ignore-scripts + - name: Verify provenance signatures + run: npm audit signatures + - name: Check run: npm run check @@ -81,6 +85,7 @@ jobs: smoke: name: Headless e2e smoke runs-on: ${{ matrix.os }} + timeout-minutes: 15 strategy: fail-fast: false matrix: @@ -107,3 +112,45 @@ jobs: # asserts the exact provider payload; no real model or network needed. shell: bash run: bash scripts/e2e-smoke.sh + + zizmor: + name: Workflow audit (zizmor) + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Install uv + uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3 + with: + enable-cache: false + + - name: Audit workflows + run: uvx zizmor@1.32.0 --config .github/zizmor.yml --format=plain .github/workflows + + ci: + # The single status a ruleset can require: it stays red unless every job above + # succeeded. None of them is conditional, so a skipped job counts as a failure. + name: CI + needs: [check, smoke, zizmor] + if: always() + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: {} + steps: + - name: Require every job to succeed + env: + RESULTS: ${{ toJSON(needs.*.result) }} + run: | + set -euo pipefail + echo "Job results: $RESULTS" + if jq -e 'all(.[]; . == "success")' <<< "$RESULTS" > /dev/null; then + exit 0 + fi + echo "At least one required job did not succeed." >&2 + exit 1 diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 1d011af9..bc4e2913 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -17,6 +17,12 @@ on: permissions: contents: read +# One publish at a time, and never cancel one midway: a cancelled run can leave a +# release with its attestation uploaded but the package unpublished. +concurrency: + group: publish + cancel-in-progress: false + jobs: # The check runs the dev toolchain (vitest, biome, knip, tsc) and every devDependency it # loads, so it holds no token: a compromised one cannot mint the OIDC token the build @@ -24,6 +30,7 @@ jobs: check: name: Check runs-on: ubuntu-latest + timeout-minutes: 15 permissions: contents: read steps: @@ -39,7 +46,9 @@ jobs: uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: 24.x - cache: npm + # No cache anywhere in a release run: a poisoned cache entry would feed + # the commit that gets tagged, packed and published. + package-manager-cache: false - name: Install dependencies run: npm ci --ignore-scripts @@ -51,6 +60,7 @@ jobs: name: Build, attest, and pack needs: [check] runs-on: ubuntu-latest + timeout-minutes: 15 permissions: contents: write # upload the attestation bundle to the triggering release id-token: write # OIDC token for Sigstore keyless signing @@ -74,6 +84,7 @@ jobs: with: node-version: 24.x registry-url: https://registry.npmjs.org + package-manager-cache: false - name: Verify the tag matches package.json env: @@ -132,6 +143,7 @@ jobs: name: Publish to npm needs: [build] runs-on: ubuntu-latest + timeout-minutes: 15 permissions: contents: read id-token: write # npm provenance attestation via OIDC trusted publisher @@ -141,6 +153,7 @@ jobs: with: node-version: 24.x registry-url: https://registry.npmjs.org + package-manager-cache: false - name: Download tarball artifact uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 diff --git a/.github/zizmor.yml b/.github/zizmor.yml new file mode 100644 index 00000000..b8e0c723 --- /dev/null +++ b/.github/zizmor.yml @@ -0,0 +1,6 @@ +rules: + unpinned-uses: + config: + policies: + # Every action, first-party included, is pinned to a full commit SHA. + "*": hash-pin From b1a63a6a95be7eb921094ccd369cb5d1abc79e7a Mon Sep 17 00:00:00 2001 From: ilovepixelart Date: Tue, 17 Nov 2026 17:03:08 +0100 Subject: [PATCH 2/3] Group vitest updates and match the biome schema to 2.6.8 Dependabot gets a vitest group (vitest, @vitest/*) after the pi group, so vitest and its plugins move together. biome.json's $schema now names the installed Biome version. --- .github/dependabot.yml | 2 ++ biome.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index e7565ea3..17873870 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -15,6 +15,8 @@ updates: # moves as one set. pi: patterns: ["@earendil-works/*"] + vitest: + patterns: ["vitest", "@vitest/*"] minor-and-patch: update-types: ["minor", "patch"] security: diff --git a/biome.json b/biome.json index f50923c7..826c3aae 100644 --- a/biome.json +++ b/biome.json @@ -1,5 +1,5 @@ { - "$schema": "https://biomejs.dev/schemas/2.6.6/schema.json", + "$schema": "https://biomejs.dev/schemas/2.6.8/schema.json", "vcs": { "enabled": false, "clientKind": "git", From 4603482675f96815132aedb589d0ebe1931de3e2 Mon Sep 17 00:00:00 2001 From: ilovepixelart Date: Tue, 17 Nov 2026 17:04:20 +0100 Subject: [PATCH 3/3] Move the pi-canary zizmor ignore out of the shell command The inline "# zizmor: ignore" sat inside the run command, so the shell treated the --no-save, --ignore-scripts and @latest arguments as a comment and ran a bare npm install. The ignore is now its own YAML comment line and the command is unchanged from before the hardening commit. --- .github/workflows/pi-canary.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pi-canary.yaml b/.github/workflows/pi-canary.yaml index 2a4dbca4..65b6bfce 100644 --- a/.github/workflows/pi-canary.yaml +++ b/.github/workflows/pi-canary.yaml @@ -34,7 +34,8 @@ jobs: - name: Upgrade pi packages to latest # Installing the newest unlocked release is the point of this job; it holds # only contents: read and runs no install scripts. - run: npm install # zizmor: ignore[adhoc-packages] --no-save --ignore-scripts @earendil-works/pi-agent-core@latest @earendil-works/pi-ai@latest @earendil-works/pi-coding-agent@latest @earendil-works/pi-tui@latest + # zizmor: ignore[adhoc-packages] + run: npm install --no-save --ignore-scripts @earendil-works/pi-agent-core@latest @earendil-works/pi-ai@latest @earendil-works/pi-coding-agent@latest @earendil-works/pi-tui@latest - name: Report the versions under test run: npm ls @earendil-works/pi-coding-agent @earendil-works/pi-ai || true