Files
openclaw/extensions
lsr911 7d98ad2a92 fix(signal): guard containerRestRequest JSON.parse against malformed responses (#98073)
* fix(signal): guard containerRestRequest JSON.parse against malformed responses

Wrap JSON.parse(text) in containerRestRequest with try/catch to prevent a malformed Signal REST container response from throwing an unhandled SyntaxError.

On parse failure, throw a descriptive Error. The success body is already bounded by readProviderTextResponse (16 MiB cap, D1 protection).

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: lsr911 <liao.shirong@xydigit.com>

* fix(signal): add real HTTP server proof for malformed JSON guard

Starts a local node:http server returning malformed JSON, then calls
containerRestRequest against it.  This exercises the actual changed
try/catch code path through the real fetch stack (no mock override).

Proof output:
  PASS  malformed JSON: throws Error :: type=Error
  PASS  malformed JSON: message describes malformed JSON
  PASS  malformed JSON: NOT raw SyntaxError

Signed-off-by: lsr911 <liao.shirong@xydigit.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: lsr911 <liao.shirong@xydigit.com>

* test(signal): remove committed proof script

---------

Signed-off-by: lsr911 <liao.shirong@xydigit.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-06-30 10:50:59 -07:00
..