summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorJoël Cox <joel@joelcox.nl>2011-07-16 23:46:49 +0200
committerJoël Cox <joel@joelcox.nl>2011-07-16 23:46:49 +0200
commit08a245f0c9d9638f039d12aebcd35bd875d72107 (patch)
treee15e398d7293db4faeebb55e209c898f2b9646f4 /system
parent8a02247acbac87b3b947d9188ec4f5805f2e1a52 (diff)
CSRF field is only added when post method is used and action is internal. Closes #165
Diffstat (limited to 'system')
-rw-r--r--system/helpers/form_helper.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index 2925d3c7c..5720a06ec 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -64,8 +64,8 @@ if ( ! function_exists('form_open'))
$form .= '>';
- // CSRF
- if ($CI->config->item('csrf_protection') === TRUE)
+ // Add CSRF field if enabled, but leave it out for GET requests and requests to external websites
+ if ($CI->config->item('csrf_protection') === TRUE AND ! (strpos($action, $CI->config->site_url()) === FALSE OR strpos($form, 'method="get"')))
{
$hidden[$CI->security->get_csrf_token_name()] = $CI->security->get_csrf_hash();
}