Guides
Running patchbay in GitHub Actions with SARIF upload
January 7, 2027 · patchbay
What this gets you
- A patchbay audit on every PR, with no server to host.
- SARIF findings in the GitHub Security tab, indexed next to CodeQL and whatever other scanners you already run.
- An exit-code gate that blocks merges on critical findings.
- Zero cost on top of what GitHub Actions already charges per minute.
If this is new, you only need the CLI and one upload step. No action package to install, no auth tokens to rotate, no third-party service.
The workflow
Drop this at .github/workflows/patchbay-audit.yml. It runs on every PR to main.
name: patchbay audit
on:
pull_request:
branches: [main]
permissions:
contents: read
security-events: write
pull-requests: read
jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: patchbay audit
run: |
npx --yes @patchbay-nebius/audit-core@0.14 audit . \
--sarif \
--out patchbay.sarif \
--fail-on=high
- name: Upload SARIF to GitHub Security
if: always()
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: patchbay.sarif
category: patchbay
if: always() on the upload step is intentional. Even when the audit exits non-zero because findings exceeded the gate, we still want the SARIF in Security so the reviewer can see what blocked.
Auditing a running endpoint instead of the source tree
For remote scans (a preview deployment, a staging host), swap the positional:
- name: patchbay audit staging
run: |
npx --yes @patchbay-nebius/audit-core@0.14 audit \
https://staging.example.com/mcp \
--sarif \
--out patchbay.sarif \
--fail-on=high
The CLI auto-detects whether the positional is a URL, a directory, or (with --stdio) a child-process command.
Auth-walled endpoints
If the staging endpoint is behind a bearer, pass it in as --auth= (or --auth-header= for custom header names). Store the value in a repository secret, never in the workflow file.
- name: patchbay audit staging with bearer
env:
PATCHBAY_STAGING_TOKEN: ${{ secrets.PATCHBAY_STAGING_TOKEN }}
run: |
npx --yes @patchbay-nebius/audit-core@0.14 audit \
https://staging.example.com/mcp \
--auth="$PATCHBAY_STAGING_TOKEN" \
--sarif \
--out patchbay.sarif \
--fail-on=high
The audit report marks every reachable check with a scanSource: authenticated-user badge so readers can see which findings had real auth-walled coverage.
Repository scanning (connected hosted)
When you connect your repo to the hosted version of patchbay (available with the Single plan at launch on 01.01.2027), the backend picks up SRC-SHELL-001 and SRC-DEP-001 on every push to main. Those checks work in the CLI too: pass the repository root as the audit target.
npx --yes @patchbay-nebius/audit-core@0.14 audit . --sarif --out patchbay.sarif
SRC-SHELL-001 flags source code (handler, library or build script) that passes dynamic input into a shell sink (exec/spawn with shell, subprocess with shell=True, asyncio.create_subprocess_shell, os.system, eval, new Function). Findings in an MCP tool handler fire at critical; findings in a build/release script fire at low. SRC-DEP-001 flags MCP SDK versions whose lockfile-resolved version lands inside a known-vulnerable range (CVE-2026-52869 for mcp Python, CVE-2026-25536 for @modelcontextprotocol/sdk). A declared range with no lockfile falls back to medium — the range might still resolve safe.
Gate behavior
--fail-on accepts critical, high, medium, low, or info. The CLI exits non-zero when any finding at that severity or above is emitted.
Common settings:
--fail-on=critical: block on critical only. Use during rollout, when the FP shape is still being learned.--fail-on=high: block on critical and high. Reasonable default for mature deployments.--fail-on=medium: strict. Expect to triage weekly.
A finding downgraded by a public-by-design classifier (ai-catalog declaration, PRM-without-OAuth, all-read-shaped-tools) stays at info and does not trip any gate.
SARIF, GitHub Security, and the inline review
Once the SARIF lands, GitHub's Security tab lists each finding with the check ID (AUTH-001, HEADERS-001.5, SRC-SHELL-001). Clicking through shows the evidence, the file-and-line for source checks, the fix recommendation, and the patchbay docs URL.
The category: patchbay annotation separates these findings from CodeQL and other scanners that write into the same SARIF ingest, so the two sets do not collide and each has its own fix cadence.
FAQ
Can I run this on a monorepo and scan only one service?
Yes. Pass the service's subdirectory as the positional: patchbay audit services/mcp-gateway. The directory probe stops at node_modules, .git, dist, .next, __pycache__ by default so unrelated subtrees do not contaminate the scan.
Does this work on GitHub Enterprise Server?
The CLI itself has no GitHub dependency. The SARIF upload action (github/codeql-action/upload-sarif@v3) is supported on Enterprise Server 3.9 and later.
Does patchbay run without network access during audit?
Source-directory audits are offline. Remote-URL audits need network access to the target endpoint. The CLI never phones home; the entire audit stays in your Actions runner.
What about SARIF schema conformance?
patchbay emits SARIF 2.1.0 ($schema: sarif-schema-2.1.0.json). It validates against the OASIS schema. If the upload fails for schema reasons on your Enterprise Server, open an issue with the SARIF and we will track the gap.
How often does the CLI update, and do I have to pin?
We cut a release on the first of every month (ninth of the month if the first is a weekend). Pin to a major.minor in CI (@0.14) and bump deliberately, same discipline as any other security-gating dep.