Skip to content

Survive a non-list reliability.events in the fleet overview - #379

Open
t11z wants to merge 1 commit into
mainfrom
claude/hopeful-newton-mcny4j
Open

t11z wants to merge 1 commit into
mainfrom
claude/hopeful-newton-mcny4j

Conversation

@t11z

@t11z t11z commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

What & why

Found by a crash-fuzzing run: telemetry snapshots built from the golden fixtures, with nested values mutated at random, fed through the server's pure telemetry consumers.

Problem. reliability.events is a section extra (protocol.Section allows any JSON value), so a buggy or compromised agent can push 5, 3.7 or true there. fleet_stats._reliability_categories iterated events or [], which raises:

File "kenny_server/fleet_stats.py", line 89, in aggregate_overview
    "reliability_categories": _reliability_categories(agents),
File "kenny_server/fleet_stats.py", line 119, in _reliability_categories
    for e in events or []:
TypeError: 'bool' object is not iterable

aggregate_overview runs for the whole fleet, so one host with this payload makes /api/fleet/overview return a 500 for every operator.

Fix. Read the field through health_rules._dicts, which every other list field in fleet_stats already uses. A non-list now counts as "no events", and non-dict entries are dropped as before.

Related. #328 fixes the same input one step earlier on the same request, in event_categories.annotate_snapshots. Once #328 merges, this fleet_stats crash is the next one that request hits. The two PRs change different files, so they don't overlap.

Added a regression test, test_reliability_categories_ignores_events_that_are_not_a_list. It fails without the fix for float, int and bool inputs. No fuzz harness is committed.

Checklist

  • Tests pass: pytest -q tests/test_fleet_stats.py (37 passed)
  • Lint/format clean: ruff check on the touched files
  • If the wire contract changed: n/a
  • If the change is architectural: n/a (bug fix)
  • Docs updated where relevant: n/a
  • Commits are signed off (DCO)

Generated by Claude Code

`reliability.events` is a section extra, so an agent can push any JSON value
there. `_reliability_categories` iterated `events or []`, which raises
TypeError on a number or a bool and turned /api/fleet/overview into a 500
for the whole fleet. Read it through `_dicts` like every other list field in
the module.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QcqxZRgcUbztpdtpBoWrt8

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.

2 participants