Bound what a census read keeps and drop malformed DHT replies #147
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "census-hardening"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this PR does
Bounds what the census plugin keeps from a read, and makes its DHT client drop a malformed reply instead of ending the query round.
_census_proto.unionkeeps at mostMAX_ENTRIES(49, what one slot holds) from a slot's copies. When the copies together hold more, it keeps the entries held by the most copies (then the later hour, then the token) and counts the rest as rejected.read_slotand the writer'smergeuse it unchanged.proto.DAY_ENTRIEStokens a day (64 slots × 4 locations × 49 = 12,544, a full census). Past that, tokens it already has still update; new ones are tallied inover.seen.jsonloading applies the same cap, keeping the latest hours.KrpcClientmatches a datagram to its query in a new_take, which accepts only a 2-byte transaction id of the reply kinds from the queried address. Any datagram that doesn't match, or makes the handling raise, is counted indropped, and the round goes on.Checklist
make lint(ansible--syntax-check,yamllint,shellcheck --severity=error, and the real-data check). The Lint workflow runs this on the PR.make test(thekestrel_pipytest suite and the real-data check's tests). The Test workflow runs this on the PR..envfiles, real names, personal emails, device serials, and no real captured or device data: SSIDs, MAC addresses, GPS coordinates, capture files, diagnostics bundles, logs, or screenshots of a real device — placeholders only. The real-data check catches MACs, emails, keys and capture files; real SSIDs, coordinates and screenshots are on you.docs/, and the on-device operator guide (GUIDE_MDinkestrel_pi/userguide.py) where it applies.Release impact
kestrel_pipackage,plugins/*.py, systemd units, the journald drop-in, a lib script already in the engine'sLIB_SCRIPTS, or the CLI.config.txt/cmdline, kernel modules, the base image or partition size,builder/config.json,builder/config.yml, theMakefile, the Release workflow (.forgejo/workflows/main.yml), a shipped config default (config.toml/default.conf), or a brand-new lib script.Notes for review
kestrel-census/1): entries, slots and keys are the same; this is reader behaviour only. The desktop report (tools/census-report/) loads the same helper files, so it gets the per-slot bound too.unionkeeps the 30 entries two copies agree on against 49 from one copy; the day cap stops new tokens and still updates a known one; the page line comes and goes withover;seen.jsonloading keeps the latest hours. All 104 census tests pass.census-protocol.md, and the new page line incensus-setup.md's troubleshooting table.🤖 Generated with Claude Code