Files
openclaw/extensions/browser/src/cli/browser-cli-actions-input
lsr911 e924f30bf5 fix(browser): guard readFields JSON.parse against malformed CLI input (#98861)
* fix(browser): guard readFields JSON.parse against malformed user input

Wraps JSON.parse(payload) in readFields() with try/catch, throwing a
descriptive Error when CLI --fields or --fields-file input contains
malformed JSON instead of raw SyntaxError.

8/8 proof assertions pass using standalone script that imports and
calls the real exported readFields() with malformed field strings.

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

* fix(browser): add vitest malformed JSON tests, remove standalone proof

ClawSweeper feedback: added 2 vitest tests (malformed JSON, empty fields)
to the existing shared.test.ts, removed standalone proof script.

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

* fix(browser): cover malformed fields at CLI boundary

---------

Signed-off-by: lsr911 <liao.shirong@xydigit.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-06 23:14:00 +01:00
..