File tree Expand file tree Collapse file tree 1 file changed +66
-0
lines changed Expand file tree Collapse file tree 1 file changed +66
-0
lines changed Original file line number Diff line number Diff line change @@ -264,3 +264,69 @@ GET /hello?c1=2
264
264
GET /hello ?cc =2
265
265
--- no_error_log
266
266
[error ]
267
+
268
+
269
+
270
+ === TEST 12 : SQL injection
271
+ --- config
272
+ location /t {
273
+ content_by_lua_block {
274
+ local t = require (" lib.test_admin" ). test
275
+ local code, body = t(' /apisix/admin/routes/1' ,
276
+ ngx. HTTP_PUT,
277
+ [[{
278
+ " plugins" : {
279
+ " uri-blocker" : {
280
+ " block_rules" : [" select.+(from|limit)" , " (?:(union(.*?)select))" ]
281
+ }
282
+ },
283
+ " upstream" : {
284
+ " nodes" : {
285
+ " 127.0.0.1:1980" : 1
286
+ },
287
+ " type" : " roundrobin"
288
+ },
289
+ " uri" : " /hello"
290
+ }]]
291
+ )
292
+
293
+ if code >= 300 then
294
+ ngx. status = code
295
+ end
296
+ ngx. say (body )
297
+ }
298
+ }
299
+ -- - request
300
+ GET / t
301
+ -- - response_body
302
+ passed
303
+ -- - no_error_log
304
+ [error]
305
+ -- - error_log
306
+ concat block_rules: select.+ (from | limit)| (?: (union(.*? )select)),
307
+
308
+
309
+
310
+ === TEST 13 : hit block rule
311
+ --- request
312
+ GET /hello ?name =;select %20from %20sys
313
+ --- error_code : 403
314
+ --- no_error_log
315
+ [error ]
316
+
317
+
318
+
319
+ === TEST 14 : hit block rule
320
+ --- request
321
+ GET /hello ?name =;union %20select %20
322
+ --- error_code : 403
323
+ --- no_error_log
324
+ [error ]
325
+
326
+
327
+
328
+ === TEST 15 : not hit block rule
329
+ --- request
330
+ GET /hello ?cc =2
331
+ --- no_error_log
332
+ [error ]
You can’t perform that action at this time.
0 commit comments