Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement size limits on HTTP header number. #1577

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dennis-zheng
Copy link

No description provided.

@dennis-zheng
Copy link
Author

I implemented measures to prevent a slow HTTP attack caused by an excessive number of HTTP headers.
Additionally, I have conducted tests in regress_http.c.
regress _http_data_length_constraints

Copy link
Member

@azat azat left a comment

Choose a reason for hiding this comment

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

LGTM. Will you use this new API in your code?

@dennis-zheng
Copy link
Author

Of course, some attack protection platforms may detect an attack by reaching the maximum HTTP header number.

@azat
Copy link
Member

azat commented Apr 15, 2024

CI failed:

/home/runner/work/libevent/libevent/test/regress_http.c:4849:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
 4849 |  char header_index[NI_MAXSERV];
      |  ^~~~
/home/runner/work/libevent/libevent/test/regress_http.c:4850:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘const long unsigned int’} [-Werror=sign-compare]
 4850 |  for (int i = 0; i < size; ++i) {
      |                    ^

/home/runner/work/libevent/libevent/test/regress_http.c:4849:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
 4849 |  char header_index[NI_MAXSERV];
      |  ^~~~
fix
/home/runner/work/libevent/libevent/test/regress_http.c:4850:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘const long unsigned int’} [-Werror=sign-compare]
 4850 |  for (int i = 0; i < size; ++i) {
      |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants