Fix major security by overriding Symfony ExpressionLanguage default constant() method. The ExpressionLanguage is used by ruler for conditional group and could have been leverage to guess constants values such as db credentials
This commit is contained in:
parent
3a27a3ba73
commit
d699a2db80
|
@ -18,7 +18,17 @@ class ExpressionProvider implements ExpressionFunctionProviderInterface
|
||||||
{
|
{
|
||||||
public function getFunctions()
|
public function getFunctions()
|
||||||
{
|
{
|
||||||
|
//Override default constant() function to make it return null
|
||||||
|
//This will prevent the use of constant() func to read constants with security impact (such as session, db credentials, etc.)
|
||||||
|
$neutralized_constant = new ExpressionFunction('constant', function ($str) {
|
||||||
|
return null;
|
||||||
|
}, function ($arguments, $str) {
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
$neutralized_constant,
|
||||||
ExpressionFunction::fromPhp('is_null', 'exists'),
|
ExpressionFunction::fromPhp('is_null', 'exists'),
|
||||||
ExpressionFunction::fromPhp('mb_strtolower', 'lower'),
|
ExpressionFunction::fromPhp('mb_strtolower', 'lower'),
|
||||||
ExpressionFunction::fromPhp('mb_strtoupper', 'upper'),
|
ExpressionFunction::fromPhp('mb_strtoupper', 'upper'),
|
||||||
|
|
Loading…
Reference in New Issue