summaryrefslogtreecommitdiffstats
path: root/system/core/Security.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-08-18 11:19:01 +0200
committerAndrey Andreev <narf@devilix.net>2014-08-18 11:19:01 +0200
commit3783be66dd29cc079dffc91d6e74f880e56f1f84 (patch)
treebfa5d226b046c6862f484a913ac11572b258a12b /system/core/Security.php
parent22ce276f4f696d69c11ee1d7c8b8acee67a97b09 (diff)
parent8ef828129c559705447dd66a597071de5ae564a9 (diff)
Merge pull request #3176 from caseyh/develop
CSRF whitelist supports regex
Diffstat (limited to 'system/core/Security.php')
-rwxr-xr-xsystem/core/Security.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/system/core/Security.php b/system/core/Security.php
index 741ff229b..39e4f7c24 100755
--- a/system/core/Security.php
+++ b/system/core/Security.php
@@ -203,10 +203,13 @@ class CI_Security {
if ($exclude_uris = config_item('csrf_exclude_uris'))
{
$uri = load_class('URI', 'core');
- if (in_array($uri->uri_string(), $exclude_uris))
+ foreach ($exclude_uris as $excluded)
{
- return $this;
- }
+ if (preg_match('#^'.$excluded.'$#i'.(UTF8_ENABLED ? 'u' : ''), $uri->uri_string()))
+ {
+ return $this;
+ }
+ }
}
// Do the tokens exist in both the _POST and _COOKIE arrays?
@@ -934,4 +937,4 @@ class CI_Security {
}
/* End of file Security.php */
-/* Location: ./system/core/Security.php */ \ No newline at end of file
+/* Location: ./system/core/Security.php */