Repository navigation
fix(security): detect multiline skill prompt injection - #117254
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 4:56 AM ET / 08:56 UTC. ClawSweeper reviewWhat this changesThe PR makes Skill Workshop reject critical prompt-injection phrases split across whitespace or line breaks and records the line where each multiline match starts. Merge readinessKeep this PR open for normal maintainer review. Current main still treats the affected critical phrases as same-line patterns, while this focused branch extends the existing full-content scanner and preserves the matched source location; no blocking correctness or supply-chain finding was identified. Priority: P1 Review scores
Verification
How this fits togetherSkill Workshop scans a proposed skill and its support files before applying it to an operator workspace. The scanner supplies findings to the apply transition, which quarantines a proposal with a failed scan before any skill file is written. flowchart LR
A[Skill proposal and support files] --> B[Proposal content scan]
B --> C[Critical injection-rule matching]
C --> D{Scan clean?}
D -->|No| E[Quarantine proposal]
D -->|Yes| F[Prepare workspace mutation]
F --> G[Write skill files]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +9, Tests +64. Total +73 across 3 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Land the focused scanner-and-Workshop regression repair after the exact current head has completed the normal merge checks, retaining the apply-time rescan and quarantine boundary as the single enforcement path. Do we have a high-confidence way to reproduce the issue? Yes—source establishes the path: current main scans the full proposal text with same-line-only critical expressions, so inserting line breaks prevents those phrases from matching; the branch adds focused regression coverage for that shape. Is this the best way to solve the issue? Yes—the scanner owns the detection invariant, while the existing apply transition already owns locked rescanning and quarantine; extending the scanner and preserving match location is narrower and safer than adding a second apply-time policy path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 41051fe37c7f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
9ff49dd to
709025c
Compare
709025c to
8e19706
Compare
|
Rank-up disposition: the repair lane is complete at |
* origin/main: fix(update): keep rolled-back Git installs runnable (openclaw#117294) refactor(ui): centralize chat outbox projections (openclaw#117284) fix(sessions): preserve target rows during legacy migration (openclaw#117272) fix(security): detect multiline skill prompt injection (openclaw#117254) fix(qa): lease credentials for Telegram startup proof (openclaw#116842) refactor(memory): unify session ingestion (openclaw#117293) fix(channels): strip internal tool text in Reef and Zalo Personal (openclaw#112621) fix(ui): keep newer Appearance choices after delayed theme imports [AI-assisted] (openclaw#117292) fix(inference): simplify lifecycle and preserve Codex tool identity (openclaw#117298)
* fix(security): detect multiline skill prompt injection * fix(security): preserve multiline finding locations --------- Co-authored-by: Vincent Koc <[email protected]>
* origin/main: fix(update): keep rolled-back Git installs runnable (openclaw#117294) refactor(ui): centralize chat outbox projections (openclaw#117284) fix(sessions): preserve target rows during legacy migration (openclaw#117272) fix(security): detect multiline skill prompt injection (openclaw#117254) fix(qa): lease credentials for Telegram startup proof (openclaw#116842) refactor(memory): unify session ingestion (openclaw#117293) fix(channels): strip internal tool text in Reef and Zalo Personal (openclaw#112621) fix(ui): keep newer Appearance choices after delayed theme imports [AI-assisted] (openclaw#117292) fix(inference): simplify lifecycle and preserve Codex tool identity (openclaw#117298)
What Problem This Solves
Fixes an issue where users or automated Skill Workshop flows could submit a skill proposal whose prompt-injection wording was split across line breaks and have it treated as clean during apply.
Why This Change Was Made
The critical prompt-injection rules now treat whitespace, including line breaks, as part of the matched phrase. The shared source-rule matcher also records the actual starting line for cross-line findings, so stored scanner evidence points at the unsafe text rather than proposal frontmatter. The authoritative apply path remains unchanged: it rescans under the target lock and quarantines failed proposals before preparing or writing any workspace mutation.
User Impact
Multiline prompt-injection proposals are rejected and quarantined instead of being applied to the workspace. Operators also receive the correct source line and evidence for the detected text. Ordinary single-line detection remains covered by the existing rules and tests.
Evidence
Exact current head:
8e197068473696fcafcf9411e1fe68bb157f106b.Sanitized direct AWS Crabbox proof:
--fresh-pr openclaw/openclaw#117254,--no-hydrate, isolated temporaryHOME, andCRABBOX_ENV_ALLOW=CI.404and the remote checkout matched the full expected head SHA.pnpm exec oxfmt --check src/skills/security/scanner.ts src/skills/security/scanner.test.ts src/skills/workshop/service.test.ts- passed.node scripts/run-vitest.mjs src/skills/security/scanner.test.ts- 37 passed.node scripts/run-vitest.mjs src/skills/workshop/service.test.ts -t "quarantines multiline prompt-injection proposal text during apply"- 1 passed.The Workshop service test proves the initial failed scan, apply rejection, durable quarantine state, and absence of the target
SKILL.md. No external channel or provider is involved.AI-assisted: yes. The author and maintainer understand the change and its behavior.