rspec/rules/S5693/vbnet/rule.adoc

87 lines
1.7 KiB
Plaintext
Raw Normal View History

2021-02-10 17:04:49 +01:00
include::../description.adoc[]
include::../ask-yourself.adoc[]
include::../recommended.adoc[]
== Sensitive Code Example
[source,vbnet]
2021-02-10 17:04:49 +01:00
----
Imports Microsoft.AspNetCore.Mvc
Public Class MyController
Inherits Controller
<HttpPost>
<DisableRequestSizeLimit> ' Sensitive: No size limit
<RequestSizeLimit(10485760)> ' Sensitive: 10485760 B = 10240 KB = 10 MB is more than the recommended limit of 8MB
2021-02-10 17:04:49 +01:00
Public Function PostRequest(Model model) As IActionResult
' ...
End Function
<HttpPost>
<RequestFormLimits(MultipartBodyLengthLimit = 10485760)> ' Sensitive: 10485760 B = 10240 KB = 10 MB is more than the recommended limit of 8MB
2021-02-10 17:04:49 +01:00
Public Function MultipartFormRequest(Model model) As IActionResult
' ...
End Function
End Class
----
== Compliant Solution
2022-02-04 17:28:24 +01:00
[source,vbnet]
2021-02-10 17:04:49 +01:00
----
Imports Microsoft.AspNetCore.Mvc
Public Class MyController
Inherits Controller
<HttpPost>
<RequestSizeLimit(8388608)> ' Compliant: 8388608 B = 8192 KB = 8 MB
2021-02-10 17:04:49 +01:00
Public Function PostRequest(Model model) As IActionResult
' ...
End Function
<HttpPost>
<RequestFormLimits(MultipartBodyLengthLimit = 8388608)> ' Compliant: 8388608 B = 8192 KB = 8 MB
2021-02-10 17:04:49 +01:00
Public Function MultipartFormRequest(Model model) AS IActionResult
' ...
End Function
End Class
----
include::../see.adoc[]
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
=== Parameters
.fileUploadSizeLimit
****
_integer_
----
8388608
----
The maximum size of HTTP requests handling file uploads (in bytes)
****
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]