Skip to content

fix(signal): reject invalid UTF-8 in container REST JSON responses - #121569

Merged
steipete merged 4 commits into
openclaw:mainfrom
sunlit-deng:sunlit/fix/signal-utf8-current-resubmit
Sep 1, 2026
Merged

steipete merged 4 commits into
openclaw:mainfrom
sunlit-deng:sunlit/fix/signal-utf8-current-resubmit

Conversation

@sunlit-deng

@sunlit-deng sunlit-deng commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Signal's native JSON-RPC and container REST readers previously replaced malformed UTF-8 before parsing JSON, silently changing response data. Preserve bounded native response bytes until the JSON consumer and use fatal UTF-8 decoding in both JSON readers. Status-only health checks continue to ignore unused response bytes. Removing the unused native statusText field keeps production code net-neutral; the PR adds 58 test lines.

Why This Change Was Made

Raw HTTP regression tests cover invalid 0xff and truncated 0xc3 in both clients and status-only health controls. The four malformed-input cases fail before the repair; all 133 focused owner and sibling tests pass after it. Full changed-file gates and independent P0 review pass. The actual probeSignal operator path was driven through both native and container loopback HTTP: Japanese/emoji versions survive intact, corrupted JSON produces a visible failure, and status-only health remains healthy.

User Impact

Malformed JSON bytes produce a visible probe failure; valid Unicode and status-only health checks retain their behavior.

Evidence

{"passed":true,"productionEntry":"probeSignal → client-adapter → native/container HTTP","authenticatedSignal":false,"transportsTested":2,"healthUnusedInvalidBytesPreserved":true,"utf8ValuePreserved":true,"malformedJsonBytesReportedAsProbeFailure":true,"allLoopbackServersClosed":true}

The health-check finding remains fixed, and the production-growth concern is resolved. The old rebase rank-up is skipped because the four changed files and the adapter/probe owners are byte-identical from the PR merge base through the tested trusted-main baseline and freshly fetched main. The follow-up preserves contributor ancestry; exact-head hosted checks for 67366c010c13245817ecdd951a75ea6b3c8af31f will validate the current merge context. The stale ClawSweeper review should be refreshed.

Malformed JSON bytes now fail intentionally; valid Unicode, 201/no-body RPC responses, error-prefix readers, attachments, and the separate SSE decoder keep their contracts. The contributor checkout was not executed locally. Thanks @sunlit-deng.

Maintainer-reviewed head: 67366c010c13245817ecdd951a75ea6b3c8af31f. Contributor credit is preserved.

@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added channel: signal Channel integration: signal scripts Repository scripts size: S labels Aug 10, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 10, 2026
@clawsweeper

clawsweeper Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 19, 2026, 6:02 AM ET / 10:02 UTC.

ClawSweeper review

What this changes

The PR changes Signal’s native JSON-RPC and container REST JSON readers to reject malformed UTF-8 before parsing, while keeping status-only health checks byte-agnostic.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open. The prior health-check finding is fixed, and the patch now rejects malformed UTF-8 only at the two JSON-consumer boundaries while preserving status-only native health checks; it needs only a normal rebase and exact-head validation refresh.

Priority: P2
Reviewed head: 0ae15f24d269768d362ef885aaa05997a9e16e39

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong real boundary proof and focused regression coverage support a small, coherent transport repair.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body provides before/after loopback proof through both exported production request paths and a separate status-only health-check control on the exact head.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides before/after loopback proof through both exported production request paths and a separate status-only health-check control on the exact head.
Evidence reviewed 9 items Current-main behavior: Current main still decodes native JSON-RPC response bytes with Buffer.toString("utf8"), which replaces malformed bytes before JSON parsing.
Current-main container behavior: Current main’s container success reader also uses a non-fatal TextDecoder before JSON.parse.
Exact-head owner-boundary repair: The native transport preserves bounded raw bytes and performs fatal decoding only in signalRpcRequest; signalCheck evaluates status without decoding the unused body.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs extensions/signal/src/client.test.ts extensions/signal/src/client-container.real-server.test.ts

Result: PASS (completed)

node scripts/run-vitest.mjs extensions/signal/src/client.test.ts extensions/signal/src/client-container.real-server.test.ts
runner@runnervmzvulz:/tmp/clawsweeper-live-proof-121569-1YIS72/target$ node scripts/run-vitest.mjs extensions/signal/src/client.test.ts extensions/signal/src/cl
ient-container.real-server.test.ts
node scripts/run-vitest.mjs extensions/signal/src/client.test.ts extensions/signal/src/client-container.real-server.test.ts
[test] starting test/vitest/vitest.extension-signal.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-121569-1YIS72/target

 ✓  extension-signal  extensions/signal/src/client.test.ts (24 tests) 8165ms
 ✓  extension-signal  extensions/signal/src/client-container.real-server.test.ts (15 tests) 715ms
     ✓ aborts a slow-drip body that never idles, at the request deadline  331ms
     ✓ aborts a response whose body stalls immediately after headers  302ms

 Test Files  2 passed (2)
      Tests  39 passed (39)
   Start at  10:03:42
   Duration  10.86s (transform 14.11s, setup 2.34s, import 8.67s, tests 8.88s, environment 0ms)

[test] passed 1 Vitest shard in 16.80s
runner@runnervmzvulz:/tmp/clawsweeper-live-proof-121569-1YIS72/target$ node scripts/run-vitest.mjs extensions/signal/src/client.test.ts extensions/signal/src/cl
ient-container.real-server.test.ts






























Assertions:

  • PASS expect_output: Test Files

How this fits together

Signal routes outbound and probe requests through either a native JSON-RPC client or a container REST client. Both paths turn bounded HTTP response bytes into JSON for channel operations, while health checks only need the HTTP status.

flowchart LR
A[Signal response bytes] --> B[Native or container client]
B --> C[Bounded response reader]
C --> D{Consumer needs JSON?}
D -->|Yes| E[Fatal UTF-8 decode]
D -->|No: health check| F[Read HTTP status]
E --> G[Parsed channel result]
F --> H[Health result]
Loading

Before merge

  • Resolve merge risk (P1) - This intentionally turns previously replacement-decoded malformed JSON into a request failure; deployments that tolerated corrupted Signal responses will now surface an error instead.
  • Resolve merge risk (P1) - Production code is net +8 lines; the small increase is needed to retain raw bounded bytes until the JSON-RPC consumer decodes them, so status-only health checks do not inherit JSON validation.
  • Resolve merge risk (P1) - The branch is behind current main; rebase and refresh exact-head validation before merge.
  • Complete next step (P2) - No repair lane is needed because the current patch has no actionable defect; the remaining action is a routine rebase and exact-head validation refresh.
Agent review details

Security

None.

PR surface

Source +8, Tests +43. Total +51 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 27 19 +8
Tests 2 43 0 +43
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 70 19 +51

Review metrics

Metric Value Why it matters
Production vs test LOC production +8 net (27 added, 19 removed); tests +43 The production increase is the raw-byte ownership split required to preserve status-only checks; added tests cover native, container, and health-check boundaries.

Merge-risk options

Maintainer options:

  1. Retain fail-closed JSON decoding (recommended)
    Merge after the normal rebase and exact-head checks, accepting that malformed JSON responses now fail instead of being silently repaired.

Technical review

Best possible solution:

Keep raw bounded bytes in the native shared response reader, decode fatally only in JSON consumers, retain status-only health checks, then rebase and validate the resulting head.

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

Yes: the documented loopback HTTP scenario injects 0xff through both exported production paths, and current-main source confirms the same lenient decode remains present; this read-only review did not rerun the suite.

Is this the best way to solve the issue?

Yes. Decoding at the JSON consumer boundary is the narrowest repair because it rejects corrupted parsed data without changing the status-only health-check contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 3587158a0e38.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides before/after loopback proof through both exported production request paths and a separate status-only health-check control on the exact head.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Malformed response decoding affects Signal transport correctness but is bounded to an optional channel integration.
  • merge-risk: 🚨 compatibility: Existing deployments that accepted replacement-character JSON will now receive a failure for malformed response bytes.
  • 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 (terminal): The PR body provides before/after loopback proof through both exported production request paths and a separate status-only health-check control on the exact head.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides before/after loopback proof through both exported production request paths and a separate status-only health-check control on the exact head.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current-main blame attributes the native response-reader path to this recent Signal-area commit; repository shortlog also shows sustained work on the two client files. (role: recent area contributor; confidence: high; commits: 3550b174e960; files: extensions/signal/src/client.ts, extensions/signal/src/client-container.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Rebase onto current main and rerun the documented loopback proof and focused Signal tests on the resulting exact head.

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 (8 earlier review cycles)
  • reviewed 2026-08-10T12:53:09.435Z sha df7634d165a53e01da178ca514475cbf3aafae41 :: needs changes before merge. :: [P2] Make the committed proof fail when the regression returns
  • reviewed 2026-08-10T15:00:04.882Z sha 92c7fb65f1f19ac7f6ac3135e11fee8318417ad5 :: needs changes before merge. :: [P3] Assert the decoder type rather than runtime wording
  • reviewed 2026-08-15T10:59:34.775Z sha 92c7fb65f1f19ac7f6ac3135e11fee8318417ad5 :: needs changes before merge. :: [P3] Assert the fatal-decode error type
  • reviewed 2026-08-15T11:09:52.886Z sha 92c7fb65f1f19ac7f6ac3135e11fee8318417ad5 :: needs changes before merge. :: [P3] Assert the fatal-decode error type
  • reviewed 2026-08-15T11:48:09.772Z sha 92c7fb65f1f19ac7f6ac3135e11fee8318417ad5 :: needs changes before merge. :: [P3] Assert the fatal-decode error type
  • reviewed 2026-08-16T08:10:56.168Z sha d087c4efb1d4303d39b67485c76f0dbcfc1d2fb1 :: needs changes before merge. :: [P3] Assert the decoder error type
  • reviewed 2026-08-18T12:38:43.491Z sha d087c4efb1d4303d39b67485c76f0dbcfc1d2fb1 :: needs changes before merge. :: [P2] Cover native Signal JSON-RPC decoding | [P3] Assert the decoder error type
  • reviewed 2026-08-19T00:45:27.179Z sha afbf288a203583ff8c5818fb1b11b7dd5b308491 :: needs changes before merge. :: [P2] Keep native health checks status-only

@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/signal-utf8-current-resubmit branch from c2007fc to 92c7fb6 Compare August 10, 2026 14:24
@openclaw-barnacle openclaw-barnacle Bot added size: XS and removed scripts Repository scripts size: S labels Aug 10, 2026
@clawsweeper clawsweeper Bot added 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. clawsweeper-recovery-stuck and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 10, 2026
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/signal-utf8-current-resubmit branch from 92c7fb6 to d087c4e Compare August 16, 2026 08:05
@clawsweeper clawsweeper Bot added clawsweeper-recovery-stuck merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper-recovery-stuck 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 Aug 16, 2026
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/signal-utf8-current-resubmit branch from d087c4e to afbf288 Compare August 19, 2026 00:38
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 19, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 19, 2026
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/signal-utf8-current-resubmit branch from 0ae15f2 to 2b701ef Compare September 1, 2026 06:56
Preserve bounded native response bytes until JSON parsing so health checks remain status-only, and reject malformed UTF-8 in both native and container JSON. Remove the unused native statusText result to keep production code net-neutral.

Co-authored-by: sunlit-deng <[email protected]>
@steipete

steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Maintainer revision and source-bound before/after evidence are now in the PR body. Contributor credit is preserved. Required exact-head CI must pass before merge.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete merged commit 998529f into openclaw:main Sep 1, 2026
109 checks passed
@steipete

steipete commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 2, 2026
…penclaw#121569)

* fix(signal): reject invalid UTF-8 in container REST JSON responses

* fix(signal): reject invalid UTF-8 in native JSON responses

* fix(signal): keep health checks status-only

* fix(signal): reject malformed JSON bytes at the decoder owner

Preserve bounded native response bytes until JSON parsing so health checks remain status-only, and reject malformed UTF-8 in both native and container JSON. Remove the unused native statusText result to keep production code net-neutral.

Co-authored-by: sunlit-deng <[email protected]>

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: sunlit-deng <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: signal Channel integration: signal merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

2 participants