1 | <?php /** MicroHMVCResolver */ |
||
25 | class MvcResolver implements ResolverInterface |
||
26 | { |
||
27 | /** @var string $uri converted URL */ |
||
28 | protected $uri; |
||
29 | |||
30 | /** @var string $extensions Extensions in request */ |
||
31 | private $extensions; |
||
32 | /** @var string $modules Modules in request */ |
||
33 | private $modules; |
||
34 | /** @var string $controller IController to run */ |
||
35 | private $controller; |
||
36 | /** @var string $action Action to run */ |
||
37 | private $action; |
||
38 | |||
39 | |||
40 | /** |
||
41 | * Get instance application |
||
42 | * |
||
43 | * @access public |
||
44 | * |
||
45 | * @return IController |
||
46 | * @throws Exception |
||
47 | */ |
||
48 | public function getApp() |
||
71 | |||
72 | /** |
||
73 | * Initialize request object |
||
74 | * |
||
75 | * @access public |
||
76 | * |
||
77 | * @return void |
||
78 | * @throws Exception |
||
79 | */ |
||
80 | protected function initialize() |
||
112 | |||
113 | /** |
||
114 | * Prepare extensions |
||
115 | * |
||
116 | * @access private |
||
117 | * |
||
118 | * @param array $uriBlocks uri blocks from URL |
||
119 | * |
||
120 | * @return void |
||
121 | * @throws Exception |
||
122 | */ |
||
123 | protected function prepareExtensions(&$uriBlocks) |
||
137 | |||
138 | /** |
||
139 | * Prepare modules |
||
140 | * |
||
141 | * @access private |
||
142 | * |
||
143 | * @global Micro |
||
144 | * |
||
145 | * @param array $uriBlocks uri blocks from URL |
||
146 | * |
||
147 | * @return void |
||
148 | * @throws Exception |
||
149 | */ |
||
150 | protected function prepareModules(&$uriBlocks) |
||
166 | |||
167 | /** |
||
168 | * Prepare controller |
||
169 | * |
||
170 | * @access private |
||
171 | * |
||
172 | * @param array $uriBlocks uri blocks from URL |
||
173 | * |
||
174 | * @return void |
||
175 | * @throws Exception |
||
176 | */ |
||
177 | protected function prepareController(&$uriBlocks) |
||
190 | |||
191 | /** |
||
192 | * Prepare action |
||
193 | * |
||
194 | * @access private |
||
195 | * |
||
196 | * @param array $uriBlocks uri blocks from URL |
||
197 | * |
||
198 | * @return void |
||
199 | */ |
||
200 | protected function prepareAction(&$uriBlocks) |
||
204 | |||
205 | |||
206 | /** |
||
207 | * Get calculate path to controller |
||
208 | * |
||
209 | * @access public |
||
210 | * |
||
211 | * @return string |
||
212 | */ |
||
213 | public function getCalculatePath() |
||
217 | |||
218 | /** |
||
219 | * Get extensions from request |
||
220 | * |
||
221 | * @access public |
||
222 | * |
||
223 | * @return string |
||
224 | */ |
||
225 | public function getExtensions() |
||
229 | |||
230 | /** |
||
231 | * Get modules from request |
||
232 | * |
||
233 | * @access public |
||
234 | * |
||
235 | * @return string |
||
236 | */ |
||
237 | public function getModules() |
||
241 | |||
242 | /** |
||
243 | * Get controller from request |
||
244 | * |
||
245 | * @access public |
||
246 | * |
||
247 | * @return string |
||
248 | */ |
||
249 | public function getController() |
||
253 | |||
254 | |||
255 | /** |
||
256 | * Get action from request |
||
257 | * |
||
258 | * @access public |
||
259 | * |
||
260 | * @return string |
||
261 | */ |
||
262 | public function getAction() |
||
266 | } |
||
267 |
$cls
can contain request data and is used in code execution context(s) leading to a potential security vulnerability.1 path for user data to reach this point
$_GET,
and$query ?: $_GET
is passed to ServerRequest::__construct()in vendor/src/ServerRequestFactory.php on line 71
in vendor/src/ServerRequest.php on line 101
in vendor/src/ServerRequest.php on line 156
$rawQuery
is assignedin src/mvc/MvcResolver.php on line 53
$query
is assignedin src/mvc/MvcResolver.php on line 55
$query
is assignedin src/mvc/MvcResolver.php on line 56
in src/mvc/MvcResolver.php on line 58
$this->uri
is passed through substr(), andsubstr($this->uri, 0, $key ?: strlen($this->uri))
is passed through explode(), and$uriBlocks
is assignedin src/mvc/MvcResolver.php on line 84
$uriBlocks
is passed to MvcResolver::prepareExtensions()in src/mvc/MvcResolver.php on line 90
$block
is assignedin src/mvc/MvcResolver.php on line 125
$block
is passed through ucfirst(), and MvcResolver::$extensions is assignedin src/mvc/MvcResolver.php on line 127
in src/mvc/MvcResolver.php on line 227
in src/mvc/MvcResolver.php on line 215
$cls
is assignedin src/mvc/MvcResolver.php on line 63
General Strategies to prevent injection
In general, it is advisable to prevent any user-data to reach this point. This can be done by white-listing certain values:
For numeric data, we recommend to explicitly cast the data: