Welcome Guest, Not a member yet? Register   Sign In
Rate Limit when they throw exception?
#1

Hi!
I have an annoying spammer who will occasionally trigger lots of error logs for bad CSRF tokens.
Basically they keep throwing the throw SecurityException::forDisallowedAction(); action from system/Security/Security.php

Is there a way to trigger a rate limit so that for every time this error occurs, they will eventually get blocked from using the site? This person did it like 500+ times over the course of an hour so it wouldn't catch many innocent users.
Reply
#2

You can take a look at this.

CodeIgniter 4 User Guide - Library - Reference - Throttler
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

Anyway to trigger the throttle when the exception happens? I can see the filter can hook into POST requests but not sure if it can hook into exceptions?
Reply
Reply
#5

(08-09-2024, 06:58 PM)kenjis Wrote: Customize CSRF filter:
https://github.com/codeigniter4/CodeIgni...hp#L48-L65

See also 
- https://codeigniter.com/user_guide/incom...g-a-filter
- https://codeigniter.com/user_guide/incom...ng-filters

Perfect ! Thank you Smile
Reply




Theme © iAndrew 2016 - Forum software by © MyBB