Repository navigation
fix(security): prevent slow review classification on crafted paths - #1262
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review Current-head proof and the prior proof disposition are now recorded in the PR body. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 5:36 AM ET / 09:36 UTC. ClawSweeper reviewWhat this changesReplaces regex-based pull-file test-path classification with exact segment and basename checks, adding boundary and adversarial timing tests. Merge readinessKeep this member-authored draft open for maintainer approval. Current main still uses the backtracking-prone suffix regex, while this PR’s exact-head implementation uses bounded segment and basename checks with focused boundary and timing coverage. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherClawSweeper examines changed-file paths from OpenClaw pull requests before deciding whether SQLite schema changes need a review warning. The classifier feeds the schema detector, which writes warning metadata into the generated review report. flowchart LR
A[GitHub pull-file paths] --> B[Review context]
B --> C[Path classifier]
C --> D{Production source path?}
D -->|yes| E[SQLite schema detector]
D -->|no| F[No schema warning]
E --> G[Review report metadata]
G --> H[Maintainer warning]
Decision needed
Why: The implementation and proof support the change, but repository policy keeps member-authored pull requests open for explicit maintainer judgment. Before merge
Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Approve the narrow linear classifier after the draft is marked ready, retaining the focused boundary and adversarial regression coverage. Do we have a high-confidence way to reproduce the issue? Yes—source inspection gives a high-confidence path: repeated suffix markers followed by a slash make the current-main suffix regex retry across many starts; the PR records the matching adversarial run. Is this the best way to solve the issue? Yes—the exact segment and basename parsing preserves the classifier’s documented boundary without broadening review policy or adding a new fallback. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 13f77495c462. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Related: https://github.com/openclaw/clawsweeper/security/code-scanning/99
What Problem This Solves
Fixes an issue where reviewing a pull request with an attacker-sized changed-file path containing repeated
.spec.fragments could spend polynomial time classifying whether the path is production code.Why This Change Was Made
The production-path classifier now parses exact path segments and the basename with bounded string operations. It preserves the existing test/example/fixture classification boundary without adding a fallback or changing unrelated review policy.
User Impact
ClawSweeper review preparation remains responsive for crafted or unusually long changed-file paths. Existing test and production path classifications are unchanged.
OpenClaw Bay Impact
None. This changes local pull-file classification before report rendering; it does not change lifecycle publication, queue state, status, telemetry, or dashboard contracts.
Documentation Impact
No documentation change is needed. The existing review-policy contract remains unchanged; this is an implementation hardening of the same path classification behavior.
Evidence
.spec.markers took 1,211.9 ms and failed the new 250 ms bound.node --test test/pr-surface-policy.test.tspassed 36/36.pnpm run checkcompleted every touched-surface check. Three unrelated tests failed identically on untouchedorigin/main: the host Git hook callback expectation, unavailable cached[email protected], and the local live-proof tmux window setup.71df3a1ce714d737e250008597075bb5eaeb2ac4..536d2b8c6f7dba779f1f4abd92ea09bb20dbfe0e:nothing_found, high confidence. Its independent checks included a 200,000-case differential comparison and adversarial timing.Real Behavior Proof
.spec.markers.sqliteSchemaChangeFromPullFilesForTest, which delegates to the productionsqliteSchemaChangeFromContextpath classifier..spec.markers before/schema.sql.aws, Nodev24.18.1, repository-pinned[email protected], leasecbx_4bb7c81fe09a.node --test test/pr-surface-policy.test.ts.Exact-Head Review Proof
536d2b8c6f7dba779f1f4abd92ea09bb20dbfe0e.exact-review-33055929184-1.Review Disposition
local-containerprovenance. That clause inAGENTS.mdapplies specifically on a Windows host; this executor is on macOS. The configured direct Crabbox provider is AWS, and the Crabbox policy describeslocal-containeras a fallback rather than remote proof. The clean AWS lease and the independent exact-review terminal proof above exercise the current head, so no weaker local-container rerun is applicable.Overlap
#1081 also touches
src/clawsweeper-change-detection.ts, but it changes persistence-policy precision rather than the CodeQL-reported.spec.matcher. It remains untouched and is not superseded by this PR.