Skip to content

Close the loop: recursive review, agent enforcement, a recall index, and dogfooded distribution - #56

Open
kridaydave wants to merge 37 commits into
mainfrom
feat/close-the-loop
Open

Close the loop: recursive review, agent enforcement, a recall index, and dogfooded distribution#56
kridaydave wants to merge 37 commits into
mainfrom
feat/close-the-loop

Conversation

@kridaydave

Copy link
Copy Markdown
Contributor

Close the loop: recursive review, agent enforcement, a recall index, and dogfooded distribution

Four campaigns took blueline from a single-release delta reviewer to a
closed-loop, agent-enforced, networked, self-distributed supply-chain
gate. The goal mandated one branch for the entire four-phase run, so
this is one PR instead of the stacked per-campaign set — the campaign
and slice boundaries are recorded as rulings in TODO.md (night-run
convention) and every slice passed the fmt/clippy/test gate with
adversarial review rounds before the next one started.

Summary:

  • Recursive review (Campaign 1). Both documented attacks (TanStack
    worm, Atomic Arch) delivered through a second-order install nobody
    reviewed. Now every install reference inside a reviewed payload — npm
    lifecycle scripts, PKGBUILD npm install/bun delivery, wheel
    .data/scripts — is itself reviewed: depth-capped (policy
    [recursion] max_depth, default 3), cycle-safe (A → B → A is cut and
    disclosed), memoized so referenced packages are never re-downloaded,
    and rolled up into the parent verdict (R24R27; a child HIGH can
    BLOCK the parent). R23_NPM_DELIVERY graduates INFO → MEDIUM now that
    the delivery line is resolved. The verdict JSON grows a recursive
    array (delivery chain, band, findings), so the card, CI reports, and
    the MCP tool all inherit it. New rules: R24R28.
  • Agent-native enforcement (Campaign 2). blueline agent review
    gives autonomous agents a policy-bound, never-interactive gate (JSON
    verdict on stdout, exit 0/2/1, no baseline blessing, audit trail with
    the agent's identity). blueline agent gate is the hook binding for
    Claude Code PreToolUse and Cursor beforeShellExecution — one
    scanner grammar, fail closed on every error path, dynamic and
    registry-override shapes denied. blueline shim install npm npx pip pip3 cargo yay paru routes real installs through the gate, with the
    bypass list documented rather than hidden. Recipes and the honest
    bypass list are in the README.
  • Recall / revocation index (Campaign 3). The last unchecked README
    box: blueline recall serve (std-only loopback HTTP),
    recall sync (bounded fetch, fail-closed validation, monotonic
    sequence), recall export-candidates (audit log → human curation).
    Index hits fold into the advisory engine and BLOCK via the existing
    R09 path; staleness is disclosed (R28) and can BLOCK by policy.
    The SQLite store is untouched — the snapshot lives in a validated
    JSON file.
  • Dogfood & distribution (Campaign 4). The npm launcher shims now
    carry the full published platform matrix (a darwin/macOS user used to
    get a launcher with no binary); the release workflow builds the
    missing linux-arm64-musl package and attests SLSA build provenance
    for the GitHub-release binaries. crates.io metadata, a Homebrew
    formula, and an AUR scaffold (reviewed by blueline's own PKGBUILD
    heuristics — see tests/self_review.rs) ship in-repo. Nothing is
    published: registry pushes stay a human-confirmed step.
  • Self-CI: blueline ci runs on our own package-lock.json and
    Cargo.lock in CI; verified locally green (PASSED, exit 0 on both),
    agent review serde_json@1.0.151 → LOW, npx blueline cold start
    works through the launcher.

Use-it evidence (real binary, real runs):

  • Adversarial A→B fixture chain: blueline review a@1.0.0 → BLOCK at
    score 100, card renders delivered via: a@1.0.0 → npm:b@1.0.0, the
    child's backdoored postinstall surfaces as BLOCK, R27 rolls it up —
    nothing executed (pinned in tests/recursive_review.rs).
  • Live AUR review of webtorrent-desktop: real RPC + clone + diff; R23
    fired at MEDIUM on the npm delivery lines (bare npm install
    correctly produces no recursive child).
  • Real npm install through an installed shim in a sandboxed project:
    unapproved package blocked (no node_modules created), allowlisted
    package installed for real; Claude Code and Cursor hook payloads
    denied/allowed with agent:claude-code / agent:cursor audit rows.
  • Recall index e2e: served a curated snapshot, synced it, a
    clean-looking revoked release BLOCKed via blueline-recall; stale
    index disclosed at MEDIUM and escalated to BLOCK with
    block_on_stale; backward-sequence sync refused
    (tests/recall_cli.rs).

Review process: every slice ran the fmt/clippy/test gate and three
subagent reviewers (adversarial security, test auditor, fresh-eyes) in
parallel; P1/P2 findings were fixed and re-reviewed until clean. The
agent gate in particular went through three hardening rounds (error
paths now deny, per-ecosystem registry routing, flag/override/comment
scanner shapes) with empirical verification of every fixed shape.

PR made by zai-start-plan/glm-5.3-flash from zcode on behalf of Kriday.

…dget caps

References found in a reviewed payload (npm lifecycle scripts, PKGBUILD
npm/bun delivery, wheel .data/scripts) are re-reviewed through the same
engine: Verdict gains a recursive ChildReview array (single source of
truth for CLI/CI/MCP), policy gains [recursion] caps, and R24/R25/R26/R27
disclose references, caps, cycles, and roll-ups fail closed. The child
memo and shared per-ecosystem registries mean referenced packages are
never re-downloaded mid-review.
… MEDIUM

The review card renders each child review's delivery chain, band, and
worst findings (bounded, never silent). R23_NPM_DELIVERY graduates from
INFO now that recursion resolves what delivery lines point at, with the
three benign-corpus electron fixtures pinned as true positives. New fuzz
target covers the install-reference scanner; two pre-existing fuzz
targets were missing the libfuzzer import and never compiled.
@kridaydave kridaydave self-assigned this Sep 12, 2026
P1: shared child_ecosystem routing (cargo/AUR no longer reviewed as npm),
basename manager matching for absolute-path invocations, env-redirect
deny/disclose shapes, unpinned refs always resolve latest.
P2: PyPI-scoped canonicalization, quoted-manager denies, continuation
joining, recall normalization, agent ignores BLUELINE_POLICY without
--policy, 11-manager shims, R28/R00 escalation, packaging/CI matrix and
dogfood/mutation fixes, ARCHITECTURE docs.
…ogfood health gate

Extend mutant coverage to install_ref/recursive/agent/recall/shim plus
pkgbuild/render/policy and pin every surviving mutant with boundary
tests: stdin/size caps, validate bounds, version equivalence, stale and
sequence edges, serve limits, cache reload, manager arms and guards.
Drop the unchanged_count dogfood assertion: version-bump PRs
legitimately evaluate with zero unchanged packages.
Fix yay/paru verb search starting past flag-verbs so 'yay -S foo'
resolves instead of scanning silent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant