Repository navigation
fix(signal): reject invalid UTF-8 in container REST JSON responses - #121569
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 19, 2026, 6:02 AM ET / 10:02 UTC. ClawSweeper reviewWhat this changesThe 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 readinessKeep 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 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherSignal 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]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +8, Tests +43. Total +51 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest 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. 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
HistoryReview history (8 earlier review cycles)
|
c2007fc to
92c7fb6
Compare
92c7fb6 to
d087c4e
Compare
d087c4e to
afbf288
Compare
0ae15f2 to
2b701ef
Compare
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]>
|
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 |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
…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]>
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
statusTextfield keeps production code net-neutral; the PR adds 58 test lines.Why This Change Was Made
Raw HTTP regression tests cover invalid
0xffand truncated0xc3in 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 actualprobeSignaloperator 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
67366c010c13245817ecdd951a75ea6b3c8af31fwill 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.