Rejecting requests with significant content length is a good practice to control the network traffic intensity and thus resource consumption in order to prevents DoS attacks.
There is a risk if you answered yes to any of those questions.
It is recommended to customize the rule with the limit values that correspond to the web application.
Imports Microsoft.AspNetCore.Mvc
Public Class MyController
Inherits Controller
<HttpPost>
<DisableRequestSizeLimit> ' Sensitive: No size limit
<RequestSizeLimit(10000000)> ' Sensitive: 10MB is more than the recommended limit of 8MB
Public Function PostRequest(Model model) As IActionResult
' ...
End Function
<HttpPost>
<RequestFormLimits(MultipartBodyLengthLimit = 8000000)> ' Sensitive: 10MB is more than the recommended limit of 8MB
Public Function MultipartFormRequest(Model model) As IActionResult
' ...
End Function
End Class
Imports Microsoft.AspNetCore.Mvc
Public Class MyController
Inherits Controller
<HttpPost>
<RequestSizeLimit(8000000)> ' Compliant: 8MB
Public Function PostRequest(Model model) As IActionResult
' ...
End Function
<HttpPost>
<RequestFormLimits(MultipartBodyLengthLimit = 8000000)> ' Compliant: 8MB
Public Function MultipartFormRequest(Model model) AS IActionResult
' ...
End Function
End Class