Skip to content

fix(scanner): unblock reviews of generated Git metadata - #1601

Merged
steipete merged 2 commits into
mainfrom
codex/scan-git-metadata
Sep 16, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/scan-git-metadata

Conversation

@steipete

@steipete steipete commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes review refusals when the native scanner mistakes generated Git blob IDs for credentials, including the dependency update in openclaw/openclaw#149908.

User Impact

Updates containing only these generated metadata findings can reach review. A conditional second native scan uses the existing deadline and staging limit.

The same-file combination of metadata findings and an already-reviewed unchanged URI fixture can still refuse when masked headers cannot satisfy the URI witness parser. Those cases were already blocked; URI-only reviews retain their existing single scan. This change does not expand that fixture policy.

Why This Change Was Made

The scanner owner binds each eligible complete object ID to canonical raw-diff and patch fields, matching endpoints, paths, regular-file modes, and independently rehashed blobs. A matching value in any full blob, prompt, schema, additional input, or raw working bytes refuses classification.

These witnesses only request proof. HTML decoding can reconstruct the same value from source content and borrow a detector keyword from the patch filename, so a value found in a header does not prove where a decoded finding originated. The owner therefore scans a second complete patch copy with only proven metadata fields masked at their original lengths. Its actual masked bytes are retained; filenames and content are unchanged. Any remaining unclassified finding, verified result, metadata-proof request, native error, incomplete completion, or source drift blocks admission.

The complete primary patch, raw diff, full blobs, prompt, schema, and additional input remain scanned unchanged. There are no detector exclusions, new settings, decoder reimplementations, gate bypasses, or deployments.

OpenClaw Bay Impact

Bay is unaffected: this changes scanner admission and host stderr notices, without changing dashboard data or action surfaces.

Documentation Impact

Updated the active README safety contract, active reproducible proof guide, and Unreleased changelog. The scanner admission owner and pinned native implementation remain the source of truth. Requalify this proof when the scanner version, metadata witness, staging, or admission flow changes.

Evidence

  • Eleven focused owner/sibling tests pass, including mandatory supplemental execution, unchanged primary bytes, preserved patch content, verified-result refusal, and missing-completion/native-error refusal.
  • Static/docs/format checks, all three TypeScript builds, and lint pass.
  • Fresh precommit and committed-branch Codex reviews are scoped-clean through P2.
  • The unchanged trusted scanner owner also admits this companion's exact committed source range with zero findings; the repair itself remains reviewable under current hosted policy.
  • Exact-head CI passed pnpm check, Windows launcher, network smoke, and sparse-build checks. CodeQL passed. The full check succeeded on an unchanged-head retry after the first attempt passed all 6,253 active tests but hit an empty Node coverage-profile error during collection; no coverage gate was changed.
  • Local full-check limit: 6,234 tests passed, two existing compiled-consumer loopback requests failed with ECONNRESET, and 36 skipped. Both consumers passed isolated reruns, and their fixed-profile requests do not invoke the scanner. The exact transport cause is unproved. A separate harness follow-up is to consume the unauthorized-claim response bodies in scripts/e2e/command-proof-consumer-loopback.mjs; this missing cleanup is not claimed as the cause of those resets.
  • Production delta: +186 net lines. The existing blob witness is shared rather than duplicated; the added code owns explicit proof-required state, bounded native replay, and strict completion. Tests add 360 lines; the standalone native proof adds 128 lines.

Real Behavior Proof

Claim and surface: the real scanAgentInput flow admits generated metadata without clearing matching decoded source content. No model is invoked by the proof.

Environment: macOS 27 arm64, Node 24.21.0, pnpm 12.4.1, checksum-qualified TruffleHog 3.97.4. The current native release still has the upstream metadata false-positive tracked in trufflesecurity/trufflehog#3266.

Command:

pnpm run build:node
node scripts/setup-review-tools.mjs --timeout-ms 120000
node docs/proof/agent-input-scan-git-metadata/run-proof.mjs /path/to/proof.json \
  /path/to/isolated-openclaw \
  47d9a40df0afa279da03cc08e14031d05738d456 \
  b87e5b75ffcf4386e01789b512e53d73b94437da

Observed results: the unchanged trusted scanner owner refused the original complete source range with 16 metadata findings. The corrected owner admits that same range with two metadata notices after its supplemental scan.

Native scenario Result
Original complete dependency source range Admitted
Generated metadata fixture Admitted
Matching value split by HTML tags Refused
Hexadecimal HTML entities Refused
Decimal HTML entities Refused
URL-encoded HTML attribute Refused
Zero-width characters Refused
Same value copied into additional input Refused

Trace and limits: the committed proof script writes the native classification/diagnostic JSON used for this matrix. Encoded fixture blobs contain no literal object ID, and their filename supplies the detector keyword. The tag-split case proves why an independent replay is required instead of guessed decoded line offsets. Output contains safe classifications and digests, never matched values. This controlled proof does not replace the hosted review's own prompt/schema/source scan.

Keep the complete primary scan and require canonical Git object witnesses
before requesting a supplemental patch scan. Mask only witnessed metadata
fields at their original lengths so native decoding must independently
clear matching content before review admission.

Preserve verified-result, completion, source-fence, and cleanup gates.
Exercise the original dependency source range and synthetic encoded-content
counterexamples with the pinned native scanner.
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 7:19 AM ET / 11:19 UTC (Revision 5).

ClawSweeper review

What this changes

The scanner verifies generated Git blob IDs and rescans a metadata-masked patch before allowing otherwise blocked reviews to proceed.

Merge readiness

✅ Ready for maintainer review

The PR remains necessary: current main still rejects generated Git metadata findings. No actionable introduced defect remains, and the recorded native proof and current-head validation support maintainer review.

Priority: P2
Reviewed head: f96d19e3d8dc0abc8fef9dc9c15be6894fd1bdf4

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful native positive and negative proof, current-head validation, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The recorded macOS run exercises scanAgentInput with pinned native TruffleHog: the original source range and metadata fixture admit after replay, while encoded matching content and an additional-input collision refuse. The inspected harness uses the production admission boundary; model execution is outside its stated scope.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The recorded macOS run exercises scanAgentInput with pinned native TruffleHog: the original source range and metadata fixture admit after replay, while encoded matching content and an additional-input collision refuse. The inspected harness uses the production admission boundary; model execution is outside its stated scope.
Evidence reviewed 7 items Current main still needs this repair: The pinned main classifier rejects patch findings whose detector is not URI detector 17; its scanner owner has no metadata replay path. The latest release v0.3.0 does not contain src/agent-input-scan.ts. No merged fixing PR was established; the inspected recent merged scanner PRs concern URI fixtures.
Canonical metadata witnesses: The new witness resolver rejects matching content in other staged inputs, checks canonical raw-diff and patch fields, and independently hashes full blobs bound to their paths, modes, and endpoints.
Replay precedes admission: Metadata classification requests a separate complete-patch scan using retained masked bytes, the same scanner flags, shared deadline, and staging budget. Further metadata requests, unclassified findings, and incomplete scans refuse; source fences and cleanup precede success notices. The agent runner calls this gate before launching the model.
Findings None None.
Security None None.

How this fits together

ClawSweeper scans prompts, schemas, Git changes, and complete source blobs before starting a review agent. This admission gate blocks sensitive or incompletely scanned input from reaching the model.

flowchart TD
  A[Prompt and complete Git inputs] --> B[Primary native scan]
  B --> C[Classify findings]
  C --> D[Verify Git metadata witnesses]
  D --> E[Scan metadata-masked patch]
  E --> F[Completion and source checks]
  F --> G[Admit review]
  C --> H[Refuse unsafe input]
  E --> H
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production versus test growth Production +186 net lines; tests +360 net lines; native proof script +128 lines Production growth is justified by metadata witnesses and bounded replay, with the existing blob verifier shared rather than duplicated.
Recorded native scenarios 2 admissions; 6 refusals The proof covers useful admission and matching content that must remain blocked.

Technical review

Best possible solution:

Retain the complete primary scan and narrowly admit proven metadata only after independent native replay clears the unchanged content.

Do we have a high-confidence way to reproduce the issue?

Yes: current main explicitly rejects detector-58 patch findings, and the recorded native run demonstrates the original refusal. This review verified the source path without executing it.

Is this the best way to solve the issue?

Yes: sharing the blob witness and requiring native replay is a narrow repair that avoids guessing decoded coordinates. The documented mixed URI/metadata limitation preserves an existing refusal rather than expanding fixture policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 02cd682921ca.

Labels

Label justifications:

  • P2: This repairs a bounded scanner false positive that prevents otherwise eligible changes from reaching review.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The recorded macOS run exercises scanAgentInput with pinned native TruffleHog: the original source range and metadata fixture admit after replay, while encoded matching content and an additional-input collision refuse. The inspected harness uses the production admission boundary; model execution is outside its stated scope.
  • proof: sufficient: Contributor real behavior proof is sufficient. The recorded macOS run exercises scanAgentInput with pinned native TruffleHog: the original source range and metadata fixture admit after replay, while encoded matching content and an additional-input collision refuse. The inspected harness uses the production admission boundary; model execution is outside its stated scope.

Evidence

What I checked:

  • Current main still needs this repair: The pinned main classifier rejects patch findings whose detector is not URI detector 17; its scanner owner has no metadata replay path. The latest release v0.3.0 does not contain src/agent-input-scan.ts. No merged fixing PR was established; the inspected recent merged scanner PRs concern URI fixtures. (src/agent-input-scan-fixtures.ts:630, 02cd682921ca)
  • Canonical metadata witnesses: The new witness resolver rejects matching content in other staged inputs, checks canonical raw-diff and patch fields, and independently hashes full blobs bound to their paths, modes, and endpoints. (src/agent-input-scan-git-metadata.ts:39, f96d19e3d8dc)
  • Replay precedes admission: Metadata classification requests a separate complete-patch scan using retained masked bytes, the same scanner flags, shared deadline, and staging budget. Further metadata requests, unclassified findings, and incomplete scans refuse; source fences and cleanup precede success notices. The agent runner calls this gate before launching the model. (src/agent-input-scan.ts:709, f96d19e3d8dc)
  • Recorded production-path proof: The supplied full PR body, captured under sourceRevision bf106062a0b618dd70b9f13ccfd42f4ddca540f1d6908972381c31fba52d9d9e, records macOS arm64, Node 24.21.0, and native TruffleHog 3.97.4 execution through scanAgentInput. The original source range changes from 16 blocking findings to admission with two metadata notices; the metadata fixture admits, while five encoded-content cases and an additional-input collision refuse. The inspected script exercises that production owner without invoking a model. These are contributor-recorded results, not a reviewer execution. (docs/proof/agent-input-scan-git-metadata/run-proof.mjs:34, f96d19e3d8dc)
  • Native dependency contract: The PR explicitly depends on TruffleHog 3.97.4's detector and decoder contracts. Its v1 Cloudflare detector matches nearby hexadecimal values and combines them with email matches; the inspected HTML decoder reconstructs entities, attributes, and split text. Engine deduplication includes source metadata. These support native replay instead of inferring original bytes from decoded line numbers. (pkg/detectors/cloudflareglobalapikey/v1/cloudflareglobalapikey.go:30, 363923b901c9)
  • Review continuity and validation: The previous completed review covers the same head and contains no findings. Comparing the earlier head shows no runtime or proof-script changes; the second commit corrects one expected diagnostic. The supplied current-head checks report pnpm check and CodeQL success, and the body documents the unchanged-head coverage retry and separate local loopback limitation. Read-only diff checking passed; no tests or proof scripts were executed during this review. (test/agent-input-scan.test.ts:1837, f96d19e3d8dc)

Likely related people:

  • Peter Steinberger: Raw commit 9d984f1 adds src/agent-input-scan-patch.ts:11 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9d984f125933; files: src/agent-input-scan-patch.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-16T10:24:35.572Z sha 6ce3b34 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-16T10:28:46.192Z sha 6ce3b34 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-16T10:44:07.713Z sha f96d19e :: needs maintainer review before merge. :: none
  • reviewed 2026-09-16T10:48:34.531Z sha f96d19e :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 16, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The current head's full CI has passed. The PR body now records that result, the unchanged-head coverage-collection retry, and the separate local loopback-test limitation. Runtime source and native behavior proof are unchanged.

@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(scanner): unblock reviews of generated Git metadata This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete merged commit f48f1ce into main Sep 16, 2026
23 of 26 checks passed
@steipete
steipete deleted the codex/scan-git-metadata branch September 16, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant