summaryrefslogtreecommitdiffstats
path: root/system/helpers
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2011-07-17 05:29:28 +0200
committerPhil Sturgeon <email@philsturgeon.co.uk>2011-07-17 05:29:28 +0200
commit866a23fd3ff7c1eab93ae015e37addc414aae2e4 (patch)
tree1b1c047b86f9b1aee5667c3f4426a514f515bb3e /system/helpers
parent8a02247acbac87b3b947d9188ec4f5805f2e1a52 (diff)
parent31775338757dd6c2eddcdaa265815d002bd7d125 (diff)
Merge pull request #24 from joelcox/issue-165c
CSRF field for internal POST only. Issue #165
Diffstat (limited to 'system/helpers')
-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();
}