Skip to content

fix: reject non-object JSON responses in the u2cli client - #1200

Merged
codeskyblue merged 1 commit into
openatx:masterfrom
David-the-happy-piglet:fix/u2cli-invalid-json-response
Oct 18, 2026
Merged

codeskyblue merged 1 commit into
openatx:masterfrom
David-the-happy-piglet:fix/u2cli-invalid-json-response

Conversation

@David-the-happy-piglet

Copy link
Copy Markdown
Contributor

The client parses JSON responses and then calls .get() on the decoded value. A response such as [], null, or a string therefore raises AttributeError, bypassing the U2CliError handling in is_running().

Validate that the response envelope is a JSON object before accessing its fields. Invalid envelopes raise U2CliError, and is_running() returns false. Valid envelopes can still contain results of any JSON type; remote error handling is unchanged.

Validation on macOS with Python 3.12.15:

  • Before the fix, 16 new regression cases failed and 9 controls passed; all 25 pass after the fix.
  • Real loopback HTTP checks cover eight non-object responses and a valid status response.
  • Independent review found no issues. The offline suite reports 96 passed and one existing no-argument CLI failure addressed separately by fix: show successful help for an empty u2cli invocation #1198.
  • Import formatting, diff checks, and source/wheel builds passed.

Android device tests and the cross-platform CI matrix were not run locally.

@codeskyblue
codeskyblue merged commit 368cbd4 into openatx:master Oct 18, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants