mime/multipart: Allow limiting maximum amount of part's header data #26339
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
This is feature request, to allow user of
mime/multipart
package'sReader
to specify limit of header data loaded into memory when callingNewPart()
function.Reader.NewPart()
callsnet/textproto
package'sReader.ReadMIMEHeader()
function which without any limitation loads all header data into memory.mime/multipart
'sReader
is also used innet/http
package to parsemultipart/form-data
POST requests, which means that functions likeRequest.ParseMultipartForm
,Request.FormValue
,Request.FormFile
,Request.MultipartReader
are affected by this.I believe this can be used as remote denial of service attack vector.
Possible solution for this would be limiting HTTP request body size (done by default in some servers like nginx), but this is unsuitable for cases where server needs to accept POST requests with big files (for example, file hosting service).
Similar case like this is
net/http
package'sServer
'sMaxHeaderBytes
field, which limits ammount of header data, but not body.The text was updated successfully, but these errors were encountered: