Skip to content

Commit

Permalink
Fixed an XSS vulnerability in the Twig Extension
Browse files Browse the repository at this point in the history
The 'render_relation_element' filter (in contrast to the other two
filters) does not use a template for rendering, but simply returns the
'__toString()' value of the given object (that's the default behavior).
However, the method was marked as HTML-safe. This leads to the fact
that any string returned by '__toString()' (which often comes from
direct user input) is output without any escaping. This makes the
filter vulnerable to a Stored Cross-Site Scripting attack. The
vulnerability has been fixed in this commit.
  • Loading branch information
Thomas Konrad committed Feb 15, 2013
1 parent 54e161e commit 1fd119d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Twig/Extension/SonataAdminExtension.php
Expand Up @@ -40,7 +40,7 @@ public function getFilters()
return array(
'render_list_element' => new \Twig_Filter_Method($this, 'renderListElement', array('is_safe' => array('html'))),
'render_view_element' => new \Twig_Filter_Method($this, 'renderViewElement', array('is_safe' => array('html'))),
'render_relation_element' => new \Twig_Filter_Method($this, 'renderRelationElement', array('is_safe' => array('html'))),
'render_relation_element' => new \Twig_Filter_Method($this, 'renderRelationElement'),
);
}

Expand Down

0 comments on commit 1fd119d

Please sign in to comment.