Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5f996d4

Browse files
author
Felipe Zimmerle
committed
Adds regression test to SecRequestBodyLimitAction
This commits adds the following regiression test to SecRequestBodyLimitAction:* config - SecRequestBodyLimitAction Reject (multipart/greater - chunked): passed* config - SecRequestBodyLimitAction Reject (plain/greater): passed* config - SecRequestBodyLimitAction ProcessPartial (multipart/greater - chunked): passed* config - SecRequestBodyLimitAction ProcessPartial (plain/greater): passed
1 parent498b9b2 commit5f996d4

File tree

1 file changed

+156
-0
lines changed

1 file changed

+156
-0
lines changed

‎tests/regression/config/10-request-directives.t‎

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,162 @@
489489
1024
490490
),
491491
},
492+
{
493+
type=>"config",
494+
comment=>"SecRequestBodyLimitAction Reject (multipart/greater - chunked)",
495+
conf=> qq(
496+
SecRuleEngine On
497+
SecDebugLog$ENV{DEBUG_LOG}
498+
SecDebugLogLevel9
499+
SecRequestBodyAccess On
500+
SecRequestBodyLimitAction Reject
501+
SecRequestBodyLimit20
502+
),
503+
match_log=> {
504+
debug=> [ qr/Requestbodyis larger than the configured limit \(20\).. Denywith code \(413\)/,1 ],
505+
},
506+
match_response=> {
507+
status=> qr/^413$/,
508+
},
509+
request=> normalize_raw_request_data(
510+
qq(
511+
POST/test.txt HTTP/1.1
512+
Host:$ENV{SERVER_NAME}:$ENV{SERVER_PORT}
513+
User-Agent:$ENV{USER_AGENT}
514+
Content-Type: multipart/form-data; boundary=---------------------------69343412719991675451336310646
515+
Transfer-Encoding: chunked
516+
517+
),
518+
)
519+
.encode_chunked(
520+
normalize_raw_request_data(
521+
q(
522+
-----------------------------69343412719991675451336310646
523+
Content-Disposition: form-data;name="a"
524+
525+
1
526+
-----------------------------69343412719991675451336310646
527+
Content-Disposition: form-data;name="b"
528+
529+
2
530+
-----------------------------69343412719991675451336310646--
531+
)
532+
),
533+
1024
534+
),
535+
},
536+
{
537+
type=>"config",
538+
comment=>"SecRequestBodyLimitAction Reject (plain/greater)",
539+
conf=> qq(
540+
SecRuleEngine On
541+
SecDebugLog$ENV{DEBUG_LOG}
542+
SecDebugLogLevel9
543+
SecRequestBodyAccess On
544+
SecRequestBodyLimitAction Reject
545+
SecRequestBodyLimit131072
546+
),
547+
match_log=> {
548+
-debug=> [ qr/Requestbodyis larger than the configured limit \(131072\).. Denywith code \(413\)/,1 ],
549+
},
550+
match_response=> {
551+
status=> qr/^413$/,
552+
},
553+
request=>new HTTP::Request(
554+
POST=>"http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
555+
[
556+
"Content-Type"=>"application/json",
557+
],
558+
normalize_raw_request_data(
559+
q(
560+
{
561+
)."'abcdefghijlmnopq'='abcdefghijlmnopqrstuvxz',\\n"x99000. q(
562+
},
563+
),
564+
),
565+
),
566+
},
567+
568+
569+
{
570+
type=>"config",
571+
comment=>"SecRequestBodyLimitAction ProcessPartial (multipart/greater - chunked)",
572+
conf=> qq(
573+
SecRuleEngine On
574+
SecDebugLog$ENV{DEBUG_LOG}
575+
SecDebugLogLevel9
576+
SecRequestBodyAccess On
577+
SecRequestBodyLimitAction ProcessPartial
578+
SecRequestBodyLimit131072
579+
),
580+
match_log=> {
581+
-debug=> [ qr/Requestbodyis larger than the configured limit/,1],
582+
},
583+
match_response=> {
584+
status=> qr/^200$/,
585+
},
586+
request=> normalize_raw_request_data(
587+
qq(
588+
POST/test.txt HTTP/1.1
589+
Host:$ENV{SERVER_NAME}:$ENV{SERVER_PORT}
590+
User-Agent:$ENV{USER_AGENT}
591+
Content-Type: multipart/form-data; boundary=---------------------------69343412719991675451336310646
592+
Transfer-Encoding: chunked
593+
594+
),
595+
)
596+
.encode_chunked(
597+
normalize_raw_request_data(
598+
q(
599+
-----------------------------69343412719991675451336310646
600+
Content-Disposition: form-data;name="a"
601+
602+
1)."a"x131072. q(
603+
-----------------------------69343412719991675451336310646
604+
Content-Disposition: form-data;name="b"
605+
606+
2)."b"x131072. q(
607+
-----------------------------69343412719991675451336310646--
608+
)
609+
),
610+
131072*3
611+
),
612+
},
613+
{
614+
type=>"config",
615+
comment=>"SecRequestBodyLimitAction ProcessPartial (plain/greater)",
616+
conf=> qq(
617+
SecRuleEngine On
618+
SecDebugLog$ENV{DEBUG_LOG}
619+
SecDebugLogLevel9
620+
SecRequestBodyAccess On
621+
SecRequestBodyLimitAction ProcessPartial
622+
SecRequestBodyLimit131072
623+
),
624+
match_log=> {
625+
-debug=> [ qr/Requestbodyis larger than the configured limit/,1],
626+
},
627+
match_response=> {
628+
status=> qr/^200$/,
629+
},
630+
request=>new HTTP::Request(
631+
POST=>"http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt",
632+
[
633+
"Content-Type"=>"application/json",
634+
],
635+
normalize_raw_request_data(
636+
q(
637+
{
638+
)."'abcdefghijlmnopq'='abcdefghijlmnopqrstuvxz',\\n"x99000. q(
639+
},
640+
),
641+
),
642+
),
643+
},
644+
645+
646+
647+
492648

493649
# SecCookieFormat
494650
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp