File tree Expand file tree Collapse file tree 3 files changed +25
-12
lines changed Expand file tree Collapse file tree 3 files changed +25
-12
lines changed Original file line number Diff line number Diff line change 4
4
5
5
namespace Icinga \Module \Notifications \Controllers ;
6
6
7
+ use Exception ;
7
8
use Icinga \Module \Notifications \Common \Database ;
8
9
use Icinga \Util \Environment ;
9
10
use Icinga \Util \Json ;
@@ -41,8 +42,8 @@ public function indexAction(): void
41
42
$ this ->httpBadRequest ('The given identifier is not a valid UUID ' );
42
43
}
43
44
44
- $ filter = FilterProcessor:: assembleFilter (
45
- QueryString::fromString (rawurldecode (Url::fromRequest ()->getQueryString ()))
45
+ try {
46
+ $ filterRule = QueryString::fromString (rawurldecode (Url::fromRequest ()->getQueryString ()))
46
47
->on (
47
48
QueryString::ON_CONDITION ,
48
49
function (Filter \Condition $ condition ) {
@@ -62,8 +63,12 @@ function (Filter\Condition $condition) {
62
63
$ condition ->setColumn ('external_uuid ' );
63
64
}
64
65
}
65
- )->parse ()
66
- );
66
+ )->parse ();
67
+
68
+ $ filter = FilterProcessor::assembleFilter ($ filterRule );
69
+ } catch (Exception $ e ) {
70
+ $ this ->httpBadRequest ('filter is not escaped properly ' );
71
+ }
67
72
68
73
$ stmt = (new Select ())
69
74
->distinct ()
Original file line number Diff line number Diff line change @@ -66,8 +66,8 @@ public function indexAction(): void
66
66
$ this ->httpBadRequest ('Filter is only allowed in GET request ' );
67
67
}
68
68
69
- $ filter = FilterProcessor:: assembleFilter (
70
- QueryString::fromString ($ filterStr )
69
+ try {
70
+ $ filterRule = QueryString::fromString ($ filterStr )
71
71
->on (
72
72
QueryString::ON_CONDITION ,
73
73
function (Filter \Condition $ condition ) {
@@ -87,8 +87,12 @@ function (Filter\Condition $condition) {
87
87
$ condition ->setColumn ('external_uuid ' );
88
88
}
89
89
}
90
- )->parse ()
91
- );
90
+ )->parse ();
91
+
92
+ $ filter = FilterProcessor::assembleFilter ($ filterRule );
93
+ } catch (Exception $ e ) {
94
+ $ this ->httpBadRequest ('filter is not escaped properly ' );
95
+ }
92
96
93
97
switch ($ method ) {
94
98
case 'GET ' :
Original file line number Diff line number Diff line change @@ -71,8 +71,8 @@ public function indexAction(): void
71
71
$ this ->httpBadRequest ('Filter is only allowed in GET request ' );
72
72
}
73
73
74
- $ filter = FilterProcessor:: assembleFilter (
75
- QueryString::fromString ($ filterStr )
74
+ try {
75
+ $ filterRule = QueryString::fromString ($ filterStr )
76
76
->on (
77
77
QueryString::ON_CONDITION ,
78
78
function (Filter \Condition $ condition ) {
@@ -92,8 +92,12 @@ function (Filter\Condition $condition) {
92
92
$ condition ->setColumn ('external_uuid ' );
93
93
}
94
94
}
95
- )->parse ()
96
- );
95
+ )->parse ();
96
+
97
+ $ filter = FilterProcessor::assembleFilter ($ filterRule );
98
+ } catch (Exception $ e ) {
99
+ $ this ->httpBadRequest ('filter is not escaped properly ' );
100
+ }
97
101
98
102
switch ($ method ) {
99
103
case 'GET ' :
You can’t perform that action at this time.
0 commit comments