|
260 | 260 | ), |
261 | 261 | }, |
262 | 262 |
|
263 | | -# The four tests below checks whether the partial text content is added or not. |
| 263 | +# The 8 tests below checks whether the partial text content is added or not. |
264 | 264 | # |
265 | 265 | # xmlParseChunk adds a text content whose length is greater than or equal to 300 bytes even when |
266 | 266 | # you pass 0 as the terminate argument. If the length is less than 300 bytes it does not a text content |
|
382 | 382 | '<root><a>' . '1' x 16073 . '<b>' . '2' x 290 . 'bad_value ', |
383 | 383 | ), |
384 | 384 | }, |
| 385 | +{ |
| 386 | + type => "config", |
| 387 | + comment => "SecRequestBodyLimitAction ProcessPartial (XML, short, >NoFilesLimit, chunk_len>=300, deny)", |
| 388 | + conf => qq( |
| 389 | + SecRuleEngine On |
| 390 | + SecDebugLog $ENV{DEBUG_LOG} |
| 391 | + SecDebugLogLevel 9 |
| 392 | + SecRequestBodyAccess On |
| 393 | + SecRequestBodyLimitAction ProcessPartial |
| 394 | + SecRequestBodyNoFilesLimit 1024 |
| 395 | + SecRequestBodyLimit 2048 |
| 396 | + SecRule REQUEST_HEADERS:Content-Type "(?:application(?:/soap\\+|/)|text/)xml" "id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=XML" |
| 397 | + SecRule XML:/* "bad_value" "id:'200002',phase:2,t:none,deny" |
| 398 | + ), |
| 399 | + match_log => { |
| 400 | + error => [ qr/Request body no files data length is larger than the configured limit \(1024\)\./, 1 ], |
| 401 | + }, |
| 402 | + match_response => { |
| 403 | + status => qr/^403$/, |
| 404 | + }, |
| 405 | + request => new HTTP::Request( |
| 406 | + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", |
| 407 | + [ |
| 408 | + "Content-Type" => "application/xml", |
| 409 | + "Content-Length" => "1025", |
| 410 | + ], |
| 411 | + '<root><a>' . '1' x 708 . '</a><b>' . '2' x 291 . 'bad_value ', |
| 412 | + ), |
| 413 | +}, |
| 414 | +{ |
| 415 | + type => "config", |
| 416 | + comment => "SecRequestBodyLimitAction ProcessPartial (XML, short, >NoFilesLimit, chunk_len<300, pass)", |
| 417 | + conf => qq( |
| 418 | + SecRuleEngine On |
| 419 | + SecDebugLog $ENV{DEBUG_LOG} |
| 420 | + SecDebugLogLevel 9 |
| 421 | + SecRequestBodyAccess On |
| 422 | + SecRequestBodyLimitAction ProcessPartial |
| 423 | + SecRequestBodyNoFilesLimit 1024 |
| 424 | + SecRequestBodyLimit 2048 |
| 425 | + SecRule REQUEST_HEADERS:Content-Type "(?:application(?:/soap\\+|/)|text/)xml" "id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=XML" |
| 426 | + SecRule XML:/* "bad_value" "id:'200002',phase:2,t:none,deny" |
| 427 | + ), |
| 428 | + match_log => { |
| 429 | + error => [ qr/Request body no files data length is larger than the configured limit \(1024\)\./, 1 ], |
| 430 | + }, |
| 431 | + match_response => { |
| 432 | + status => qr/^200$/, |
| 433 | + }, |
| 434 | + request => new HTTP::Request( |
| 435 | + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", |
| 436 | + [ |
| 437 | + "Content-Type" => "application/xml", |
| 438 | + "Content-Length" => "1025", |
| 439 | + ], |
| 440 | + '<root><a>' . '1' x 709 . '</a><b>' . '2' x 290 . 'bad_value ', |
| 441 | + ), |
| 442 | +}, |
| 443 | +{ |
| 444 | + type => "config", |
| 445 | + comment => "SecRequestBodyLimitAction ProcessPartial (XML, short, >NoFilesLimit, nested, chunk_len>=300, deny)", |
| 446 | + conf => qq( |
| 447 | + SecRuleEngine On |
| 448 | + SecDebugLog $ENV{DEBUG_LOG} |
| 449 | + SecDebugLogLevel 9 |
| 450 | + SecRequestBodyAccess On |
| 451 | + SecRequestBodyLimitAction ProcessPartial |
| 452 | + SecRequestBodyNoFilesLimit 1024 |
| 453 | + SecRequestBodyLimit 2048 |
| 454 | + SecRule REQUEST_HEADERS:Content-Type "(?:application(?:/soap\\+|/)|text/)xml" "id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=XML" |
| 455 | + SecRule XML:/* "bad_value" "id:'200002',phase:2,t:none,deny" |
| 456 | + ), |
| 457 | + match_log => { |
| 458 | + error => [ qr/Request body no files data length is larger than the configured limit \(1024\)\./, 1 ], |
| 459 | + }, |
| 460 | + match_response => { |
| 461 | + status => qr/^403$/, |
| 462 | + }, |
| 463 | + request => new HTTP::Request( |
| 464 | + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", |
| 465 | + [ |
| 466 | + "Content-Type" => "application/xml", |
| 467 | + "Content-Length" => "1025", |
| 468 | + ], |
| 469 | + '<root><a>' . '1' x 712 . '<b>' . '2' x 291 . 'bad_value ', |
| 470 | + ), |
| 471 | +}, |
| 472 | +{ |
| 473 | + type => "config", |
| 474 | + comment => "SecRequestBodyLimitAction ProcessPartial (XML, short, >NoFilesLimit, nested, chunk_len<300, pass)", |
| 475 | + conf => qq( |
| 476 | + SecRuleEngine On |
| 477 | + SecDebugLog $ENV{DEBUG_LOG} |
| 478 | + SecDebugLogLevel 9 |
| 479 | + SecRequestBodyAccess On |
| 480 | + SecRequestBodyLimitAction ProcessPartial |
| 481 | + SecRequestBodyNoFilesLimit 1024 |
| 482 | + SecRequestBodyLimit 2048 |
| 483 | + SecRule REQUEST_HEADERS:Content-Type "(?:application(?:/soap\\+|/)|text/)xml" "id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=XML" |
| 484 | + SecRule XML:/* "bad_value" "id:'200002',phase:2,t:none,deny" |
| 485 | + ), |
| 486 | + match_log => { |
| 487 | + error => [ qr/Request body no files data length is larger than the configured limit \(1024\)\./, 1 ], |
| 488 | + }, |
| 489 | + match_response => { |
| 490 | + status => qr/^200$/, |
| 491 | + }, |
| 492 | + request => new HTTP::Request( |
| 493 | + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", |
| 494 | + [ |
| 495 | + "Content-Type" => "application/xml", |
| 496 | + "Content-Length" => "1025", |
| 497 | + ], |
| 498 | + '<root><a>' . '1' x 713 . '<b>' . '2' x 290 . 'bad_value ', |
| 499 | + ), |
| 500 | +}, |
385 | 501 |
|
386 | 502 | { |
387 | 503 | type => "config", |
|
0 commit comments