ci4 csrf를 사용중인데
일부러 token 값을 틀리게 해서 폼값을 넘겼을때
아무런 에러페이지나 에러문구 없이 이전 페이지로 그냥 넘어가 버리네요.
throw SecurityException::forDisallowedAction(); 여기 까지 실행되는건 확인했는데..
조언 부탁드립니다.
** vendor/codeigniter4/framework/system/Security/Security.php
if (! isset($token, $_COOKIE[$this->cookieName]) || $token !== $_COOKIE[$this->cookieName])
{
throw SecurityException::forDisallowedAction();
}
** vendor/codeigniter4/framework/system/Security/Exceptions/SecurityException.php
namespace CodeIgniter\Security\Exceptions;
use CodeIgniter\Exceptions\FrameworkException;
class SecurityException extends FrameworkException
{
public static function forDisallowedAction()
{
return new static(lang('Security.disallowedAction'), 403);
}
public static function forInvalidSameSite(string $samesite)
{
return new static(lang('Security.invalidSameSite', [$samesite]));
}
}
.env의
security.redirect = true
가 켜져있으면 리다이렉트됩니다.
(app\Config\Security.php)
답변 주신분들 감사합니다.
app/config/Security.php public $redirect = false; 는 적용되지 않고
vendor/codeigniter4/framework/system/Security/Security.php $redirect = false; 해야 에러 페이지가 나오네요..
