Repository navigation
fix(security): sanitize JSON-escaped forged content boundaries - #118698
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 10:16 AM ET / 14:16 UTC. ClawSweeper reviewWhat this changesThe PR expands the shared external-content marker matcher to remove forged begin/end boundaries after JSON serialization and adds regression coverage for serialized Browser, search, and fetch payloads. Merge readinessKeep this PR open for the required maintainer security-boundary decision. Current main still fails to sanitize forged markers whose attribute quotes were JSON-escaped, and the patch repairs that shared owner path without adding a parallel Browser-only workaround. Priority: P0 Review scores
Verification
How this fits togetherBrowser, web, email, webhook, and channel-metadata text enter one external-content security wrapper before becoming model-visible prompt context. That wrapper sanitizes spoofed boundary markers and emits a fresh random boundary around the remaining untrusted payload. flowchart LR
A[Browser and external sources] --> B[Serialized page or tool content]
B --> C[External-content sanitizer]
C --> D[Fresh random trust boundary]
D --> E[Model-visible prompt context]
Decision needed
Why: The code path is security-sensitive and carries the protected Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +38. Total +38 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the single shared sanitizer repair, refresh it against current main, and land only after a maintainer accepts the deliberately broader serialized-marker sanitation behavior and the exact merge head is green. Do we have a high-confidence way to reproduce the issue? Yes, at source level: Browser snapshot code JSON-stringifies page-controlled payloads before calling the canonical wrapper, while current main matches only unescaped Is this the best way to solve the issue? Yes. Updating AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c547f16506e6. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* origin/main: fix(onboard): keep referenced provider secrets out of plaintext (#118702) docs: show canonical agent roster configuration (#118722) fix(channels): generate catalog from package manifests (#118097) fix(zalouser): distinguish probe timeout from auth failure (#111336) improve(ui): cut E2E shard runtime by reusing the bundle (#118697) fix(cli): publish completion caches atomically (#118715) fix(whatsapp): honor disabled self-chat without widening group access (#118711) fix(voice-call): terminate carrier calls after realtime startup failures (#118699) fix(slack): isolate GovSlack media trust and delivery (#118695) fix(browser): wrap page-controlled action results (#118691) fix(security): sanitize JSON-escaped forged content boundaries (#118698) test(qa): prove real yielded-child completion and channel delivery (#118707) fix(doctor): honor explicit plugin-only migration authority (#118700) fix(security): detect child_process calls through aliases and computed members (#116304) test(gateway): avoid async facade mock race (#118708) fix(gateway): preserve final speech during transcription shutdown (#118693) fix(gateway): resume durable outbound delivery retries (#118694) fix(plugins): reject external public-artifact hardlinks (#118689)
* origin/main: (78 commits) fix(parallels): recover Windows poll transport failures (#118479) fix(channels): deny unauthorized Discord and Telegram binding access (#118704) fix(test): bound shared git inventory lookup (#111171) fix(onboard): keep referenced provider secrets out of plaintext (#118702) docs: show canonical agent roster configuration (#118722) fix(channels): generate catalog from package manifests (#118097) fix(zalouser): distinguish probe timeout from auth failure (#111336) improve(ui): cut E2E shard runtime by reusing the bundle (#118697) fix(cli): publish completion caches atomically (#118715) fix(whatsapp): honor disabled self-chat without widening group access (#118711) fix(voice-call): terminate carrier calls after realtime startup failures (#118699) fix(slack): isolate GovSlack media trust and delivery (#118695) fix(browser): wrap page-controlled action results (#118691) fix(security): sanitize JSON-escaped forged content boundaries (#118698) test(qa): prove real yielded-child completion and channel delivery (#118707) fix(doctor): honor explicit plugin-only migration authority (#118700) fix(security): detect child_process calls through aliases and computed members (#116304) test(gateway): avoid async facade mock race (#118708) fix(gateway): preserve final speech during transcription shutdown (#118693) fix(gateway): resume durable outbound delivery retries (#118694) ...
* origin/main: fix(onboard): keep referenced provider secrets out of plaintext (openclaw#118702) docs: show canonical agent roster configuration (openclaw#118722) fix(channels): generate catalog from package manifests (openclaw#118097) fix(zalouser): distinguish probe timeout from auth failure (openclaw#111336) improve(ui): cut E2E shard runtime by reusing the bundle (openclaw#118697) fix(cli): publish completion caches atomically (openclaw#118715) fix(whatsapp): honor disabled self-chat without widening group access (openclaw#118711) fix(voice-call): terminate carrier calls after realtime startup failures (openclaw#118699) fix(slack): isolate GovSlack media trust and delivery (openclaw#118695) fix(browser): wrap page-controlled action results (openclaw#118691) fix(security): sanitize JSON-escaped forged content boundaries (openclaw#118698) test(qa): prove real yielded-child completion and channel delivery (openclaw#118707) fix(doctor): honor explicit plugin-only migration authority (openclaw#118700) fix(security): detect child_process calls through aliases and computed members (openclaw#116304) test(gateway): avoid async facade mock race (openclaw#118708) fix(gateway): preserve final speech during transcription shutdown (openclaw#118693) fix(gateway): resume durable outbound delivery retries (openclaw#118694) fix(plugins): reject external public-artifact hardlinks (openclaw#118689)
Summary
Root cause and shared security ownership
Browser tab titles, snapshots, console output,
web_fetch, search, email, and webhook payloads are JSON-stringified before reaching the canonicalwrapExternalContentsanitizer. JSON escapes the quotes in an attacker-supplied marker ID, but the existing start/end matcher only recognized unescaped quotes. Actual production Browser wrappers therefore reporteduntrusted:truewhile leaving both forged boundaries intact; this has shipped since early stable releases.The two existing canonical regular expressions now accept zero or any number of JSON-escape backslashes before the ID quote. No Browser-local workaround, new wrapper, altered schema, or repeated parsing is introduced; the negated ID character class remains linear-time and supports long IDs.
Actual production security proof
Before repair, the actual unmocked Browser tabs/console/snapshot helper returned
{"forgedIdRetained":true,"startSanitized":false,"endSanitized":false,"boundaryNames":4,"untrusted":true}.After repair, each actual production path returns
{"forgedIdRetained":false,"startSanitized":true,"endSanitized":true,"boundaryNames":2,"untrusted":true}; realweb_fetch, search, email, webhook, and channel metadata owners match.