|
920 | 920 | ), |
921 | 921 | ), |
922 | 922 | }, |
923 | | -
|
924 | | -
|
| 923 | +{ |
| 924 | + type => "config", |
| 925 | + comment => "SecRequestBodyLimitAction ProcessPartial (url-encoded/bad_name before limit)", |
| 926 | + conf => qq( |
| 927 | + SecRuleEngine On |
| 928 | + SecDebugLog $ENV{DEBUG_LOG} |
| 929 | + SecDebugLogLevel 9 |
| 930 | + SecRequestBodyAccess On |
| 931 | + SecRequestBodyLimitAction ProcessPartial |
| 932 | + SecRequestBodyLimit 12 |
| 933 | + SecRule REQBODY_ERROR "!\@eq 0" "id:'200001', phase:2,t:none,log,deny,status:400,msg:'Failed to parse request body.',logdata:'%{reqbody_error_msg}',severity:2" |
| 934 | + SecRule ARGS_NAMES "bad_name" "id:'200002',phase:2,t:none,deny |
| 935 | + ), |
| 936 | + match_log => { |
| 937 | + -error => [ qr/Multipart parsing error: Multipart: Final boundary missing./, 1], |
| 938 | + }, |
| 939 | + match_response => { |
| 940 | + status => qr/^403$/, |
| 941 | + }, |
| 942 | + request => new HTTP::Request( |
| 943 | + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", |
| 944 | + [ |
| 945 | + "Content-Type" => "application/x-www-form-urlencoded", |
| 946 | + ], |
| 947 | + normalize_raw_request_data( |
| 948 | + q(a=1&bad_name=2&c=3), |
| 949 | + ), |
| 950 | + ), |
| 951 | +}, |
| 952 | +{ |
| 953 | + type => "config", |
| 954 | + comment => "SecRequestBodyLimitAction ProcessPartial (url-encoded/bad_name after limit)", |
| 955 | + conf => qq( |
| 956 | + SecRuleEngine On |
| 957 | + SecDebugLog $ENV{DEBUG_LOG} |
| 958 | + SecDebugLogLevel 9 |
| 959 | + SecRequestBodyAccess On |
| 960 | + SecRequestBodyLimitAction ProcessPartial |
| 961 | + SecRequestBodyLimit 11 |
| 962 | + SecRule REQBODY_ERROR "!\@eq 0" "id:'200001', phase:2,t:none,log,deny,status:400,msg:'Failed to parse request body.',logdata:'%{reqbody_error_msg}',severity:2" |
| 963 | + SecRule ARGS_NAMES "bad_name" "id:'200002',phase:2,t:none,deny |
| 964 | + ), |
| 965 | + match_log => { |
| 966 | + -error => [ qr/Multipart parsing error: Multipart: Final boundary missing./, 1], |
| 967 | + }, |
| 968 | + match_response => { |
| 969 | + status => qr/^200$/, |
| 970 | + }, |
| 971 | + request => new HTTP::Request( |
| 972 | + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", |
| 973 | + [ |
| 974 | + "Content-Type" => "application/x-www-form-urlencoded", |
| 975 | + ], |
| 976 | + normalize_raw_request_data( |
| 977 | + q(a=1&bad_name=2&c=3), |
| 978 | + ), |
| 979 | + ), |
| 980 | +}, |
| 981 | +{ |
| 982 | + type => "config", |
| 983 | + comment => "SecRequestBodyLimitAction ProcessPartial (url-encoded/bad_value before limit)", |
| 984 | + conf => qq( |
| 985 | + SecRuleEngine On |
| 986 | + SecDebugLog $ENV{DEBUG_LOG} |
| 987 | + SecDebugLogLevel 9 |
| 988 | + SecRequestBodyAccess On |
| 989 | + SecRequestBodyLimitAction ProcessPartial |
| 990 | + SecRequestBodyLimit 15 |
| 991 | + SecRule REQBODY_ERROR "!\@eq 0" "id:'200001', phase:2,t:none,log,deny,status:400,msg:'Failed to parse request body.',logdata:'%{reqbody_error_msg}',severity:2" |
| 992 | + SecRule ARGS "bad_value" "id:'200002',phase:2,t:none,deny |
| 993 | + ), |
| 994 | + match_log => { |
| 995 | + -error => [ qr/Multipart parsing error: Multipart: Final boundary missing./, 1], |
| 996 | + }, |
| 997 | + match_response => { |
| 998 | + status => qr/^403$/, |
| 999 | + }, |
| 1000 | + request => new HTTP::Request( |
| 1001 | + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", |
| 1002 | + [ |
| 1003 | + "Content-Type" => "application/x-www-form-urlencoded", |
| 1004 | + ], |
| 1005 | + normalize_raw_request_data( |
| 1006 | + q(a=1&b=bad_value&c=3), |
| 1007 | + ), |
| 1008 | + ), |
| 1009 | +}, |
| 1010 | +{ |
| 1011 | + type => "config", |
| 1012 | + comment => "SecRequestBodyLimitAction ProcessPartial (url-encoded/bad_value after limit)", |
| 1013 | + conf => qq( |
| 1014 | + SecRuleEngine On |
| 1015 | + SecDebugLog $ENV{DEBUG_LOG} |
| 1016 | + SecDebugLogLevel 9 |
| 1017 | + SecRequestBodyAccess On |
| 1018 | + SecRequestBodyLimitAction ProcessPartial |
| 1019 | + SecRequestBodyLimit 14 |
| 1020 | + SecRule REQBODY_ERROR "!\@eq 0" "id:'200001', phase:2,t:none,log,deny,status:400,msg:'Failed to parse request body.',logdata:'%{reqbody_error_msg}',severity:2" |
| 1021 | + SecRule ARGS "bad_value" "id:'200002',phase:2,t:none,deny |
| 1022 | + ), |
| 1023 | + match_log => { |
| 1024 | + -error => [ qr/Multipart parsing error: Multipart: Final boundary missing./, 1], |
| 1025 | + }, |
| 1026 | + match_response => { |
| 1027 | + status => qr/^200$/, |
| 1028 | + }, |
| 1029 | + request => new HTTP::Request( |
| 1030 | + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", |
| 1031 | + [ |
| 1032 | + "Content-Type" => "application/x-www-form-urlencoded", |
| 1033 | + ], |
| 1034 | + normalize_raw_request_data( |
| 1035 | + q(a=1&b=bad_value&c=3), |
| 1036 | + ), |
| 1037 | + ), |
| 1038 | +}, |
| 1039 | +{ |
| 1040 | + type => "config", |
| 1041 | + comment => "SecRequestBodyLimitAction ProcessPartial (json/bad_name after limit)", |
| 1042 | + conf => qq( |
| 1043 | + SecRuleEngine On |
| 1044 | + SecDebugLog $ENV{DEBUG_LOG} |
| 1045 | + SecDebugLogLevel 9 |
| 1046 | + SecRequestBodyAccess On |
| 1047 | + SecRequestBodyLimitAction ProcessPartial |
| 1048 | + SecRequestBodyLimit 12 |
| 1049 | + SecRule REQUEST_HEADERS:Content-Type "application/json" "id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=JSON" |
| 1050 | + SecRule REQBODY_ERROR "!\@eq 0" "id:'200001', phase:2,t:none,log,deny,status:400,msg:'Failed to parse request body.',logdata:'%{reqbody_error_msg}',severity:2" |
| 1051 | + SecRule ARGS_NAMES "bad_name" "id:'200002',phase:2,t:none,deny |
| 1052 | + ), |
| 1053 | + match_response => { |
| 1054 | + status => qr/^200$/, |
| 1055 | + }, |
| 1056 | + request => new HTTP::Request( |
| 1057 | + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", |
| 1058 | + [ |
| 1059 | + "Content-Type" => "application/json", |
| 1060 | + ], |
| 1061 | + normalize_raw_request_data( |
| 1062 | + q({"bad_name":1}), |
| 1063 | + ), |
| 1064 | + ), |
| 1065 | +}, |
| 1066 | +{ |
| 1067 | + type => "config", |
| 1068 | + comment => "SecRequestBodyLimitAction ProcessPartial (json/bad_name before limit)", |
| 1069 | + conf => qq( |
| 1070 | + SecRuleEngine On |
| 1071 | + SecDebugLog $ENV{DEBUG_LOG} |
| 1072 | + SecDebugLogLevel 9 |
| 1073 | + SecRequestBodyAccess On |
| 1074 | + SecRequestBodyLimitAction ProcessPartial |
| 1075 | + SecRequestBodyLimit 13 |
| 1076 | + SecRule REQUEST_HEADERS:Content-Type "application/json" "id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=JSON" |
| 1077 | + SecRule REQBODY_ERROR "!\@eq 0" "id:'200001', phase:2,t:none,log,deny,status:400,msg:'Failed to parse request body.',logdata:'%{reqbody_error_msg}',severity:2" |
| 1078 | + SecRule ARGS_NAMES "bad_name" "id:'200002',phase:2,t:none,deny |
| 1079 | + ), |
| 1080 | + match_response => { |
| 1081 | + status => qr/^403$/, |
| 1082 | + }, |
| 1083 | + request => new HTTP::Request( |
| 1084 | + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", |
| 1085 | + [ |
| 1086 | + "Content-Type" => "application/json", |
| 1087 | + ], |
| 1088 | + normalize_raw_request_data( |
| 1089 | + q({"bad_name":1}), |
| 1090 | + ), |
| 1091 | + ), |
| 1092 | +}, |
| 1093 | +{ |
| 1094 | + type => "config", |
| 1095 | + comment => "SecRequestBodyLimitAction ProcessPartial (json/bad_value after limit)", |
| 1096 | + conf => qq( |
| 1097 | + SecRuleEngine On |
| 1098 | + SecDebugLog $ENV{DEBUG_LOG} |
| 1099 | + SecDebugLogLevel 9 |
| 1100 | + SecRequestBodyAccess On |
| 1101 | + SecRequestBodyLimitAction ProcessPartial |
| 1102 | + SecRequestBodyLimit 15 |
| 1103 | + SecRule REQUEST_HEADERS:Content-Type "application/json" "id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=JSON" |
| 1104 | + SecRule REQBODY_ERROR "!\@eq 0" "id:'200001', phase:2,t:none,log,deny,status:400,msg:'Failed to parse request body.',logdata:'%{reqbody_error_msg}',severity:2" |
| 1105 | + SecRule ARGS "bad_value" "id:'200002',phase:2,t:none,deny |
| 1106 | + ), |
| 1107 | + match_response => { |
| 1108 | + status => qr/^200$/, |
| 1109 | + }, |
| 1110 | + request => new HTTP::Request( |
| 1111 | + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", |
| 1112 | + [ |
| 1113 | + "Content-Type" => "application/json", |
| 1114 | + ], |
| 1115 | + normalize_raw_request_data( |
| 1116 | + q({"a":"bad_value"}), |
| 1117 | + ), |
| 1118 | + ), |
| 1119 | +}, |
| 1120 | +{ |
| 1121 | + type => "config", |
| 1122 | + comment => "SecRequestBodyLimitAction ProcessPartial (json/bad_value before limit)", |
| 1123 | + conf => qq( |
| 1124 | + SecRuleEngine On |
| 1125 | + SecDebugLog $ENV{DEBUG_LOG} |
| 1126 | + SecDebugLogLevel 9 |
| 1127 | + SecRequestBodyAccess On |
| 1128 | + SecRequestBodyLimitAction ProcessPartial |
| 1129 | + SecRequestBodyLimit 16 |
| 1130 | + SecRule REQUEST_HEADERS:Content-Type "application/json" "id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=JSON" |
| 1131 | + SecRule REQBODY_ERROR "!\@eq 0" "id:'200001', phase:2,t:none,log,deny,status:400,msg:'Failed to parse request body.',logdata:'%{reqbody_error_msg}',severity:2" |
| 1132 | + SecRule ARGS "bad_value" "id:'200002',phase:2,t:none,deny |
| 1133 | + ), |
| 1134 | + match_response => { |
| 1135 | + status => qr/^403$/, |
| 1136 | + }, |
| 1137 | + request => new HTTP::Request( |
| 1138 | + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", |
| 1139 | + [ |
| 1140 | + "Content-Type" => "application/json", |
| 1141 | + ], |
| 1142 | + normalize_raw_request_data( |
| 1143 | + q({"a":"bad_value"}), |
| 1144 | + ), |
| 1145 | + ), |
| 1146 | +}, |
| 1147 | +{ |
| 1148 | + type => "config", |
| 1149 | + comment => "SecRequestBodyLimitAction ProcessPartial (json/ill-formed after limit)", |
| 1150 | + conf => qq( |
| 1151 | + SecRuleEngine On |
| 1152 | + SecDebugLog $ENV{DEBUG_LOG} |
| 1153 | + SecDebugLogLevel 9 |
| 1154 | + SecRequestBodyAccess On |
| 1155 | + SecRequestBodyLimitAction ProcessPartial |
| 1156 | + SecRequestBodyLimit 17 |
| 1157 | + SecRule REQUEST_HEADERS:Content-Type "application/json" "id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=JSON" |
| 1158 | + SecRule REQBODY_ERROR "!\@eq 0" "id:'200001', phase:2,t:none,log,deny,status:400,msg:'Failed to parse request body.',logdata:'%{reqbody_error_msg}',severity:2" |
| 1159 | + SecRule ARGS "bad_value" "id:'200002',phase:2,t:none,deny |
| 1160 | + ), |
| 1161 | + match_response => { |
| 1162 | + status => qr/^403$/, |
| 1163 | + }, |
| 1164 | + request => new HTTP::Request( |
| 1165 | + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", |
| 1166 | + [ |
| 1167 | + "Content-Type" => "application/json", |
| 1168 | + ], |
| 1169 | + normalize_raw_request_data( |
| 1170 | + q({"a":"bad_value"}]), |
| 1171 | + ), |
| 1172 | + ), |
| 1173 | +}, |
| 1174 | +{ |
| 1175 | + type => "config", |
| 1176 | + comment => "SecRequestBodyLimitAction ProcessPartial (json/ill-formed before limit)", |
| 1177 | + conf => qq( |
| 1178 | + SecRuleEngine On |
| 1179 | + SecDebugLog $ENV{DEBUG_LOG} |
| 1180 | + SecDebugLogLevel 9 |
| 1181 | + SecRequestBodyAccess On |
| 1182 | + SecRequestBodyLimitAction ProcessPartial |
| 1183 | + SecRequestBodyLimit 18 |
| 1184 | + SecRule REQUEST_HEADERS:Content-Type "application/json" "id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=JSON" |
| 1185 | + SecRule REQBODY_ERROR "!\@eq 0" "id:'200001', phase:2,t:none,log,deny,status:400,msg:'Failed to parse request body.',logdata:'%{reqbody_error_msg}',severity:2" |
| 1186 | + SecRule ARGS "bad_value" "id:'200002',phase:2,t:none,deny |
| 1187 | + ), |
| 1188 | + match_response => { |
| 1189 | + status => qr/^400$/, |
| 1190 | + }, |
| 1191 | + request => new HTTP::Request( |
| 1192 | + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", |
| 1193 | + [ |
| 1194 | + "Content-Type" => "application/json", |
| 1195 | + ], |
| 1196 | + normalize_raw_request_data( |
| 1197 | + q({"a":"bad_value"}]), |
| 1198 | + ), |
| 1199 | + ), |
| 1200 | +}, |
| 1201 | +{ |
| 1202 | + type => "config", |
| 1203 | + comment => "SecRequestBodyLimitAction ProcessPartial (xml/bad_value after limit)", |
| 1204 | + conf => qq( |
| 1205 | + SecRuleEngine On |
| 1206 | + SecDebugLog $ENV{DEBUG_LOG} |
| 1207 | + SecDebugLogLevel 9 |
| 1208 | + SecRequestBodyAccess On |
| 1209 | + SecRequestBodyLimitAction ProcessPartial |
| 1210 | + SecRequestBodyLimit 11 |
| 1211 | + SecRule REQUEST_HEADERS:Content-Type "(?:application(?:/soap\\+|/)|text/)xml" "id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=XML" |
| 1212 | + SecRule REQBODY_ERROR "!\@eq 0" "id:'200001', phase:2,t:none,log,deny,status:400,msg:'Failed to parse request body.',logdata:'%{reqbody_error_msg}',severity:2" |
| 1213 | + SecRule XML:/* "bad_value" "id:'200002',phase:2,t:none,deny |
| 1214 | + ), |
| 1215 | + match_response => { |
| 1216 | + status => qr/^200$/, |
| 1217 | + }, |
| 1218 | + request => new HTTP::Request( |
| 1219 | + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", |
| 1220 | + [ |
| 1221 | + "Content-Type" => "application/xml", |
| 1222 | + ], |
| 1223 | + normalize_raw_request_data( |
| 1224 | + q(<a>bad_value</a>), |
| 1225 | + ), |
| 1226 | + ), |
| 1227 | +}, |
| 1228 | +{ |
| 1229 | + type => "config", |
| 1230 | + comment => "SecRequestBodyLimitAction ProcessPartial (xml/bad_value before limit)", |
| 1231 | + conf => qq( |
| 1232 | + SecRuleEngine On |
| 1233 | + SecDebugLog $ENV{DEBUG_LOG} |
| 1234 | + SecDebugLogLevel 9 |
| 1235 | + SecRequestBodyAccess On |
| 1236 | + SecRequestBodyLimitAction ProcessPartial |
| 1237 | + SecRequestBodyLimit 12 |
| 1238 | + SecRule REQUEST_HEADERS:Content-Type "(?:application(?:/soap\\+|/)|text/)xml" "id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=XML" |
| 1239 | + SecRule REQBODY_ERROR "!\@eq 0" "id:'200001', phase:2,t:none,log,deny,status:400,msg:'Failed to parse request body.',logdata:'%{reqbody_error_msg}',severity:2" |
| 1240 | + SecRule XML:/* "bad_value" "id:'200002',phase:2,t:none,deny |
| 1241 | + ), |
| 1242 | + match_response => { |
| 1243 | + status => qr/^403$/, |
| 1244 | + }, |
| 1245 | + request => new HTTP::Request( |
| 1246 | + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", |
| 1247 | + [ |
| 1248 | + "Content-Type" => "application/xml", |
| 1249 | + ], |
| 1250 | + normalize_raw_request_data( |
| 1251 | + q(<a>bad_value</a>), |
| 1252 | + ), |
| 1253 | + ), |
| 1254 | +}, |
| 1255 | +{ |
| 1256 | + type => "config", |
| 1257 | + comment => "SecRequestBodyLimitAction ProcessPartial (xml/ill-formed after limit)", |
| 1258 | + conf => qq( |
| 1259 | + SecRuleEngine On |
| 1260 | + SecDebugLog $ENV{DEBUG_LOG} |
| 1261 | + SecDebugLogLevel 9 |
| 1262 | + SecRequestBodyAccess On |
| 1263 | + SecRequestBodyLimitAction ProcessPartial |
| 1264 | + SecRequestBodyLimit 19 |
| 1265 | + SecRule REQUEST_HEADERS:Content-Type "(?:application(?:/soap\\+|/)|text/)xml" "id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=XML" |
| 1266 | + SecRule REQBODY_ERROR "!\@eq 0" "id:'200001', phase:2,t:none,log,deny,status:400,msg:'Failed to parse request body.',logdata:'%{reqbody_error_msg}',severity:2" |
| 1267 | + SecRule XML:/* "bad_value" "id:'200002',phase:2,t:none,deny |
| 1268 | + ), |
| 1269 | + match_response => { |
| 1270 | + status => qr/^403$/, |
| 1271 | + }, |
| 1272 | + request => new HTTP::Request( |
| 1273 | + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", |
| 1274 | + [ |
| 1275 | + "Content-Type" => "application/xml", |
| 1276 | + ], |
| 1277 | + normalize_raw_request_data( |
| 1278 | + q(<a>bad_value</a></b>), |
| 1279 | + ), |
| 1280 | + ), |
| 1281 | +}, |
| 1282 | +{ |
| 1283 | + type => "config", |
| 1284 | + comment => "SecRequestBodyLimitAction ProcessPartial (xml/ill-formed before limit)", |
| 1285 | + conf => qq( |
| 1286 | + SecRuleEngine On |
| 1287 | + SecDebugLog $ENV{DEBUG_LOG} |
| 1288 | + SecDebugLogLevel 9 |
| 1289 | + SecRequestBodyAccess On |
| 1290 | + SecRequestBodyLimitAction ProcessPartial |
| 1291 | + SecRequestBodyLimit 20 |
| 1292 | + SecRule REQUEST_HEADERS:Content-Type "(?:application(?:/soap\\+|/)|text/)xml" "id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=XML" |
| 1293 | + SecRule REQBODY_ERROR "!\@eq 0" "id:'200001', phase:2,t:none,log,deny,status:400,msg:'Failed to parse request body.',logdata:'%{reqbody_error_msg}',severity:2" |
| 1294 | + SecRule XML:/* "bad_value" "id:'200002',phase:2,t:none,deny |
| 1295 | + ), |
| 1296 | + match_response => { |
| 1297 | + status => qr/^400$/, |
| 1298 | + }, |
| 1299 | + request => new HTTP::Request( |
| 1300 | + POST => "http://$ENV{SERVER_NAME}:$ENV{SERVER_PORT}/test.txt", |
| 1301 | + [ |
| 1302 | + "Content-Type" => "application/xml", |
| 1303 | + ], |
| 1304 | + normalize_raw_request_data( |
| 1305 | + q(<a>bad_value</a></b>), |
| 1306 | + ), |
| 1307 | + ), |
| 1308 | +}, |
925 | 1309 |
|
926 | 1310 | # SecCookieFormat |
927 | 1311 | { |
|
0 commit comments