spooner 发表于 2018-11-29 10:06:50

采用https之后,cookie中Secure=true,然后csrf就失效了

是用阿里云虚拟主机cdn配置的https,查看原因,是在Security.php是这样写的

public function csrf_set_cookie()
        {
                $expire = time() + $this->_csrf_expire;
                $secure_cookie = (bool) config_item('cookie_secure');

                if ($secure_cookie && ! is_https())
                {
                        return FALSE;
                }

                setcookie(
                        $this->_csrf_cookie_name,
                        $this->_csrf_hash,
                        $expire,
                        config_item('cookie_path'),
                        config_item('cookie_domain'),
                        $secure_cookie,
                        config_item('cookie_httponly')
                );
                log_message('info', 'CSRF cookie sent');

                return $this;
        }

是下面这句阻断了
if ($secure_cookie && ! is_https())
                {
                        return FALSE;
                }

所以如果cookie中Secure=true,然后设置成https,就不能使用csrf了吗?

Hex 发表于 2018-11-30 10:30:41

你是最新版的 3.1.9 吗?

spooner 发表于 2018-11-30 22:37:02

Hex 发表于 2018-11-30 10:30
你是最新版的 3.1.9 吗?

是3.1.9,之前不是3.1.9,后面下载了3.1.9,然后替换了整个system目录,虽然源代码有改动,但看逻辑似乎差不多,所以发帖问下
页: [1]
查看完整版本: 采用https之后,cookie中Secure=true,然后csrf就失效了