Repository navigation
Conversation
`events` is a section extra, so a telemetry frame may carry any JSON value
there. annotate_snapshots iterated whatever truthy value it found, so one
host reporting a number or a boolean raised TypeError and GET /api/agent/{id},
/api/fleet/overview and /api/today answered 500 for the whole fleet until
that host pushed a different snapshot. Found by crash fuzzing with a mock
agent that mutates its snapshots.
Only a list is collected now, matching the check the stamping loop below
already makes.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QcqxZNqpHNGk5hJzgn6CWt
Signed-off-by: Claude <noreply@anthropic.com>
Found by crash fuzzing with a mock agent that answers tool calls with
mutated results. Two results were stored unchecked and broke later reads:
- POST /api/agent/{id}/refresh and the ticket-callback refresh stored a
telemetry_collect result as a snapshot without the validation a pushed
telemetry frame gets. A section that is not an object (`"win_update": -5`)
then made GET /api/digest/preview answer 500. Both paths now run the
result through protocol.parse_snapshot, the same map of section name to
Section the frame uses, and do not store a result that fails it.
- POST /api/agent/{id}/screenshot stored any `image_b64`, and GET on the
same route base64-decodes the stored value, so a non-string or undecodable
payload turned every later GET into a 500. ScreenshotStore.put now keeps
only a string that decodes and reports whether it did; the route answers
502 for a rejected capture and the previous one stays.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QcqxZNqpHNGk5hJzgn6CWt
Signed-off-by: Claude <noreply@anthropic.com>
…fore storing The server holds a telemetry_collect result to the same snapshot map as a pushed telemetry frame before it stores one. The contract said the shape is the same; it now also says what happens to a result that is not. No frame or tool shape changes. The dashboard, tool and account references need no update for this branch: they describe neither route's response to a malformed agent answer, no tool or account capability is touched, and nothing a healthy agent sends is handled differently. [skip-doc-drift] Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QcqxZNqpHNGk5hJzgn6CWt Signed-off-by: Claude <noreply@anthropic.com>
wait_times_out_while_another_process_runs_target copied /bin/sleep to a file named kenny-wait-test-<pid> and ran the copy. The Linux CI job fails that test on every run that reaches it (also on an unrelated dependency PR): the child is gone before the wait looks for it. Where sleep is an applet of a multi-call binary, the binary picks the applet by the name it is run as, so the renamed copy exits at once. The copy now keeps the name `sleep` inside a private directory, which runs the same on a standalone sleep and on a multi-call one. Test-only; no agent behaviour changes. [skip-doc-drift] Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QcqxZNqpHNGk5hJzgn6CWt Signed-off-by: Claude <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Scheduled crash-fuzzing run. This time the server was fuzzed with a connected mock agent that answers with mutated data (earlier runs stopped at "no agent connected" on those routes). Three crashes; the session may push to one branch only, so they share this PR. A fourth commit repairs an agent test that fails on the Linux CI runner regardless of this change.
1. A non-list
reliability.eventstakes down the fleet overvieweventsis a section extra, so a validtelemetryframe may carry any JSON value there.event_categories.annotate_snapshotsiterated whatever truthy value it found:One host pushing
"events": 3.7madeGET /api/agent/{id},/api/fleet/overviewand/api/todayanswer 500 for every host until that host pushed a different snapshot.Fix: collect only a list, the same check the stamping loop a few lines below already makes.
2. A refresh stores a snapshot the push path would reject
POST /api/agent/{id}/refreshand the ticket-callback refresh stored thetelemetry_collectresult without the validation a pushedtelemetryframe gets. A section that is not an object ("win_update": -5) was stored, and then:Fix: new
protocol.parse_snapshotvalidates the samedict[str, Section]map the frame uses. Both refresh paths run the result through it and do not store one that fails. The route still answers 200 withstored: falseand a warning, as it does for a storage failure.docs/protocol.mdgains one sentence saying so; no frame or tool shape changes.3. An undecodable screenshot breaks every later
GET .../screenshotPOST /api/agent/{id}/screenshotstored anyimage_b64; the GET base64-decodes the stored value, so a non-string or bad base64 raisedTypeError/binascii.Erroron every read until the next good capture.Fix:
ScreenshotStore.putkeeps only a string that decodes and returns whether it did (this also covers the chat tool loop, the other writer). The route answers 502 for a rejected capture and the previous one stays.4. CI:
wait_times_out_while_another_process_runs_targetfails on the Linux runnerThe
kenny-agent (Rust)job failed on this PR's first push and on its re-run, and identically on the unrelated dependency PR #361, so it is not caused by this diff. The test copied/bin/sleepto a file with another name and ran the copy; the child was gone before the wait looked for it. That is what a multi-callsleepdoes when run under a name that is not an applet. The copy now keeps the namesleepinside a private directory, and the job passes. Test-only; the runner'ssleepwas not inspected directly, so the cause is inferred from the fix working.Fuzzing summary
pytestgreen. About 6,000 hostile-agent iterations (mutatedtelemetry_collect,screen_capture,remotehelp_start,webfilter_*,account_*,agent_updateresults, each followed by 12–24 dashboard requests). After the fixes, 3,000 further iterations produced no 5xx.cargo test588 passed. About 30 parser/decoder targets fuzzed at 20,000–120,000 iterations each (frame decoding, policy, webfilter, accounts, services, winget, and the portable parsing halves of the telemetry collectors): no release-build panics. Only debug-onlyu64overflow on absurd counts, which wraps in the shipped profile. Windows-only code cannot be compiled or run on this Linux runner.NaN/Infinitystill makes the routes that echo it (webfilter/apply,accounts/{tool}) answer 500. Reject non-finite numbers in telemetry and log frames #334 adds the non-finite check for telemetry and log frames; extending it toresponseframes is best done on top of that PR once it merges.Checklist
pytest -q(server, 4268 passed) andcargo test(agent, 588 passed). The three new regression tests fail without the fixes. CI is green on the current head.ruff check .andcargo fmt --checkpass locally; clippy ran in CI only.docs/protocol.md.git commit -s)🤖 Generated with Claude Code
https://claude.ai/code/session_01QcqxZNqpHNGk5hJzgn6CWt