Skip to content

fix(review): stop forged proof headings in model prose from flipping PR verdicts - #1048

Merged
steipete merged 4 commits into
mainfrom
steipete/fix-951-report-section-spoofing
Aug 6, 2026
Merged

steipete merged 4 commits into
mainfrom
steipete/fix-951-report-section-spoofing

Conversation

@steipete

@steipete steipete commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #951.

A forged ## Real Behavior Proof block inside model-authored prose (echoed from an attacker-controlled PR body into the report summary) flipped a PR's proof verdict from blocked to sufficient, routing unproven external PRs into the automated repair lane. Verified against shipped dist/ entry points in all four shapes: bare, fenced, <details>, HTML comment.

What changed

Write side (clawsweeper-decision-parser.ts): every model-authored prose field that lands in a report section body now passes through neutralizeOwnedSectionSpoofing (summary, changeSummary, bestSolution, risks, evidence, label justifications, merge-risk options, review metrics, owners, findings, security concerns). Structural metadata scalars (file paths, SHAs, commands, commit lists) are single-line-enforced so a newline cannot smuggle a heading or front-matter line. clawsweeper-report-helpers.ts additionally normalizes U+2028/U+2029 line separators before per-line heading checks.

Read side (protects already-published unescaped reports, re-read every sweep cycle): front-matter reads are bounded to the leading --- block, duplicate/empty keys report as ambiguous, and proof/rating readers treat ambiguous or out-of-enum metadata as missing + needs-contributor-action — verdicts can only get stricter, never looser. The duplicate legacy readers in src/repair/workflow-utils.ts and src/repair/create-job.ts now prefer validated bounded front matter over section text and fail closed (no promotion) on invalid metadata.

Real Behavior Proof

  • Claim: forged proof headings in model prose can no longer flip proof verdicts or routing markers.
  • Exercised surface: shipped dist/ production entry points (parseDecision, reviewAutomationMarkersFromReport, report proof/rating readers), no mocks.
  • Scenario: model decision whose summary carries a forged ## Real Behavior Proof block claiming sufficient, while genuine metadata says missing, pr_rating_overall: F, work_candidate: queue_fix_pr; all four forgery shapes.
  • Red (unfixed origin/main): routing=clawsweeper-verdict:needs-changes clawsweeper-action:fix-required, proof=diamond lobster (5/6) — 4 of 21 driver assertions fail.
  • Green (this branch): routing=clawsweeper-verdict:needs-human, proof=unranked krab (1/6), no fix-required marker — 4/4 variants pass; the driver is kept as regression tests.
  • Validation: pnpm run build:all, focused suites 162/162, full pnpm run check 3,155 pass / 0 fail (9 platform skips), pnpm run lint, pnpm run format:check; independent rerun of the four focused suites: 101/101.
  • Limits: legacy durable records written before this hardening can still carry an injected --- inside a model scalar that early-terminates the apparent leading front-matter block; fixing that requires a versioned report-format sentinel and legacy invalidation/rereview — tracked separately (see follow-up issue linked in comments).

Codex autoreview on the committed branch: clean, no accepted or actionable findings.

@steipete

steipete commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up for the residual legacy-record bypass described in the Limits section: #1049

@steipete
steipete merged commit 3f368a3 into main Aug 6, 2026
6 checks passed
@steipete
steipete deleted the steipete/fix-951-report-section-spoofing branch August 6, 2026 22:46
ostehost pushed a commit to ostehost/clawsweeper that referenced this pull request Aug 7, 2026
…PR verdicts (openclaw#1048)

* fix: prevent report section spoofing

* fix: close report metadata injection paths

* fix: fail closed on ambiguous report metadata

* fix: reject ambiguous report line metadata
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.

Forged Real Behavior Proof heading in model prose flips a PR's proof verdict: first-match sectionValue reads attacker-echoed sections

1 participant