Skip to content
59 changes: 59 additions & 0 deletions .github/workflows/governance-enforce.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: governance-enforce

# A_BLOCK gate: no-secrets-in-git / secrets-from-doppler / no-hardcoded-paths, enforced on the
# PR diff via the @wave-av/governance package (the org fan-out channel). Diff-scoped: blocks NEW
# violations without failing on legacy debt. Isolated install bypasses any min-release-age policy.
# The org ruleset `governance-a-block-enforce` requires this job's `enforce` check.
#
# VENDORED 2026-08-05 (claude-workstation#1624, E4 T4.9a). This repo was never in that ruleset's
# include list, because the list is 112 hand-maintained names and every one of them matches
# `wave-*`. A naming convention had silently become a security boundary: the repos that publish
# our npm packages — cli, sdk, adk, mcp-server, workflow-sdk — were the ones running with no
# A_BLOCK secrets scan at all. Copied verbatim from wave-moq-edge, and proven on a PUBLIC repo
# before fan-out: wave-av/cli#20, run 31011943790, conclusion success.
#
# DO NOT add this repo to `governance-a-block-enforce` until this check is observed green here.
# A required status check that never reports is a permanent deadlock, not a stricter gate.

on:
pull_request:
push:
branches: [main, master]

permissions:
contents: read
packages: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
enforce:
runs-on: ubuntu-latest
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Comment thread
yakimoto marked this conversation as resolved.
Outdated
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "22"
- name: fetch governance enforcer (isolated install)
run: |
mkdir -p "$RUNNER_TEMP/gov" && cd "$RUNNER_TEMP/gov"
printf '@wave-av:registry=https://npm.pkg.github.com\n//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}\n' > .npmrc
npm install @wave-av/governance@^0.4.4 --no-save --no-audit --no-fund
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
Outdated
Comment thread
qodo-code-review[bot] marked this conversation as resolved.
Outdated
Comment thread
yakimoto marked this conversation as resolved.
Outdated
Comment thread
yakimoto marked this conversation as resolved.
Outdated
- name: A_BLOCK enforce (secrets + hardcoded paths on the diff)
env:
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PUSH_BEFORE_SHA: ${{ github.event.before }}
run: |
BASE="${PR_BASE_SHA:-$PUSH_BEFORE_SHA}"
Comment thread
yakimoto marked this conversation as resolved.
Outdated
Comment thread
yakimoto marked this conversation as resolved.
Outdated
if [ -z "$BASE" ] || [ "$BASE" = "0000000000000000000000000000000000000000" ]; then
BASE=$(git rev-parse HEAD~1 2>/dev/null || git rev-parse HEAD)
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
Outdated
fi
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
Outdated
Comment on lines +96 to +105

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Empty-tree fallback turns the diff-scoped gate into a full-repo scan that will trip on legacy debt

The header states the gate is diff-scoped precisely so it "blocks NEW violations without failing on legacy debt" (lines 4-5). The new fallback makes every tracked file read as added, so any pre-existing hardcoded path or secret-shaped string anywhere in the repo will fail the job. On pull_request this cannot happen (base.sha is always present and fetched), but on a force-pushed branch's push to main, or a root commit, the job would fail for reasons unrelated to the pushed change. That is the intended "loud" behavior, but on push to main it produces a red default-branch build that no one can fix without whitelisting legacy debt — consider whether the fallback should warn-and-scan-full instead of blocking on non-PR events.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

echo "diffing against $BASE"
node "$RUNNER_TEMP/gov/node_modules/@wave-av/governance/bin/enforce.mjs" --changed "$BASE"
Loading