Harden HTTP request body and upload handling - #1848
Conversation
johnny9
left a comment
There was a problem hiding this comment.
Reviewed exact head 94c54a4. I did not find a correctness defect in the changed receive/upload implementation. The remaining issue is that the advertised api_rx tests do not exercise the new HTTP body and upload deadline decisions. The production-backed coverage patch passes 81/81 ESP32-S3 QEMU tests and a fresh full ESP-IDF 5.5.3 firmware build.
94c54a4 to
02d4154
Compare
|
Physical Bitaxe 602 smoke test passed on head The application-only OTA reported the expected firmware version, the device returned to healthy mining with three stable API samples, zero fault indication, and the configured pool intact. An independent authorized Stratum V1 probe received a fresh Full test result and artifacts: https://mining-qa-status.vercel.app/results/55df79e5-1015-423e-a2c1-d9400e605403 Test harness: |
b4b747f to
0db611e
Compare
Summary
Harden JSON reads, query parsing, and firmware/frontend uploads against oversized, fragmented, or stalled input.
size_tlengths and a total deadline.Why
Several handlers read only once or narrowed peer-controlled lengths before checking them. Upload loops also lacked total/stall deadlines. Malformed requests could therefore become partial JSON, unsafe size conversions, or indefinitely occupied handlers.
This keeps the trusted-network model and adds no authentication.
Review follow-up
Incorporates @johnny9's requested production-backed boundary coverage. Small pure size/read/deadline helpers now drive the real HTTP paths and are tested at exact accepted/rejected boundaries.
Stack and related work
Builds cumulatively on #1846 and #1847. Related to #1845, while additionally covering statistics bounds and OTA/AxeOS upload limits and deadlines.
Validation
git diff --check