~ubuntu-branches/debian/sid/nginx/sid

« back to all changes in this revision

Viewing changes to debian/modules/naxsi/t/07naxsi_argnames.t

  • Committer: Package Import Robot
  • Author(s): Christos Trochalakis, Christos Trochalakis
  • Date: 2014-09-26 11:06:47 UTC
  • Revision ID: package-import@ubuntu.com-20140926110647-r7b6yarkhrhkrivx
Tags: 1.6.2-2
[ Christos Trochalakis ]
* Drop nginx-naxsi, nginx-naxsi-dbg, nginx-naxsi-ui packages.
  (Closes: #746199, #737146, #712445)
* debian/conf/nginx.conf:
  + Remove relic passenger stanga.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#vi:filetype=perl
2
 
 
3
 
 
4
 
# A AJOUTER :
5
 
# TEST CASE AVEC UNE REGLE SUR UN HEADER GENERIQUE
6
 
# La même sur des arguments :)
7
 
 
8
 
use lib 'lib';
9
 
use Test::Nginx::Socket;
10
 
 
11
 
plan tests => repeat_each(2) * blocks();
12
 
no_root_location();
13
 
no_long_string();
14
 
$ENV{TEST_NGINX_SERVROOT} = server_root();
15
 
run_tests();
16
 
__DATA__
17
 
=== WL TEST 1.0: Obvious test in arg
18
 
--- http_config
19
 
include /etc/nginx/naxsi_core.rules;
20
 
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
21
 
--- config
22
 
location / {
23
 
         #LearningMode;
24
 
         SecRulesEnabled;
25
 
         DeniedUrl "/RequestDenied";
26
 
         CheckRule "$SQL >= 8" BLOCK;
27
 
         CheckRule "$RFI >= 8" BLOCK;
28
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
29
 
         CheckRule "$XSS >= 8" BLOCK;
30
 
         root $TEST_NGINX_SERVROOT/html/;
31
 
         index index.html index.htm;
32
 
}
33
 
location /RequestDenied {
34
 
         return 412;
35
 
}
36
 
--- request
37
 
GET /?foobar=a
38
 
--- error_code: 412
39
 
 
40
 
=== WL TEST 1.01: Check non-collision of zone and 'name' flag
41
 
--- http_config
42
 
include /etc/nginx/naxsi_core.rules;
43
 
MainRule id:5 "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42";
44
 
--- config
45
 
location / {
46
 
         SecRulesEnabled;
47
 
         DeniedUrl "/RequestDenied";
48
 
         CheckRule "$SQL >= 8" BLOCK;
49
 
         CheckRule "$RFI >= 8" BLOCK;
50
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
51
 
         CheckRule "$XSS >= 8" BLOCK;
52
 
         root $TEST_NGINX_SERVROOT/html/;
53
 
         index index.html index.htm;
54
 
}
55
 
location /RequestDenied {
56
 
         return 412;
57
 
}
58
 
--- request
59
 
GET /?a=foobar
60
 
--- error_code: 412
61
 
 
62
 
=== WL TEST 1.1: Generic whitelist in ARGS_NAME
63
 
--- http_config
64
 
include /etc/nginx/naxsi_core.rules;
65
 
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
66
 
--- config
67
 
location / {
68
 
         #LearningMode;
69
 
         SecRulesEnabled;
70
 
         DeniedUrl "/RequestDenied";
71
 
         CheckRule "$SQL >= 8" BLOCK;
72
 
         CheckRule "$RFI >= 8" BLOCK;
73
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
74
 
         CheckRule "$XSS >= 8" BLOCK;
75
 
         root $TEST_NGINX_SERVROOT/html/;
76
 
         index index.html index.htm;
77
 
         BasicRule wl:1999 "mz:ARGS|NAME";
78
 
}
79
 
location /RequestDenied {
80
 
         return 412;
81
 
}
82
 
--- request
83
 
GET /?foobar=a
84
 
--- error_code: 200
85
 
 
86
 
 
87
 
=== WL TEST 1.11: Generic whitelist in ARGS_NAME, limit
88
 
--- http_config
89
 
include /etc/nginx/naxsi_core.rules;
90
 
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
91
 
--- config
92
 
location / {
93
 
         #LearningMode;
94
 
         SecRulesEnabled;
95
 
         DeniedUrl "/RequestDenied";
96
 
         CheckRule "$SQL >= 8" BLOCK;
97
 
         CheckRule "$RFI >= 8" BLOCK;
98
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
99
 
         CheckRule "$XSS >= 8" BLOCK;
100
 
         root $TEST_NGINX_SERVROOT/html/;
101
 
         index index.html index.htm;
102
 
         BasicRule wl:1999 "mz:ARGS";
103
 
}
104
 
location /RequestDenied {
105
 
         return 412;
106
 
}
107
 
--- request
108
 
GET /?foobar=a
109
 
--- error_code: 412
110
 
 
111
 
=== WL TEST 1.12: Generic whitelist in ARGS_NAME, limit
112
 
--- http_config
113
 
include /etc/nginx/naxsi_core.rules;
114
 
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
115
 
--- config
116
 
location / {
117
 
         #LearningMode;
118
 
         SecRulesEnabled;
119
 
         DeniedUrl "/RequestDenied";
120
 
         CheckRule "$SQL >= 8" BLOCK;
121
 
         CheckRule "$RFI >= 8" BLOCK;
122
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
123
 
         CheckRule "$XSS >= 8" BLOCK;
124
 
         root $TEST_NGINX_SERVROOT/html/;
125
 
         index index.html index.htm;
126
 
         BasicRule wl:1999 "mz:ARGS|NAME";
127
 
}
128
 
location /RequestDenied {
129
 
         return 412;
130
 
}
131
 
--- request
132
 
GET /?a=foobar
133
 
--- error_code: 412
134
 
 
135
 
=== WL TEST 1.2: whitelist in ARGS_NAME+$URL
136
 
--- http_config
137
 
include /etc/nginx/naxsi_core.rules;
138
 
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
139
 
--- config
140
 
location / {
141
 
         #LearningMode;
142
 
         SecRulesEnabled;
143
 
         DeniedUrl "/RequestDenied";
144
 
         CheckRule "$SQL >= 8" BLOCK;
145
 
         CheckRule "$RFI >= 8" BLOCK;
146
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
147
 
         CheckRule "$XSS >= 8" BLOCK;
148
 
         root $TEST_NGINX_SERVROOT/html/;
149
 
         index index.html index.htm;
150
 
         BasicRule wl:1999 "mz:$URL:/|ARGS|NAME";
151
 
}
152
 
location /RequestDenied {
153
 
         return 412;
154
 
}
155
 
--- request
156
 
GET /?foobar=a
157
 
--- error_code: 200
158
 
 
159
 
=== WL TEST 1.21: whitelist in ARGS_NAME+$URL, limit
160
 
--- http_config
161
 
include /etc/nginx/naxsi_core.rules;
162
 
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
163
 
--- config
164
 
location / {
165
 
         #LearningMode;
166
 
         SecRulesEnabled;
167
 
         DeniedUrl "/RequestDenied";
168
 
         CheckRule "$SQL >= 8" BLOCK;
169
 
         CheckRule "$RFI >= 8" BLOCK;
170
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
171
 
         CheckRule "$XSS >= 8" BLOCK;
172
 
         root $TEST_NGINX_SERVROOT/html/;
173
 
         index index.html index.htm;
174
 
         BasicRule wl:1999 "mz:$URL:/|ARGS|NAME";
175
 
}
176
 
location /RequestDenied {
177
 
         return 412;
178
 
}
179
 
--- request
180
 
GET /?foobar=a
181
 
--- error_code: 200
182
 
 
183
 
=== WL TEST 1.22: whitelist in ARGS_NAME+$URL, limit
184
 
--- http_config
185
 
include /etc/nginx/naxsi_core.rules;
186
 
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
187
 
--- config
188
 
location / {
189
 
         #LearningMode;
190
 
         SecRulesEnabled;
191
 
         DeniedUrl "/RequestDenied";
192
 
         CheckRule "$SQL >= 8" BLOCK;
193
 
         CheckRule "$RFI >= 8" BLOCK;
194
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
195
 
         CheckRule "$XSS >= 8" BLOCK;
196
 
         root $TEST_NGINX_SERVROOT/html/;
197
 
         index index.html index.htm;
198
 
         BasicRule wl:1999 "mz:$URL:/|ARGS|NAME";
199
 
}
200
 
location /RequestDenied {
201
 
         return 412;
202
 
}
203
 
--- request
204
 
GET /?a=foobar
205
 
--- error_code: 412
206
 
 
207
 
 
208
 
=== WL TEST 1.3: failed whitelist in ARGS_NAME+$URL
209
 
--- http_config
210
 
include /etc/nginx/naxsi_core.rules;
211
 
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
212
 
--- config
213
 
location / {
214
 
         #LearningMode;
215
 
         SecRulesEnabled;
216
 
         DeniedUrl "/RequestDenied";
217
 
         CheckRule "$SQL >= 8" BLOCK;
218
 
         CheckRule "$RFI >= 8" BLOCK;
219
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
220
 
         CheckRule "$XSS >= 8" BLOCK;
221
 
         root $TEST_NGINX_SERVROOT/html/;
222
 
         index index.html index.htm;
223
 
         BasicRule wl:1999 "mz:$URL:/z|ARGS|NAME";
224
 
}
225
 
location /RequestDenied {
226
 
         return 412;
227
 
}
228
 
--- request
229
 
GET /?foobar=a
230
 
--- error_code: 412
231
 
 
232
 
=== WL TEST 1.31: failed whitelist in ARGS_NAME+$URL
233
 
--- http_config
234
 
include /etc/nginx/naxsi_core.rules;
235
 
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
236
 
--- config
237
 
location / {
238
 
         #LearningMode;
239
 
         SecRulesEnabled;
240
 
         DeniedUrl "/RequestDenied";
241
 
         CheckRule "$SQL >= 8" BLOCK;
242
 
         CheckRule "$RFI >= 8" BLOCK;
243
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
244
 
         CheckRule "$XSS >= 8" BLOCK;
245
 
         root $TEST_NGINX_SERVROOT/html/;
246
 
         index index.html index.htm;
247
 
         BasicRule wl:1999 "mz:$URL:/|ARGS|NAME";
248
 
}
249
 
location /RequestDenied {
250
 
         return 412;
251
 
}
252
 
--- request
253
 
GET /?a=foobar
254
 
--- error_code: 412
255
 
 
256
 
=== WL TEST 1.32: failed whitelist in ARGS_NAME+$URL
257
 
--- http_config
258
 
include /etc/nginx/naxsi_core.rules;
259
 
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
260
 
--- config
261
 
location / {
262
 
         #LearningMode;
263
 
         SecRulesEnabled;
264
 
         DeniedUrl "/RequestDenied";
265
 
         CheckRule "$SQL >= 8" BLOCK;
266
 
         CheckRule "$RFI >= 8" BLOCK;
267
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
268
 
         CheckRule "$XSS >= 8" BLOCK;
269
 
         root $TEST_NGINX_SERVROOT/html/;
270
 
         index index.html index.htm;
271
 
         BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:b|NAME";
272
 
}
273
 
location /RequestDenied {
274
 
         return 412;
275
 
}
276
 
--- request
277
 
GET /?b=foobar
278
 
--- error_code: 412
279
 
 
280
 
=== WL TEST 1.33: failed whitelist in ARGS_NAME+$URL
281
 
--- http_config
282
 
include /etc/nginx/naxsi_core.rules;
283
 
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
284
 
--- config
285
 
location / {
286
 
         #LearningMode;
287
 
         SecRulesEnabled;
288
 
         DeniedUrl "/RequestDenied";
289
 
         CheckRule "$SQL >= 8" BLOCK;
290
 
         CheckRule "$RFI >= 8" BLOCK;
291
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
292
 
         CheckRule "$XSS >= 8" BLOCK;
293
 
         root $TEST_NGINX_SERVROOT/html/;
294
 
         index index.html index.htm;
295
 
         BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar|NAME";
296
 
}
297
 
location /RequestDenied {
298
 
         return 412;
299
 
}
300
 
--- request
301
 
GET /?foobar=bui
302
 
--- error_code: 200
303
 
 
304
 
=== WL TEST 1.34: failed whitelist in ARGS_NAME+$URL
305
 
--- http_config
306
 
include /etc/nginx/naxsi_core.rules;
307
 
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
308
 
MainRule "str:foobra" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:2999;
309
 
--- config
310
 
location / {
311
 
         #LearningMode;
312
 
         SecRulesEnabled;
313
 
         DeniedUrl "/RequestDenied";
314
 
         CheckRule "$SQL >= 8" BLOCK;
315
 
         CheckRule "$RFI >= 8" BLOCK;
316
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
317
 
         CheckRule "$XSS >= 8" BLOCK;
318
 
         root $TEST_NGINX_SERVROOT/html/;
319
 
         index index.html index.htm;
320
 
         BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar|NAME";
321
 
         BasicRule wl:2999 "mz:$URL:/|$ARGS_VAR:foobar";
322
 
}
323
 
location /RequestDenied {
324
 
         return 412;
325
 
}
326
 
--- request
327
 
GET /?foobar=foobra
328
 
--- error_code: 200
329
 
 
330
 
=== WL TEST 1.35: failed whitelist in ARGS_NAME+$URL
331
 
--- http_config
332
 
include /etc/nginx/naxsi_core.rules;
333
 
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
334
 
MainRule "str:foobra" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:2999;
335
 
--- config
336
 
location / {
337
 
         #LearningMode;
338
 
         SecRulesEnabled;
339
 
         DeniedUrl "/RequestDenied";
340
 
         CheckRule "$SQL >= 8" BLOCK;
341
 
         CheckRule "$RFI >= 8" BLOCK;
342
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
343
 
         CheckRule "$XSS >= 8" BLOCK;
344
 
         root $TEST_NGINX_SERVROOT/html/;
345
 
         index index.html index.htm;
346
 
         BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar|NAME";
347
 
         BasicRule wl:2999 "mz:$URL:/|$ARGS_VAR:foobar";
348
 
}
349
 
location /RequestDenied {
350
 
         return 412;
351
 
}
352
 
--- request
353
 
GET /?foobar=foobar
354
 
--- error_code: 412
355
 
 
356
 
=== WL TEST 1.36: failed whitelist in ARGS_NAME+$URL
357
 
--- http_config
358
 
include /etc/nginx/naxsi_core.rules;
359
 
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
360
 
MainRule "str:foobra" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:2999;
361
 
--- config
362
 
location / {
363
 
         #LearningMode;
364
 
         SecRulesEnabled;
365
 
         DeniedUrl "/RequestDenied";
366
 
         CheckRule "$SQL >= 8" BLOCK;
367
 
         CheckRule "$RFI >= 8" BLOCK;
368
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
369
 
         CheckRule "$XSS >= 8" BLOCK;
370
 
         root $TEST_NGINX_SERVROOT/html/;
371
 
         index index.html index.htm;
372
 
         BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar|NAME";
373
 
         BasicRule wl:2999 "mz:$URL:/|$ARGS_VAR:foobar";
374
 
}
375
 
location /RequestDenied {
376
 
         return 412;
377
 
}
378
 
--- request
379
 
GET /?foobar=foobar
380
 
--- error_code: 412
381
 
 
382
 
 
383
 
=== WL TEST 1.4: whitelist in ARGS_NAME+$URL+$ARGS_VAR
384
 
--- http_config
385
 
include /etc/nginx/naxsi_core.rules;
386
 
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
387
 
--- config
388
 
location / {
389
 
         #LearningMode;
390
 
         SecRulesEnabled;
391
 
         DeniedUrl "/RequestDenied";
392
 
         CheckRule "$SQL >= 8" BLOCK;
393
 
         CheckRule "$RFI >= 8" BLOCK;
394
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
395
 
         CheckRule "$XSS >= 8" BLOCK;
396
 
         root $TEST_NGINX_SERVROOT/html/;
397
 
         index index.html index.htm;
398
 
         BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar|NAME";
399
 
}
400
 
location /RequestDenied {
401
 
         return 412;
402
 
}
403
 
--- request
404
 
GET /?foobar=a
405
 
--- error_code: 200
406
 
 
407
 
=== WL TEST 1.41: whitelist in ARGS_NAME+$URL+$ARGS_VAR
408
 
--- http_config
409
 
include /etc/nginx/naxsi_core.rules;
410
 
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
411
 
--- config
412
 
location / {
413
 
         #LearningMode;
414
 
         SecRulesEnabled;
415
 
         DeniedUrl "/RequestDenied";
416
 
         CheckRule "$SQL >= 8" BLOCK;
417
 
         CheckRule "$RFI >= 8" BLOCK;
418
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
419
 
         CheckRule "$XSS >= 8" BLOCK;
420
 
         root $TEST_NGINX_SERVROOT/html/;
421
 
         index index.html index.htm;
422
 
         BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar|NAME";
423
 
}
424
 
location /RequestDenied {
425
 
         return 412;
426
 
}
427
 
--- request
428
 
GET /?a=foobar
429
 
--- error_code: 412
430
 
 
431
 
 
432
 
 
433
 
=== WL TEST 1.5: whitelist in ARGS_NAME+$URL+$ARGS_VAR, limit
434
 
--- http_config
435
 
include /etc/nginx/naxsi_core.rules;
436
 
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
437
 
--- config
438
 
location / {
439
 
         #LearningMode;
440
 
         SecRulesEnabled;
441
 
         DeniedUrl "/RequestDenied";
442
 
         CheckRule "$SQL >= 8" BLOCK;
443
 
         CheckRule "$RFI >= 8" BLOCK;
444
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
445
 
         CheckRule "$XSS >= 8" BLOCK;
446
 
         root $TEST_NGINX_SERVROOT/html/;
447
 
         index index.html index.htm;
448
 
         BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar|NAME";
449
 
}
450
 
location /RequestDenied {
451
 
         return 412;
452
 
}
453
 
--- request
454
 
GET /?foobar=foobar
455
 
--- error_code: 412
456
 
 
457
 
 
458
 
=== WL TEST 1.51: whitelist in ARGS_NAME+$URL+$ARGS_VAR, limit
459
 
--- http_config
460
 
include /etc/nginx/naxsi_core.rules;
461
 
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
462
 
--- config
463
 
location / {
464
 
         #LearningMode;
465
 
         SecRulesEnabled;
466
 
         DeniedUrl "/RequestDenied";
467
 
         CheckRule "$SQL >= 8" BLOCK;
468
 
         CheckRule "$RFI >= 8" BLOCK;
469
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
470
 
         CheckRule "$XSS >= 8" BLOCK;
471
 
         root $TEST_NGINX_SERVROOT/html/;
472
 
         index index.html index.htm;
473
 
         BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar|NAME";
474
 
}
475
 
location /RequestDenied {
476
 
         return 412;
477
 
}
478
 
--- request
479
 
GET /?foobar=foo
480
 
--- error_code: 200
481
 
 
482
 
=== WL TEST 1.6: whitelist in ARGS_NAME+$URL+$ARGS_VAR, (collision)
483
 
--- http_config
484
 
include /etc/nginx/naxsi_core.rules;
485
 
MainRule "str:foobar" "msg:foobar test pattern" "mz:ARGS" "s:$SQL:42" id:1999;
486
 
--- config
487
 
location / {
488
 
         #LearningMode;
489
 
         SecRulesEnabled;
490
 
         DeniedUrl "/RequestDenied";
491
 
         CheckRule "$SQL >= 8" BLOCK;
492
 
         CheckRule "$RFI >= 8" BLOCK;
493
 
         CheckRule "$TRAVERSAL >= 4" BLOCK;
494
 
         CheckRule "$XSS >= 8" BLOCK;
495
 
         root $TEST_NGINX_SERVROOT/html/;
496
 
         index index.html index.htm;
497
 
         BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar|NAME";
498
 
         BasicRule wl:1999 "mz:$URL:/|$ARGS_VAR:foobar";
499
 
}
500
 
location /RequestDenied {
501
 
         return 412;
502
 
}
503
 
--- request
504
 
GET /?foobar=foobar
505
 
--- error_code: 200
506