Remove ioutil.ReadAll, except for in tests, and set a message size limit #2138

Closed
opened 2026-03-04 01:47:52 -05:00 by deekerman · 0 comments
Owner

Originally created by @ainar-g on GitHub (Nov 12, 2020).

Originally assigned to: @EugeneOne1 on GitHub.

ioutil.ReadAll should generally not be used in HTTP APIs, since it doesn't have a size limit. Our current HTTP API is for internal use, but it's still a good precautionary measure, in my opinion. We should probably just set a limit, constant or configurable, for the maximum size of an HTTP request body. Perhaps write our own version of io.LimitedReader that returns a meaningful error instead of an io.EOF.

Originally created by @ainar-g on GitHub (Nov 12, 2020). Originally assigned to: @EugeneOne1 on GitHub. <p><code>ioutil.ReadAll</code>&#xA0;should generally not&#xA0;be used in&#xA0;HTTP APIs, since&#xA0;it doesn't have a&#xA0;size limit.&#x2003;Our current HTTP API is for&#xA0;internal use, but&#xA0;it's still a&#xA0;good precautionary measure, in&#xA0;my opinion.&#x2003;We should probably just set a&#xA0;limit, constant or&#xA0;configurable, for&#xA0;the&#xA0;maximum size of&#xA0;an&#xA0;HTTP request body.&#x2003;Perhaps write our own version of&#xA0;<code>io.LimitedReader</code> that&#xA0;returns a&#xA0;meaningful error instead&#xA0;of&#xA0;an&#xA0;<code>io.EOF</code>.</p>
deekerman 2026-03-04 01:47:52 -05:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/AdGuardHome#2138
No description provided.