Skip to content

Commit ff0d451

Browse files
author
Felipe Zimmerle
committed
Fix maxmind test case
1 parent 0ca5994 commit ff0d451

File tree

5 files changed

+66
-22
lines changed

5 files changed

+66
-22
lines changed

CHANGES

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ v3.0.x - YYYY-MMM-DD (To be released)
1010
- Fix: Reverse logic of checking output in @inspectFile
1111
[Issue #1715 - @defanator]
1212
- Adds support to libMaxMind
13-
[Issue #1307 - @zimmerle]
13+
[Issue #1307 - @zimmerle, @defanator]
1414
- Adds capture action to detectXSS
1515
[Issue #1698 - @victorhora]
1616
- Temporarily accept invalid MULTIPART_SEMICOLON_MISSING operator
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[
2+
{
3+
"::200.249.12.31/120" : {
4+
"continent" : {
5+
"code" : "SA",
6+
"geoname_id" : 123,
7+
"names" : {
8+
"en" : "South America",
9+
"pt-BR" : "America do Sul"
10+
}
11+
},
12+
"country" : {
13+
"geoname_id" : 123,
14+
"iso_code" : "BR",
15+
"names" : {
16+
"en" : "Brazil",
17+
"pt-BR" : "Brasil"
18+
}
19+
},
20+
"location" : {
21+
"accuracy_radius" : 100,
22+
"latitude" : "-8.051502",
23+
"longitude" : "-34.874919"
24+
},
25+
"registered_country" : {
26+
"geoname_id" : 123,
27+
"iso_code" : "BR",
28+
"names" : {
29+
"en" : "Brazil",
30+
"pt-BR" : "Brasil"
31+
}
32+
},
33+
"postal": {
34+
"code": "50040090"
35+
},
36+
"city": {
37+
"names": {
38+
"en": "Recife"
39+
}
40+
}
41+
}
42+
}
43+
]
44+
3.06 KB
Binary file not shown.
-60.3 MB
Binary file not shown.

test/test-cases/regression/variable-GEO.json

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"resource":"maxmind",
4848
"title":"Testing Variables :: GEO:COUNTRY_NAME [maxmind]",
4949
"client":{
50-
"ip":"64.17.254.216",
50+
"ip":"200.249.12.31",
5151
"port":123
5252
},
5353
"server":{
@@ -74,11 +74,11 @@
7474
]
7575
},
7676
"expected":{
77-
"debug_log":"Target value: \"United States\" \\(Variable: GEO:COUNTRY_NAME\\)"
77+
"debug_log":"Target value: \"Brazil\" \\(Variable: GEO:COUNTRY_NAME\\)"
7878
},
7979
"rules":[
8080
"SecRuleEngine On",
81-
"SecGeoLookupDb test-cases\/data\/geo\/GeoLite2-City.mmdb",
81+
"SecGeoLookupDb test-cases\/data\/GeoIP2-City-Test.mmdb",
8282
"SecRule REMOTE_ADDR \"@geoLookup\" \"id:1,pass,t:trim\"",
8383
"SecRule GEO \"@contains test \" \"id:2,pass,t:trim\""
8484
]
@@ -509,7 +509,7 @@
509509
"resource":"maxmind",
510510
"title":"Testing Variables :: GEO:COUNTRY_NAME [maxmind]",
511511
"client":{
512-
"ip":"64.17.254.216",
512+
"ip":"200.249.12.31",
513513
"port":123
514514
},
515515
"server":{
@@ -536,11 +536,11 @@
536536
]
537537
},
538538
"expected":{
539-
"debug_log":"Target value: \"United States\" \\(Variable: GEO:COUNTRY_NAME\\)"
539+
"debug_log":"Target value: \"Brazil\" \\(Variable: GEO:COUNTRY_NAME\\)"
540540
},
541541
"rules":[
542542
"SecRuleEngine On",
543-
"SecGeoLookupDb test-cases\/data\/geo\/GeoLite2-City.mmdb",
543+
"SecGeoLookupDb test-cases\/data\/GeoIP2-City-Test.mmdb",
544544
"SecRule REMOTE_ADDR \"@geoLookup\" \"id:1,pass,t:trim\"",
545545
"SecRule GEO \"@contains test \" \"id:2,pass,t:trim\""
546546
]
@@ -551,7 +551,7 @@
551551
"resource":"maxmind",
552552
"title":"Testing Variables :: GEO:LATITUDE [maxmind]",
553553
"client":{
554-
"ip":"64.17.254.216",
554+
"ip":"200.249.12.31",
555555
"port":123
556556
},
557557
"server":{
@@ -578,11 +578,11 @@
578578
]
579579
},
580580
"expected":{
581-
"debug_log":"Target value: \"41.517100\" \\(Variable: GEO:LATITUDE\\)"
581+
"debug_log":"Target value: \"-8.051502\" \\(Variable: GEO:LATITUDE\\)"
582582
},
583583
"rules":[
584584
"SecRuleEngine On",
585-
"SecGeoLookupDb test-cases\/data\/geo\/GeoLite2-City.mmdb",
585+
"SecGeoLookupDb test-cases\/data\/GeoIP2-City-Test.mmdb",
586586
"SecRule REMOTE_ADDR \"@geoLookup\" \"id:1,pass,t:trim\"",
587587
"SecRule GEO \"@contains test \" \"id:2,pass,t:trim\""
588588
]
@@ -593,7 +593,7 @@
593593
"resource":"maxmind",
594594
"title":"Testing Variables :: GEO:COUNTRY_CODE [maxmind]",
595595
"client":{
596-
"ip":"64.17.254.216",
596+
"ip":"200.249.12.31",
597597
"port":123
598598
},
599599
"server":{
@@ -620,11 +620,11 @@
620620
]
621621
},
622622
"expected":{
623-
"debug_log":"Target value: \"US\" \\(Variable: GEO:COUNTRY_CODE\\)"
623+
"debug_log":"Target value: \"BR\" \\(Variable: GEO:COUNTRY_CODE\\)"
624624
},
625625
"rules":[
626626
"SecRuleEngine On",
627-
"SecGeoLookupDb test-cases\/data\/geo\/GeoLite2-City.mmdb",
627+
"SecGeoLookupDb test-cases\/data\/GeoIP2-City-Test.mmdb",
628628
"SecRule REMOTE_ADDR \"@geoLookup\" \"id:1,pass,t:trim\"",
629629
"SecRule GEO \"@contains test \" \"id:2,pass,t:trim\""
630630
]
@@ -635,7 +635,7 @@
635635
"resource":"maxmind",
636636
"title":"Testing Variables :: GEO:COUNTRY_CONTINENT [maxmind]",
637637
"client":{
638-
"ip":"64.17.254.216",
638+
"ip":"200.249.12.31",
639639
"port":123
640640
},
641641
"server":{
@@ -662,11 +662,11 @@
662662
]
663663
},
664664
"expected":{
665-
"debug_log":"Target value: \"North America\" \\(Variable: GEO:COUNTRY_CONTINENT\\)"
665+
"debug_log":"Target value: \"South America\" \\(Variable: GEO:COUNTRY_CONTINENT\\)"
666666
},
667667
"rules":[
668668
"SecRuleEngine On",
669-
"SecGeoLookupDb test-cases\/data\/geo\/GeoLite2-City.mmdb",
669+
"SecGeoLookupDb test-cases\/data\/GeoIP2-City-Test.mmdb",
670670
"SecRule REMOTE_ADDR \"@geoLookup\" \"id:1,pass,t:trim\"",
671671
"SecRule GEO \"@contains test \" \"id:2,pass,t:trim\""
672672
]
@@ -677,7 +677,7 @@
677677
"resource":"maxmind",
678678
"title":"Testing Variables :: GEO:POSTAL_CODE [maxmind]",
679679
"client":{
680-
"ip":"64.17.254.216",
680+
"ip":"200.249.12.31",
681681
"port":123
682682
},
683683
"server":{
@@ -704,11 +704,11 @@
704704
]
705705
},
706706
"expected":{
707-
"debug_log":"Target value: \"02842\" \\(Variable: GEO:POSTAL_CODE\\)"
707+
"debug_log":"Target value: \"50040090\" \\(Variable: GEO:POSTAL_CODE\\)"
708708
},
709709
"rules":[
710710
"SecRuleEngine On",
711-
"SecGeoLookupDb test-cases\/data\/geo\/GeoLite2-City.mmdb",
711+
"SecGeoLookupDb test-cases\/data\/GeoIP2-City-Test.mmdb",
712712
"SecRule REMOTE_ADDR \"@geoLookup\" \"id:1,pass,t:trim\"",
713713
"SecRule GEO \"@contains test \" \"id:2,pass,t:trim\""
714714
]
@@ -719,7 +719,7 @@
719719
"resource":"maxmind",
720720
"title":"Testing Variables :: GEO:CITY [maxmind]",
721721
"client":{
722-
"ip":"64.17.254.216",
722+
"ip":"200.249.12.31",
723723
"port":123
724724
},
725725
"server":{
@@ -746,11 +746,11 @@
746746
]
747747
},
748748
"expected":{
749-
"debug_log":"Target value: \"Middletown\" \\(Variable: GEO:CITY\\)"
749+
"debug_log":"Target value: \"Recife\" \\(Variable: GEO:CITY\\)"
750750
},
751751
"rules":[
752752
"SecRuleEngine On",
753-
"SecGeoLookupDb test-cases\/data\/geo\/GeoLite2-City.mmdb",
753+
"SecGeoLookupDb test-cases\/data\/GeoIP2-City-Test.mmdb",
754754
"SecRule REMOTE_ADDR \"@geoLookup\" \"id:1,pass,t:trim\"",
755755
"SecRule GEO \"@contains test \" \"id:2,pass,t:trim\""
756756
]

0 commit comments

Comments
 (0)