1 | <?php |
||
24 | trait DriverBaseTrait |
||
25 | { |
||
26 | use ExtendedCacheItemPoolTrait; |
||
27 | |||
28 | /** |
||
29 | * @var array default options, this will be merge to Driver's Options |
||
30 | */ |
||
31 | protected $config = []; |
||
32 | |||
33 | /** |
||
34 | * @var bool |
||
35 | */ |
||
36 | protected $fallback = false; |
||
37 | |||
38 | /** |
||
39 | * @var mixed Instance of driver service |
||
40 | */ |
||
41 | protected $instance; |
||
42 | |||
43 | /** |
||
44 | * @param $config_name |
||
45 | * @param string $value |
||
46 | */ |
||
47 | public function setup($config_name, $value = '') |
||
58 | |||
59 | /** |
||
60 | * @return array |
||
61 | */ |
||
62 | public function getConfig() |
||
66 | |||
67 | /** |
||
68 | * @param $file |
||
69 | * @return string |
||
70 | * @throws phpFastCacheDriverException |
||
71 | */ |
||
72 | protected function readfile($file) |
||
92 | |||
93 | /** |
||
94 | * @param string $file |
||
95 | * @param string $data |
||
96 | * @param bool $secureFileManipulation |
||
97 | * @return bool |
||
98 | */ |
||
99 | protected function writefile($file, $data, $secureFileManipulation = false) |
||
130 | |||
131 | /** |
||
132 | * Encode data types such as object/array |
||
133 | * for driver that does not support |
||
134 | * non-scalar value |
||
135 | * @param $data |
||
136 | * @return string |
||
137 | */ |
||
138 | protected function encode($data) |
||
142 | |||
143 | /** |
||
144 | * Decode data types such as object/array |
||
145 | * for driver that does not support |
||
146 | * non-scalar value |
||
147 | * @param $value |
||
148 | * @return mixed |
||
149 | */ |
||
150 | protected function decode($value) |
||
154 | |||
155 | /** |
||
156 | * Check phpModules or CGI |
||
157 | * @return bool |
||
158 | */ |
||
159 | protected function isPHPModule() |
||
171 | |||
172 | |||
173 | /** |
||
174 | * @param $class |
||
175 | * @return bool |
||
176 | */ |
||
177 | protected function isExistingDriver($class) |
||
181 | |||
182 | |||
183 | /** |
||
184 | * @param $tag |
||
185 | * @return string |
||
186 | */ |
||
187 | protected function _getTagName($tag) |
||
191 | |||
192 | /** |
||
193 | * @param \phpFastCache\Core\Item\ExtendedCacheItemInterface $item |
||
194 | * @return array |
||
195 | */ |
||
196 | public function driverPreWrap(ExtendedCacheItemInterface $item) |
||
218 | |||
219 | /** |
||
220 | * @param array $wrapper |
||
221 | * @return mixed |
||
222 | */ |
||
223 | public function driverUnwrapData(array $wrapper) |
||
227 | |||
228 | /** |
||
229 | * @param array $wrapper |
||
230 | * @return mixed |
||
231 | */ |
||
232 | public function driverUnwrapTags(array $wrapper) |
||
236 | |||
237 | |||
238 | /** |
||
239 | * @param array $wrapper |
||
240 | * @return \DateTime |
||
241 | */ |
||
242 | public function driverUnwrapEdate(array $wrapper) |
||
246 | |||
247 | /** |
||
248 | * @param array $wrapper |
||
249 | * @return \DateTime |
||
250 | */ |
||
251 | public function driverUnwrapCdate(array $wrapper) |
||
255 | |||
256 | |||
257 | /** |
||
258 | * @param array $wrapper |
||
259 | * @return \DateTime |
||
260 | */ |
||
261 | public function driverUnwrapMdate(array $wrapper) |
||
265 | |||
266 | /** |
||
267 | * @return string |
||
268 | */ |
||
269 | public function getDriverName() |
||
275 | |||
276 | /** |
||
277 | * @param \phpFastCache\Core\Item\ExtendedCacheItemInterface $item |
||
278 | * @return bool |
||
279 | * @throws \LogicException |
||
280 | */ |
||
281 | public function driverWriteTags(ExtendedCacheItemInterface $item) |
||
352 | |||
353 | /** |
||
354 | * @param $key |
||
355 | * @return string |
||
356 | */ |
||
357 | public function getTagKey($key) |
||
361 | |||
362 | /** |
||
363 | * @param $key |
||
364 | * @return string |
||
365 | */ |
||
366 | public function getTagKeys(array $keys) |
||
374 | |||
375 | /** |
||
376 | * @param string $optionName |
||
377 | * @param mixed $optionValue |
||
378 | * @return bool |
||
379 | * @throws \InvalidArgumentException |
||
380 | */ |
||
381 | public static function isValidOption($optionName, $optionValue) |
||
389 | |||
390 | /** |
||
391 | * @return array |
||
392 | */ |
||
393 | public static function getRequiredOptions() |
||
397 | |||
398 | /** |
||
399 | * @return array |
||
400 | */ |
||
401 | public static function getValidOptions() |
||
405 | } |
$file
can contain request data and is used in file inclusion context(s) leading to a potential security vulnerability.1 path for user data to reach this point
HTTP_HOST
from$_SERVER,
and$_SERVER['HTTP_HOST']
is passed through str_replace(), andstr_replace(':', '_', $_SERVER['HTTP_HOST'])
is passed through strtolower(), andstrtolower(str_replace(':', '_', $_SERVER['HTTP_HOST']))
is passed through preg_replace(), and$securityKey
is assignedin src/phpFastCache/Core/Pool/IO/PathSeekerTrait.php on line 60
in vendor/src/phpFastCache/Core/Pool/IO/PathSeekerTrait.php on line 194
$securityKey
is assignedin src/phpFastCache/Core/Pool/IO/PathSeekerTrait.php on line 70
$full_path
is assignedin src/phpFastCache/Core/Pool/IO/PathSeekerTrait.php on line 87
$full_path
is passed through realpath()in src/phpFastCache/Core/Pool/IO/PathSeekerTrait.php on line 104
in src/phpFastCache/Core/Pool/IO/PathSeekerTrait.php on line 133
$path
is assignedin src/phpFastCache/Core/Pool/IO/PathSeekerTrait.php on line 144
$file_path
is assignedin src/phpFastCache/Drivers/Files/Driver.php on line 113
$file_path
is passed to DriverBaseTrait::readfile()in src/phpFastCache/Drivers/Files/Driver.php on line 118
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: