【发布时间】:2018-03-08 03:55:52
【问题描述】:
我刚刚开始使用 codeigniters 内置的 CSRF 保护。它工作正常,但有一些第三方页面我无法在 CI 的控制器之外启用它,因此无法将其列入白名单。
例如,CKFINDER。我在配置文件中有这个,所以我可以访问我的会话 .etc。:
$CI = require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'CI.php';
CI.php
ob_start();
define('REQUEST', 'external');
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "index.php"; //or wherever the directory is relative to your path
ob_end_clean();
return get_instance();
我已经尝试过$CI->config->set_item('csrf_protection', false); 并且使用 var 转储它确实看起来好像变量设置为 false。但是,来自 CI 的 CSRF 保护仍然有效。我不确定您是否不能以这种方式修改主配置数组,或者是否有其他问题。
如何为 CI 控制器之外的页面关闭 csrf_protection?
【问题讨论】:
标签: php codeigniter csrf