Skip to content

Commit

Permalink
security #cve-2019-10909 [FrameworkBundle][Form] Fix XSS issues in th…
Browse files Browse the repository at this point in the history
…e form theme of the PHP templating engine (stof)

This PR was merged into the 4.1 branch.

Discussion
----------

[FrameworkBundle][Form] Fix XSS issues in the form theme of the PHP templating engine

Based on #88

Commits
-------

d767bef8b5 Fix XSS issues in the form theme of the PHP templating engine
  • Loading branch information
nicolas-grekas committed Apr 16, 2019
2 parents ed0bbe5 + c69ed3b commit 2bc4a9a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Resources/views/Form/choice_widget_collapsed.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<?php if (count($preferred_choices) > 0): ?>
<?php echo $view['form']->block($form, 'choice_widget_options', ['choices' => $preferred_choices]) ?>
<?php if (count($choices) > 0 && null !== $separator): ?>
<option disabled="disabled"><?php echo $separator ?></option>
<option disabled="disabled"><?php echo $view->escape($separator) ?></option>
<?php endif ?>
<?php endif ?>
<?php echo $view['form']->block($form, 'choice_widget_options', ['choices' => $choices]) ?>
Expand Down
2 changes: 1 addition & 1 deletion Resources/views/Form/form_errors.html.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php if (count($errors) > 0): ?>
<ul>
<?php foreach ($errors as $error): ?>
<li><?php echo $error->getMessage() ?></li>
<li><?php echo $view->escape($error->getMessage()) ?></li>
<?php endforeach; ?>
</ul>
<?php endif ?>
4 changes: 2 additions & 2 deletions Resources/views/Form/form_start.html.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php $method = strtoupper($method) ?>
<?php $form_method = $method === 'GET' || $method === 'POST' ? $method : 'POST' ?>
<form name="<?php echo $name ?>" method="<?php echo strtolower($form_method) ?>"<?php if ($action !== ''): ?> action="<?php echo $action ?>"<?php endif ?><?php foreach ($attr as $k => $v) { printf(' %s="%s"', $view->escape($k), $view->escape($v)); } ?><?php if ($multipart): ?> enctype="multipart/form-data"<?php endif ?>>
<form name="<?php echo $name ?>" method="<?php echo strtolower($form_method) ?>"<?php if ($action !== ''): ?> action="<?php echo $view->escape($action) ?>"<?php endif ?><?php foreach ($attr as $k => $v) { printf(' %s="%s"', $view->escape($k), $view->escape($v)); } ?><?php if ($multipart): ?> enctype="multipart/form-data"<?php endif ?>>
<?php if ($form_method !== $method): ?>
<input type="hidden" name="_method" value="<?php echo $method ?>" />
<input type="hidden" name="_method" value="<?php echo $view->escape($method) ?>" />
<?php endif ?>

0 comments on commit 2bc4a9a

Please sign in to comment.