Engineering Notes · CI Systems · 2026-11-13

Four-Quadrant Patch Verification in CI: Proving a Security Fix Blocks the Bug Without Breaking Invariants.

Most security-fix pipelines prove one quadrant: the repro passes after the patch. That is the weakest possible claim. A patch is only verified when the repro demonstrably fails before the patch, passes after it, and every functional invariant survives both builds.

Posted 2026-11-13 · 11 min read · Companion tool: Silvauren/sarif-patch-verifier (staging)

TL;DR Build the patch commit and its parent, run the vulnerability repro and the functional invariant suite against both, and gate on all four cells of the resulting 2×2. Emit the verdict as SARIF 2.1.0 so the quadrants show up as code-scanning results next to the diff that caused them.

The vacuous green

Here is a pattern that has cost real teams real months: a fix lands with a test named test_no_longer_vulnerable, the test passes in CI, the ticket closes. Later, someone reverts the fix and the test still passes it never depended on the fix. The test was asserting nothing about the vulnerability; it was green before, during, and after. We call this a vacuous green, and the only way to detect it mechanically is to run the test against a build that provably contains the bug.

A repro that cannot fail is not a repro. The pre-patch quadrant exists to falsify your own test before an attacker does it for you.

The four quadrants

Vulnerability reproFunctional invariants
Pre-patch build (parent commit) Must FAIL proves the repro can detect the bug (non-vacuous) Must PASS establishes the baseline was healthy before your change
Post-patch build (fix commit) Must PASS proves the fix blocks the demonstrated attack Must PASS proves the fix did not over-block legitimate behavior

Each cell failure has a distinct meaning and a distinct owner:

Failed cellMeaningAction
Q1 pre-patch repro passedVacuous repro, it never depended on the bugRewrite the repro; do not merge
Q2 pre-patch invariants failedBaseline was already brokenBisect separately; the fix PR is the wrong vehicle
Q3 post-patch repro failedThe fix does not block the attackFix the fix; obviously do not merge
Q4 post-patch invariants failedOver-blocking / collateral behavior changeNarrow the fix or accept and document the behavior change explicitly

Q1 is the anti-flake anchor. A repro that flakes between pass and fail pre-patch will also flake post-patch; the quadrant framing converts "sometimes red" into a deterministic merge blocker, forcing the repro to be made deterministic (seeded, clock-frozen, hermetic) before it can guard anything.

Wiring it into CI

The two builds come from the merge-base: the fix commit, and its parent. The repro and invariant suites run against both artifacts; a final job folds the four exit codes into one verdict.

jobs:
  build:
    strategy:
      matrix:
        target: [patched, baseline]
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 2
      - if: matrix.target == 'baseline'
        run: git checkout HEAD~1            # parent commit: provably contains the bug
      - run: make build                      # artifact per matrix leg
      - run: bin/run-repro-suite    --sarif repro.json
      - run: bin/run-invariants     --sarif invariants.json
      - uses: actions/upload-artifact@v4
        with: { name: quad-${{ matrix.target }}, path: '*.json' }

  verdict:
    needs: build
    steps:
      - run: bin/quad-verdict               # reads all four artifact results
        # exit 0  - all four quadrants as required
        # exit 10 - vacuous repro (Q1)
        # exit 11 - post-patch repro still fails (Q3)
        # exit 12 - invariant regression (Q4)
        # exit 13 - dirty baseline (Q2)
      - uses: github/codeql-action/upload-sarif@v3
        if: always()
        with: { sarif_file: quad-verdict.sarif }

SARIF 2.1.0 output

The verdict lands where review happens, as code-scanning results attached to the fix diff. Each quadrant is a result with a rule that encodes its semantics:

{
  "$schema": "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
  "version": "2.1.0",
  "runs": [{
    "tool": { "driver": { "name": "sarif-patch-verifier", "version": "1.0.0" } },
    "results": [
      {
        "ruleId": "QUAD1_VACUOUS_REPRO",
        "level": "error",
        "message": { "text": "Vulnerability repro PASSED against the pre-patch build; it does not depend on the fixed defect." },
        "locations": [{ "physicalLocation": { "artifactLocation": { "uri": "tests/repro/auth_bypass.py" } } }],
        "properties": { "quadrant": "pre_patch+vuln", "expected": "fail", "observed": "pass" }
      },
      {
        "ruleId": "QUAD4_INVARIANT_REGRESSION",
        "level": "error",
        "message": { "text": "2 of 214 functional invariants failed post-patch: legacy-client handshake, streaming content-range." },
        "properties": { "quadrant": "post_patch+invariants", "failed": 2, "total": 214 }
      }
    ]
  }]
}

Stable ruleIds matter more than prose: they let you trend quadrant failures over time and answer, with a query, "how many of our security tests were vacuous last quarter?"

Costs and limits

Status

The matrix runner, four-way verdict logic, and SARIF emitter described here are packaged as Silvauren/sarif-patch-verifier. It is CI-provider agnostic: anything that can run a command and upload an artifact can host it.