在 codeigniter 中更改 _clean_input_keys($str) 函数的安全方面
Security aspects of changing _clean_input_keys($str) function in codeigniter
我用 codeigniter form_helper
创建了一个表单,我的 html 页面中的输出表单 (method : post
) 有一些这样的元素:
<input type="checkbox" name=" category['download']" value="1">
但是当我提交表单时,codeigniter 给了我这个错误:
Disallowed Key Characters error.
我搜索并发现问题可能出在 system/core/input.php
中的 _clean_input_keys($str)
函数,当我将其更改为:
if ( ! preg_match("/[]^'[a-z0-9:_\/-]+$/i", $str))
到
if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str))
我的问题消失了,我的意思是我在允许的字符中添加了 []
和 '
,现在它是否对我的项目造成安全问题?如果是,什么是正确的方法?
改变
category['download']
至
category[download]
我用 codeigniter form_helper
创建了一个表单,我的 html 页面中的输出表单 (method : post
) 有一些这样的元素:
<input type="checkbox" name=" category['download']" value="1">
但是当我提交表单时,codeigniter 给了我这个错误:
Disallowed Key Characters error.
我搜索并发现问题可能出在 system/core/input.php
中的 _clean_input_keys($str)
函数,当我将其更改为:
if ( ! preg_match("/[]^'[a-z0-9:_\/-]+$/i", $str))
到
if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str))
我的问题消失了,我的意思是我在允许的字符中添加了 []
和 '
,现在它是否对我的项目造成安全问题?如果是,什么是正确的方法?
改变
category['download']
至
category[download]