Skip to content

CWE-016 - Adds MaxRequestLength check for ASP.NET#2200

Closed
cldrn wants to merge 18 commits intogithub:mainfrom
cldrn:cwe-016
Closed

CWE-016 - Adds MaxRequestLength check for ASP.NET#2200
cldrn wants to merge 18 commits intogithub:mainfrom
cldrn:cwe-016

Conversation

@cldrn
Copy link
Contributor

@cldrn cldrn commented Oct 24, 2019

maxrequestlength

@cldrn cldrn requested review from a team and jf205 as code owners October 24, 2019 23:29
Copy link
Contributor

@hvitved hvitved left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for your contribution, much appreciated. I have a few tedious comments, otherwise LGTM.

@hvitved hvitved added the C# label Oct 28, 2019
@cldrn
Copy link
Contributor Author

cldrn commented Oct 28, 2019

Thanks for the feedback. I've address all your comments. I wrote them while analyzing my first project so I'm still reading up on the documentation.

Awesome work!

Copy link
Contributor

@jf205 jf205 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @cldrn. I've got a few doc-related comments that would be good to address before this is merged. Thanks!

@@ -0,0 +1,23 @@
/**
* @name Large 'maxRequestLength' value
* @description Setting a large 'maxRequestLength' value may render a web page vulnerable to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @description Setting a large 'maxRequestLength' value may render a web page vulnerable to
* @description Setting a large 'maxRequestLength' value may render a webpage vulnerable to

<sample src="Web.config.bad" />

<p>
Unless such a high value is strictly needed, it is better to set a lower value, for example 4096:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest using consistent units (KB) in the examples.

<recommendation>

<p>
The recommended value is 4096 but you should try setting it as small as possible according to business requirements.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps change this sentence to:

The recommended value is 4096 KB, but you should set it as small as possible according to business requirements.

(Note, include units)

| **Query** | **Tags** | **Purpose** |
|-----------------------------|-----------|--------------------------------------------------------------------|
| Unsafe year argument for 'DateTime' constructor (`cs/unsafe-year-construction`) | reliability, date-time | Finds incorrect manipulation of `DateTime` values, which could lead to invalid dates. |
| Large 'maxRequestLength' value (`cs/web/large-max-request-length`) | security, frameworks/asp.net, external/cwe/cwe-16 | Finds `web.config` files with large (greater than 4096) `maxRequestLength` attributes. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| Large 'maxRequestLength' value (`cs/web/large-max-request-length`) | security, frameworks/asp.net, external/cwe/cwe-16 | Finds `web.config` files with large (greater than 4096) `maxRequestLength` attributes. |
| Large 'maxRequestLength' value (`cs/web/large-max-request-length`) | security, frameworks/asp.net, external/cwe/cwe-16 | Finds `web.config` files with large (greater than 4096 KB) `maxRequestLength` attributes. |

<sample src="Web.config.good" />

</example>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reference to some authoritative docs you could include here?

@cldrn
Copy link
Contributor Author

cldrn commented Nov 18, 2019

Closed this issue as I removed that local copy and started doing each PR in their own branch. At this point I have deleted the original branch for that PR. I've addressed the comments in there but can we keep working on this one #2355?

The other fork had a PR on master branch which became a mess when I added others there by mistake. Hence, why I started from stratch with each PR in their own branch.

:)

@hvitved
Copy link
Contributor

hvitved commented Nov 18, 2019

Closing in favor of #2355.

@adityasharad adityasharad changed the base branch from master to main August 14, 2020 18:35
@adityasharad adityasharad requested a review from a team as a code owner August 14, 2020 18:35
@hvitved hvitved closed this Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants