From 46d2072e5ce0c13f3be2bd909d76eba37964740f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 18 Mar 2014 23:08:59 +0200 Subject: More xss_clean() improvements Issue described in https://github.com/EllisLab/CodeIgniter/issues/2667#issuecomment-37980030 + a false positive --- system/core/Security.php | 4 ++-- tests/codeigniter/core/Security_test.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/system/core/Security.php b/system/core/Security.php index a4d8c95ef..17ba3bcd8 100644 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -454,7 +454,7 @@ class CI_Security { if (preg_match('/]*?)(?:>|$)#si', array($this, '_js_link_removal'), $str); + $str = preg_replace_callback('#]+([^>]*?)(?:>|$)#si', array($this, '_js_link_removal'), $str); } if (preg_match('/assertEquals('Clickhere', $this->security->xss_clean($input)); + $this->assertEquals('Clickhere', $this->security->xss_clean($input)); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b