Skip to content

feat(harness): protected-paths guard (issue #94 Layer 2) - #179

Merged
robercano-ghbot merged 2 commits into
mainfrom
feat/issue-94-protected-paths
Jul 21, 2026
Merged

feat(harness): protected-paths guard (issue #94 Layer 2)#179
robercano-ghbot merged 2 commits into
mainfrom
feat/issue-94-protected-paths

Conversation

@robercano-ghbot

Copy link
Copy Markdown
Collaborator

Security: prompt-injection hardening — Layer 2 (protected-paths guard)

Implements Layer 2 of issue #94 (follow-up #164): a deterministic guard so no
agent-authored PR can auto-merge if its diff touches the loop's own control plane.
This does not close #94 — Layers 3 (#165) and 4 (#166) remain.

What changed

  • protectedPaths adapter config — a new top-level glob array in gates.json.
  • merge-ready.sh enforcement — now resolves its adapter via GATES_FILE
    (falls back to the root adapter), and before merging computes the PR's changed
    files (gh pr view --json files) against the adapter's protectedPaths globs
    (deterministic glob→regex, no LLM). A hit blocks the merge and flags the PR
    needs-human (via the shared needs_human_flag seam), skipping only that PR.
    Empty/absent list = no-op.
  • Reviewer hard-reject rule — the correctness lens in .claude/agents/reviewer.md
    now rejects any diff touching a protectedPaths path (with the self-host empty
    override as the documented exception).
  • Testsmerge-ready.test.sh gains scenarios D (protected path blocked +
    labeled), E (clean diff merges), F (empty override disables the guard), and G
    (proves GATES_FILE actually selects the self-adapter override vs. the root
    default — G1 merges vs. G2/G3 block on the SAME fixture, relative + absolute
    path branches).
  • Docsdocs/HARDENING.md gains a Protected-paths guard section (fuller
    writeup deferred to docs: bot-token blast-radius verification + HARDENING.md prompt-injection section (issue #94 Layer 4) #166).

Acceptance (from #94)

"A PR diff touching protected paths is never auto-merged and is flagged, with a
documented self-hosting override." ✅

Gates & review

  • Self-adapter gates green: build / lint / test (32 checks in merge-ready.test.sh).
  • Adversarial review consensus=all: correctness (approve, high) + tests
    (approve, high — mutation-tested that scenario G is sensitive to a
    root-relative-resolution regression).

🤖 Generated with Claude Code

robercano and others added 2 commits July 21, 2026 13:27
…#94 Layer 2)

Add a deterministic protectedPaths guard: an adapter-declared glob array
(GATES_FILE-aware) that merge-ready.sh checks against a PR's changed files
before merging. Any match flips an otherwise-MERGE verdict to
SKIP:protected-paths, labels the PR needs-human, and never auto-merges it,
even with owner approval and green CI. The root adapter ships a protective
default (.claude/**, .github/workflows/**, gates.json); the self-hosted
adapter overrides it to empty since reCode's harness files are the product.
Reviewers get the same hard-reject rule under the correctness lens.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… guard (issue #94 Layer 2)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@robercano-ghbot robercano-ghbot added the needs-human Loop escalated: attempt budget exhausted, manual triage required label Jul 21, 2026
@robercano-ghbot

Copy link
Copy Markdown
Collaborator Author

feat(harness): protected-paths guard (issue #94 Layer 2) (not yet reviewed)

@robercano-ghbot robercano-ghbot removed the needs-human Loop escalated: attempt budget exhausted, manual triage required label Jul 21, 2026
@robercano-ghbot
robercano-ghbot merged commit 204d95d into main Jul 21, 2026
9 checks passed
@robercano-ghbot
robercano-ghbot deleted the feat/issue-94-protected-paths branch July 21, 2026 13:46
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.

Security: prompt-injection hardening — fence untrusted issue/PR text, protected-paths guard, pre-merge threat scan

2 participants