#vi:filetype=perl use lib 'lib'; use Test::Nginx::Socket; plan tests => repeat_each(1) * blocks(); no_root_location(); no_long_string(); $ENV{TEST_NGINX_SERVROOT} = server_root(); run_tests(); __DATA__ === JSON0 : Valid JSON --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"glossary\": { \"title\": \"example glossary\", \"GlossDiv\": { \"title\": \"S\", \"GlossList\": { \"GlossEntry\": { \"ID\": \"SGML\", \"SortAs\": \"SGML\", \"GlossTerm\": \"Standard Generalized Markup Language\", \"Acronym\": \"SGML\", \"Abbrev\": \"ISO 8879:1986\", \"GlossDef\": { \"para\": \"A meta-markup language used to create markup languages such as DocBook.\", \"GlossSeeAlso\": [\"GML\", \"XML\"] }, \"GlossSee\": \"markup\" } } } } } " --- error_code: 200 === JSON1 : invalid JSON (double closing ']') --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"glossary\": { \"title\": \"example glossary\", \"GlossDiv\": { \"title\": \"S\", \"GlossList\": { \"GlossEntry\": { \"ID\": \"SGML\", \"SortAs\": \"SGML\", \"GlossTerm\": \"Standard Generalized Markup Language\", \"Acronym\": \"SGML\", \"Abbrev\": \"ISO 8879:1986\", \"GlossDef\": { \"para\": \"A meta-markup language used to create markup languages such as DocBook.\", \"GlossSeeAlso\": [\"GML\", \"XML\"]] }, \"GlossSee\": \"markup\" } } } } } " --- error_code: 412 === JSON2 : invalid JSON (missing closing ']') --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"glossary\": { \"title\": \"example glossary\", \"GlossDiv\": { \"title\": \"S\", \"GlossList\": { \"GlossEntry\": { \"ID\": \"SGML\", \"SortAs\": \"SGML\", \"GlossTerm\": \"Standard Generalized Markup Language\", \"Acronym\": \"SGML\", \"Abbrev\": \"ISO 8879:1986\", \"GlossDef\": { \"para\": \"A meta-markup language used to create markup languages such as DocBook.\", \"GlossSeeAlso\": [\"GML\", \"XML\" }, \"GlossSee\": \"markup\" } } } } } " --- error_code: 412 === JSON3 : invalid JSON (closing array with '}' instead of ']') --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"glossary\": { \"title\": \"example glossary\", \"GlossDiv\": { \"title\": \"S\", \"GlossList\": { \"GlossEntry\": { \"ID\": \"SGML\", \"SortAs\": \"SGML\", \"GlossTerm\": \"Standard Generalized Markup Language\", \"Acronym\": \"SGML\", \"Abbrev\": \"ISO 8879:1986\", \"GlossDef\": { \"para\": \"A meta-markup language used to create markup languages such as DocBook.\", \"GlossSeeAlso\": [\"GML\", \"XML\"} }, \"GlossSee\": \"markup\" } } } } } " --- error_code: 412 === JSON4 : invalid JSON (Missing final closing '}') --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"glossary\": { \"title\": \"example glossary\", \"GlossDiv\": { \"title\": \"S\", \"GlossList\": { \"GlossEntry\": { \"ID\": \"SGML\", \"SortAs\": \"SGML\", \"GlossTerm\": \"Standard Generalized Markup Language\", \"Acronym\": \"SGML\", \"Abbrev\": \"ISO 8879:1986\", \"GlossDef\": { \"para\": \"A meta-markup language used to create markup languages such as DocBook.\", \"GlossSeeAlso\": [\"GML\", \"XML\"] }, \"GlossSee\": \"markup\" } } } } " --- error_code: 412 === JSON5 : invalid JSON (Extra closing '}') --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"glossary\": { \"title\": \"example glossary\", \"GlossDiv\": { \"title\": \"S\", \"GlossList\": { \"GlossEntry\": { \"ID\": \"SGML\", \"SortAs\": \"SGML\", \"GlossTerm\": \"Standard Generalized Markup Language\", \"Acronym\": \"SGML\", \"Abbrev\": \"ISO 8879:1986\", \"GlossDef\": { \"para\": \"A meta-markup language used to create markup languages such as DocBook.\", \"GlossSeeAlso\": [\"GML\", \"XML\"] }, \"GlossSee\": \"markup\" } } } } }}" --- error_code: 412 === JSON6 : invalid JSON (Missing ',' in array) --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"glossary\": { \"title\": \"example glossary\", \"GlossDiv\": { \"title\": \"S\", \"GlossList\": { \"GlossEntry\": { \"ID\": \"SGML\", \"SortAs\": \"SGML\", \"GlossTerm\": \"Standard Generalized Markup Language\", \"Acronym\": \"SGML\", \"Abbrev\": \"ISO 8879:1986\", \"GlossDef\": { \"para\": \"A meta-markup language used to create markup languages such as DocBook.\", \"GlossSeeAlso\": [\"GML\" \"XML\"] }, \"GlossSee\": \"markup\" } } } } }" --- error_code: 412 === JSON7 : inValid JSON with empty array item (Extra ',' in array) --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"glossary\": { \"title\": \"example glossary\", \"GlossDiv\": { \"title\": \"S\", \"GlossList\": { \"GlossEntry\": { \"ID\": \"SGML\", \"SortAs\": \"SGML\", \"GlossTerm\": \"Standard Generalized Markup Language\", \"Acronym\": \"SGML\", \"Abbrev\": \"ISO 8879:1986\", \"GlossDef\": { \"para\": \"A meta-markup language used to create markup languages such as DocBook.\", \"GlossSeeAlso\": [\"GML\",\"XML\",] }, \"GlossSee\": \"markup\" } } } } }" --- error_code: 412 === JSON8 : valid JSON - too deep ! --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / {{{{{{{{{{{{[\"lol\"]}}}}}}}}}}}}" --- error_code: 412 === JSON9 : Valid JSON with ev0l stuff (array => var content) --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"glossary\": { \"title\": \"example glossary\", \"GlossDiv\": { \"title\": \"S\", \"GlossList\": { \"GlossEntry\": { \"ID\": \"SGML\", \"SortAs\": \"SGML\", \"GlossTerm\": \"Standard Generalized Markup Language\", \"Acronym\": \"SGML\", \"Abbrev\": \"ISO 8879:1986\", \"GlossDef\": { \"para\": \"A meta-markup language used to create markup languages such as DocBook.\", \"GlossSeeAlso\": [\"G var name) --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"glossary\": { \"title\": \"example glossary\", \"GlossDiv\": { \"title\": \"S\", \"GlossList\": { \"GlossEntry\": { \"ID\": \"SGML\", \"SortAs\": \"SGML\", \"GlossTerm\": \"Standard Generalized Markup Language\", \"Acronym\": \"SGML\", \"Abbrev\": \"ISO 8879:1986\", \"GlossDef\": { \"para\": \"A meta-markup language used to create markup languages such as DocBook.\", \"GlossSeeAl= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { }" --- error_code: 200 === JSON12 : malformed (closing object before array) Json --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"fuu\" : [\"laul\", {\"die\" : \"nope\" ]} }" --- error_code: 412 === JSON12 : malformed (unescaped quotes) --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"fuu\" : [\"laul\", {\"die\" : \"n\"ope\" }] }" --- error_code: 412 === JSON12 : escaped quotes --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config set $naxsi_extensive_log 1; location / { BasicRule wl:1001,1205; SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"fuu\" : [\"laul\", {\"die\" : \"n\\\"ope\" }] }" --- error_code: 200 === JSON13 : concatenation attempt (ie "foo":"bar"+eval(evil)+"foo") --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config set $naxsi_extensive_log 1; location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"fuu\" : \"oh \"+eval(evil)+\" my\"] }" --- error_code: 412 === JSON13 : concatenation attempt (ie "foo":"bar"+eval(evil)+"foo") --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config set $naxsi_extensive_log 1; location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"obvious\" : \"a= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"obvious\" : \"a= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"error\": \"ERROR_REPORT:{\\\"request\\\":{\\\"bar\\\":\\\"\\\"},\\\"response\\\":{\\\"bar\\\":[{\\\"schema_id\\\":\\\"foo\\\"}]}}\" }" --- error_code: 412 === JSON14 : bug_437 --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config set $naxsi_extensive_log 1; location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"number\": -2.806683719414e-14 }" --- error_code: 200 === JSON15 : JSON with XSS. --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config set $naxsi_extensive_log 1; location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"MyKey\": \"MyValue \" }" --- error_code: 412 === JSON16 : Null char in JSON with XSS. --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config set $naxsi_extensive_log 1; location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "POST / { \"MyKey\": \"MyValue \0 \" }" --- error_code: 412 === JSON17 : Valid JSON With HTTP Patch Method --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "PATCH / { \"glossary\": { \"title\": \"example glossary\", \"GlossDiv\": { \"title\": \"S\", \"GlossList\": { \"GlossEntry\": { \"ID\": \"SGML\", \"SortAs\": \"SGML\", \"GlossTerm\": \"Standard Generalized Markup Language\", \"Acronym\": \"SGML\", \"Abbrev\": \"ISO 8879:1986\", \"GlossDef\": { \"para\": \"A meta-markup language used to create markup languages such as DocBook.\", \"GlossSeeAlso\": [\"GML\", \"XML\"] }, \"GlossSee\": \"markup\" } } } } } " --- error_code: 200 === JSON1 : invalid JSON With HTTP Patch Method (double closing ']') --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "PATCH / { \"glossary\": { \"title\": \"example glossary\", \"GlossDiv\": { \"title\": \"S\", \"GlossList\": { \"GlossEntry\": { \"ID\": \"SGML\", \"SortAs\": \"SGML\", \"GlossTerm\": \"Standard Generalized Markup Language\", \"Acronym\": \"SGML\", \"Abbrev\": \"ISO 8879:1986\", \"GlossDef\": { \"para\": \"A meta-markup language used to create markup languages such as DocBook.\", \"GlossSeeAlso\": [\"GML\", \"XML\"]] }, \"GlossSee\": \"markup\" } } } } } " --- error_code: 412 === JSON18 : Valid JSON With exp numbers --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/json --- request eval use URI::Escape; "PATCH / { \"integer\": 2345678, \"integer_neg\": -1028, \"dotted\": 4.25564, \"dotted_neg\": -232.2719, \"upper_integer_neg_exp\": -1E10, \"upper_integer_exp\": 1E+6, \"upper_integer_exp_neg\": 1E-6, \"upper_dotted_neg_exp\": -7.3E9, \"upper_dotted_exp\": 2.1E+6, \"upper_dotted_exp_neg\": 3.5E-6, \"lower_integer_neg_exp\": -1e10, \"lower_integer_exp\": 1e+6, \"lower_integer_exp_neg\": 1e-6, \"lower_dotted_neg_exp\": -7.3e9, \"lower_dotted_exp\": 2.1e+6, \"lower_dotted_exp_neg\": 3.5e-6 } " --- error_code: 200 === JSON19 : Invalid JSON application/reports+json --- main_config load_module $TEST_NGINX_NAXSI_MODULE_SO; --- http_config include $TEST_NGINX_NAXSI_RULES; --- config location / { SecRulesEnabled; DeniedUrl "/RequestDenied"; CheckRule "$SQL >= 8" BLOCK; CheckRule "$RFI >= 8" BLOCK; CheckRule "$TRAVERSAL >= 4" BLOCK; CheckRule "$XSS >= 8" BLOCK; root $TEST_NGINX_SERVROOT/html/; index index.html index.htm; error_page 405 = $uri; } location /RequestDenied { return 412; } --- more_headers Content-Type: application/reports+json --- request eval use URI::Escape; "POST / [{ \"name\": \"value\" ] " --- error_code: 412