-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: system/Security/Security.php(289): CodeIgniter\Security\Exceptions\SecurityException::forDisallowedAction() #5744
Comments
I recommend you check your app carefully. |
If it is some kind of bot attack, how could prevent this exception from occurring? We've tested the form repeatedly and cannot reproduce the error. |
|
Create your own CSRF filter based on CodeIgniter\Filters\CSRF. |
Thank you for your responses and assistance. |
PHP Version
7.4
CodeIgniter4 Version
4.1.8
CodeIgniter4 Installation Method
Manual (zip or tar.gz)
Which operating systems have you tested for this bug?
Linux
Which server did you use?
apache
Database
No response
What happened?
Throughout our error logs, we are seeing 100s of the below CSRF errors:
CRITICAL - 2022-02-24 19:49:22 --> The action you requested is not allowed.
#0 /home/system/Security/Security.php(289): CodeIgniter\Security\Exceptions\SecurityException::forDisallowedAction()
#1 /home/system/Filters/CSRF.php(53): CodeIgniter\Security\Security->verify(Object(CodeIgniter\HTTP\IncomingRequest))
#2 /home/system/Filters/Filters.php(173): CodeIgniter\Filters\CSRF->before(Object(CodeIgniter\HTTP\IncomingRequest), NULL)
#3 /home/system/CodeIgniter.php(386): CodeIgniter\Filters\Filters->run('controller...', 'before')
#4 /home/system/CodeIgniter.php(320): CodeIgniter\CodeIgniter->handleRequest(NULL, Object(Config\Cache), false)
#5 /home/public/index.php(37): CodeIgniter\CodeIgniter->run()
#6 {main}
It looks like this is the SecurityException being thrown from the Security.php class:
// Do the tokens match?
if (! isset($token, $this->hash) || ! hash_equals($this->hash, $token)) {
throw SecurityException::forDisallowedAction();
}
If the tokens do not match then perhaps there is a different way to handle this, as apposed to hammering the logs with these errors / exceptions.
Steps to Reproduce
Turn on CSRF protection.
Expected Output
N/A
Anything else?
No response
The text was updated successfully, but these errors were encountered: