Skip to content

Treat a deeply nested log response as malformed in the monitor's reader - #116

Open
owizdom wants to merge 2 commits into
Lucid-Computing:mainfrom
owizdom:owizdom/monitor-nested-json
Open

owizdom wants to merge 2 commits into
Lucid-Computing:mainfrom
owizdom:owizdom/monitor-nested-json

Conversation

@owizdom

@owizdom owizdom commented Nov 27, 2026 •

Copy link
Copy Markdown

Change

LogMonitor.run raises a coverage alert when a log read fails with OSError, ValueError, TypeError or KeyError. A log that answered with 65,536 bytes of [ made json.loads in LogReader raise RecursionError instead. The monitor stopped before it stored or sent any alert, and stopped again after each restart. The log operator is the party the monitor watches, and the monitor's README says alerts are delivered at least once.

LogReader now raises ValueError for a response nested too deeply to decode, as it does for other malformed responses and as the log server already does (log/http.py:161). The monitor then raises observation_unavailable.

Verification

Checked on macOS arm64 with Python 3.13.18. The new test serves the nested body over TLS, fails on eccb15e with RecursionError and passes here. That body raises RecursionError on CPython 3.10 through 3.14. make test-unit runs 461 tests, OK, 26 skipped. make lint and make docs-check pass.

json.loads raises RecursionError on a response nested beyond the
decoder's depth, and LogMonitor.run catches only OSError, ValueError,
TypeError and KeyError. A log that answered with 65,536 bytes of "["
stopped the monitor before it raised any coverage alert. The reader
now raises ValueError for it, as for other malformed responses.
@owizdom
owizdom force-pushed the owizdom/monitor-nested-json branch from 76505e2 to 7f89b83 Compare November 27, 2026 13:43
@owizdom
owizdom marked this pull request as ready for review November 27, 2026 13:51
The verifier fix in Lucid-Computing#115 adds its line at the top of the same list.

This branch has not been deployed

No deployments
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.

1 participant