From cfa73122e98a2a7d98020b81dbf5c1cca058a24c Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 14 Jun 2026 16:50:42 +0000 Subject: [PATCH 1/2] ci: fix invalid instant-sync (K9-SVC indent) + Scorecard enforcer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit instant-sync.yml: the "K9-SVC Validation" block was a YAML sequence item (`- name:` at 2-space indent) placed directly under the `jobs:` mapping, which is a parse error — the whole workflow was invalid (run fails at validation with zero jobs). Converged onto the canonical instant-sync: K9-SVC is now a proper step inside the dispatch job, and the propagation dispatch is presence-gated via a job-level env var (the `secrets` context is invalid inside `if:`). scorecard-enforcer.yml: the scorecard job invoked ossf/scorecard-action with publish_results: true AND a run: step in the same job, which OSSF rejects with HTTP 400 ("scorecard job must only have steps with `uses`"), failing the run. Split into an uses-only publish job + an unprivileged JSON score-gate (reads top-level `.score`; the SARIF aggregate path is absent so the old gate always read 0 and failed < 5). Least-privilege contents:read, timeouts, SHA pins. https://claude.ai/code/session_01VwbFNQJw23tW8tqM7utWku --- .github/workflows/instant-sync.yml | 16 +++++++--- .github/workflows/scorecard-enforcer.yml | 37 ++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/.github/workflows/instant-sync.yml b/.github/workflows/instant-sync.yml index 9aeabde..3c656eb 100644 --- a/.github/workflows/instant-sync.yml +++ b/.github/workflows/instant-sync.yml @@ -11,11 +11,19 @@ on: permissions: contents: read +# NOTE: the `secrets` context is not available in `if:` conditionals, so the +# token-presence gate routes through a job-level `env:` var and the step +# tests `env.FARM_DISPATCH_TOKEN`. Referencing `secrets.*` directly in `if:` +# invalidates the workflow (the run fails at validation with zero jobs). jobs: dispatch: runs-on: ubuntu-latest + timeout-minutes: 15 + env: + FARM_DISPATCH_TOKEN: ${{ secrets.FARM_DISPATCH_TOKEN }} steps: - name: Trigger Propagation + if: env.FARM_DISPATCH_TOKEN != '' uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v3 with: token: ${{ secrets.FARM_DISPATCH_TOKEN }} @@ -32,7 +40,7 @@ jobs: - name: Confirm run: echo "::notice::Propagation triggered for ${{ github.event.repository.name }}" - - name: K9-SVC Validation - run: | - echo "K9-SVC validation" - [ -d .machine_readable/contractiles ] && echo "Contractiles present" || echo "No contractiles" + - name: K9-SVC Validation + run: | + echo "K9-SVC validation" + [ -d .machine_readable/contractiles ] && echo "Contractiles present" || echo "No contractiles" diff --git a/.github/workflows/scorecard-enforcer.yml b/.github/workflows/scorecard-enforcer.yml index 6933b78..5c33aa3 100644 --- a/.github/workflows/scorecard-enforcer.yml +++ b/.github/workflows/scorecard-enforcer.yml @@ -21,8 +21,15 @@ permissions: contents: read jobs: + # Publish job. The OSSF attestation flow requires that a job invoking + # ossf/scorecard-action with publish_results: true contain ONLY `uses:` + # steps (no `run:`). A `run:` step in this job makes the OSSF publish + # endpoint reject the upload with HTTP 400 ("scorecard job must only have + # steps with `uses`"), failing the whole workflow. Score enforcement is + # therefore split into the separate unprivileged `score-gate` job below. scorecard: runs-on: ubuntu-latest + timeout-minutes: 15 permissions: security-events: write id-token: write # For OIDC @@ -43,10 +50,35 @@ jobs: with: sarif_file: results.sarif + # Unprivileged enforcement gate. Re-derives the score read-only (no + # publish, no id-token), so it may legally contain a `run:` step. + # NOTE: uses JSON output deliberately. The SARIF format does NOT carry the + # aggregate score at .runs[0].tool.driver.properties.score (it is absent + # there, so a SARIF-based gate reads the `// 0` fallback and ALWAYS fails + # the < MIN_SCORE check); the JSON format exposes the aggregate at the + # top-level `.score`. publish_results is false here and does not affect the + # computed score, so enforcement behaviour is unchanged. + score-gate: + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + contents: read + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Run Scorecard (analysis only) + uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3 + with: + results_file: results.json + results_format: json + publish_results: false + - name: Check minimum score run: | - # Parse score from results - SCORE=$(jq -r '.runs[0].tool.driver.properties.score // 0' results.sarif 2>/dev/null || echo "0") + # JSON output carries the aggregate score at the top-level `.score`. + SCORE=$(jq -r '.score // 0' results.json 2>/dev/null || echo "0") echo "OpenSSF Scorecard Score: $SCORE" @@ -61,6 +93,7 @@ jobs: # Check specific high-priority items check-critical: runs-on: ubuntu-latest + timeout-minutes: 15 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 From 34068165f65a10676f1e9731b3315ac185e06fca Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 15 Jun 2026 09:54:49 +0000 Subject: [PATCH 2/2] ci: re-trigger checks on dev branch The initial push of this branch did not create any workflow runs (no run object was produced), so this empty commit re-triggers the CI / governance / scorecard checks for the draft PR. https://claude.ai/code/session_01VwbFNQJw23tW8tqM7utWku