Codeigniter 代码点火器和Ckfinder csrf\u排除\u URI
我对Codeigniter 3和CKfinder的CSRF保护有问题 如果我在我的Codeigniter配置文件中使用下面的命令,CKFinder图像上传工作正常Codeigniter 代码点火器和Ckfinder csrf\u排除\u URI,codeigniter,csrf,ckfinder,Codeigniter,Csrf,Ckfinder,我对Codeigniter 3和CKfinder的CSRF保护有问题 如果我在我的Codeigniter配置文件中使用下面的命令,CKFinder图像上传工作正常 $config['csrf_protection'] = FALSE; $config['csrf_token_name'] = 'csrf_test_name'; $config['csrf_cookie_name'] = 'csrf_cookie_name'; $config['csrf_expire'] = 7200; $con
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();
如果我更改$config['csrf_protection']=TRUE;CKFinder图像上载失败
我需要的是能够将CKFinder排除在CSFR保护范围之外-我尝试了以下方法,但似乎没有任何效果:
$config['csrf_exclude_uris'] = array('assets/plugins/ckfinder/.*+', 'assets/plugins/ckfinder/ckfinder.js', 'assets/plugins/ckfinder', 'admin/news/.*+');
任何提示都将不胜感激希望这能奏效。在我的情况下是有效的
$config['csrf_exclude_uris'] = array('assets/plugins/ckfinder/[\s\S]*');
但据我所知,“资产”资源不需要任何csrf保护。提交表单数据的URL 在
config.php
文件中添加以下行。这会奏效的
$config['**csrf_exclude_uris**'] = array(
*'device/deviceProcess/pushData'*
);
-- deviceProcess : Controller
--- pushData : Method
----- URL : http://hostname/index.php/device/deviceProcess/pushData
您需要找到一种方法将csrf令牌与所有ajax一起发送,并在ajax响应后在html端更新csrf令牌。您应该提到所有不应检查csrf的URI。它在浏览器调试控制台的“网络”选项卡中显示的URL是什么?它将帮助您决定正确的URI。CKFinder$post根据操作的不同而不同。一个例子是:/assets/plugins/ckfinder/core/connector/php/connector.php?command=DeleteFiles&lang=en&type=Images¤tFolder=%2F&hash=91aa280181912a4c-我需要能够排除:/assets/plugins/ckfinder/core/connector/php/*但我不确定如何做到这一点?试试
$config['csrf\u exclude\uris']=['assets/plugins/ckfinder*?]代码>谢谢-但这不起作用
# Its work fine #
$config['csrf_protection'] = TRUE;
if(isset($_SERVER["PHP_SELF"])){
$parts = explode("/",$_SERVER["PHP_SELF"]);
$exclude_url_arr = array('login');
if (!empty($exclude_url_arr[0])) {
foreach($parts as $part) {
if (in_array($part,$exclude_url_arr)) {
$config['csrf_protection'] = FALSE;
break;
}
}
}
}