Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
fix(security): Escape script and input tags by default (#7811)
Browse files Browse the repository at this point in the history
* fix(security): Escape script and input tags by default

* enh(BE): avoid to call twice preg_replace method
  • Loading branch information
sc979 committed Oct 4, 2019
1 parent 172c0a8 commit 6f7c576
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion www/class/centreonUtils.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ public static function escapeSecure(
) {
switch ($escapeMethod) {
case self::ESCAPE_LEGACY_METHOD:
return preg_replace("/<script.*?\/script>/s", "", $stringToEscape);
// Remove script and input tags by default
return preg_replace(array("/<script.*?\/script>/si", "/<input[^>]+\>/si"), "", $stringToEscape);
case self::ESCAPE_ALL_EXCEPT_LINK:
return self::escapeAllExceptLink($stringToEscape);
case self::ESCAPE_ALL:
Expand Down

0 comments on commit 6f7c576

Please sign in to comment.