Skip to content

Commit 558aff4

Browse files
committed
[ticket/security-155] Cast the types of string values in the controller routes
SECURITY-155
1 parent f6da266 commit 558aff4

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

phpBB/phpbb/controller/resolver.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ class resolver implements ControllerResolverInterface
4040
*/
4141
protected $template;
4242

43+
/**
44+
* Requst type cast helper object
45+
* @var \phpbb\request\type_cast_helper
46+
*/
47+
protected $type_cast_helper;
48+
4349
/**
4450
* phpBB root path
4551
* @var string
@@ -59,6 +65,7 @@ public function __construct(\phpbb\user $user, ContainerInterface $container, $p
5965
$this->user = $user;
6066
$this->container = $container;
6167
$this->template = $template;
68+
$this->type_cast_helper = new \phpbb\request\type_cast_helper();
6269
$this->phpbb_root_path = $phpbb_root_path;
6370
}
6471

@@ -138,7 +145,16 @@ public function getArguments(Request $request, $controller)
138145
{
139146
if (array_key_exists($param->name, $attributes))
140147
{
141-
$arguments[] = $attributes[$param->name];
148+
if (is_string($attributes[$param->name]))
149+
{
150+
$value = $attributes[$param->name];
151+
$this->type_cast_helper->set_var($value, $attributes[$param->name], 'string', true, false);
152+
$arguments[] = $value;
153+
}
154+
else
155+
{
156+
$arguments[] = $attributes[$param->name];
157+
}
142158
}
143159
else if ($param->getClass() && $param->getClass()->isInstance($request))
144160
{

0 commit comments

Comments
 (0)