summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsystem/core/Security.php12
-rw-r--r--user_guide_src/source/changelog.rst4
-rw-r--r--user_guide_src/source/libraries/security.rst10
3 files changed, 14 insertions, 12 deletions
diff --git a/system/core/Security.php b/system/core/Security.php
index 39e4f7c24..bb0670500 100755
--- a/system/core/Security.php
+++ b/system/core/Security.php
@@ -205,11 +205,11 @@ class CI_Security {
$uri = load_class('URI', 'core');
foreach ($exclude_uris as $excluded)
{
- if (preg_match('#^'.$excluded.'$#i'.(UTF8_ENABLED ? 'u' : ''), $uri->uri_string()))
- {
- 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?
@@ -937,4 +937,4 @@ class CI_Security {
}
/* End of file Security.php */
-/* Location: ./system/core/Security.php */
+/* Location: ./system/core/Security.php */ \ No newline at end of file
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 2d523e932..c4360aae4 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -506,8 +506,8 @@ Release Date: Not Released
- :doc:`Security Library <libraries/security>` changes include:
- Added method ``strip_image_tags()``.
- - Added ``$config['csrf_regeneration']``, which makes token regeneration optional.
- - Added ``$config['csrf_exclude_uris']``, which allows you list URIs which will not have the CSRF validation methods run. Optionally allows regex.
+ - Added ``$config['csrf_regeneration']``, which makes CSRF token regeneration optional.
+ - Added ``$config['csrf_exclude_uris']``, allowing for exclusion of URIs from the CSRF protection (regular expressions are supported).
- Modified method ``sanitize_filename()`` to read a public ``$filename_bad_chars`` property for getting the invalid characters list.
- Return status code of 403 instead of a 500 if CSRF protection is enabled but a token is missing from a request.
diff --git a/user_guide_src/source/libraries/security.rst b/user_guide_src/source/libraries/security.rst
index 19480b4f8..c8d69d16f 100644
--- a/user_guide_src/source/libraries/security.rst
+++ b/user_guide_src/source/libraries/security.rst
@@ -97,10 +97,12 @@ by editing the 'csrf_exclude_uris' config parameter::
$config['csrf_exclude_uris'] = array('api/person/add');
-Optionally, you can use regular expressions in the URIs::
+Regular expressions are also supported (case-insensitive)::
- $config['csrf_exclude_uris'] = array('api/record/[0-9]+','api/title/[a-zA-Z]+');
-
+ $config['csrf_exclude_uris'] = array(
+ 'api/record/[0-9]+',
+ 'api/title/[a-z]+'
+ );
***************
Class Reference
@@ -161,4 +163,4 @@ Class Reference
This method acts a lot like PHP's own native ``html_entity_decode()`` function in ENT_COMPAT mode, only
it tries to detect HTML entities that don't end in a semicolon because some browsers allow that.
- If the ``$charset`` parameter is left empty, then your configured ``$config['charset']`` value will be used.
+ If the ``$charset`` parameter is left empty, then your configured ``$config['charset']`` value will be used. \ No newline at end of file