Skip to content
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

Add Error Limit for submissions that works similar to Speed Limit #1030

Closed
eSilverStrike opened this issue Jan 31, 2020 · 6 comments
Closed
Labels
Feature Issues that describe new features.
Milestone

Comments

@eSilverStrike
Copy link
Member

eSilverStrike commented Jan 31, 2020

Bots constantly are hitting all websites testing the url variables for weakness and draining server resources. We should add functionality that works similar to the Geeklog Speed Limit (that is expandable to plugins) but keeps track of the number of submission errors (including incorrect variables content passed, spam found, etc...) a session has (or ip???). It should also work for potentially other errors like trying to access the admin section, going beyond page limits, etc.. (like counting 404 errors)

This way plugins like Ban can take this information and based on the type of error (likes submission, comment submission, etc...) apply restrictions (ie IP banned for 10 like submission errors in 60 seconds).

Should have config option to disable this as if user doesn't have a plugin like Ban that can take advantage of this there is most likely no reason to record errors.

@eSilverStrike eSilverStrike added the Feature Issues that describe new features. label Jan 31, 2020
@eSilverStrike eSilverStrike added this to the 2.2.2 milestone Jan 31, 2020
@mystralkk
Copy link
Member

mystralkk commented Apr 13, 2022

How about changing COM_checkSpeedlimit like this:

COM_checkSpeedlimit($type = 'submit', $max = 1, $property = '')

-->

COM_checkSpeedlimit($type = 'submit', $max = 1, $property = '', &$isSpeeding)

In this function, if the number of records in the $_TABLES['speedlimit'] table exceeds the value of $max, we set $isSpeeding to true. And at the same time, we call PLG_onSpeeding($ipAddress) (this function is not implemented yet) and let the plugins know that the user is hitting the limit. This way we don't have to have a new config option. How does this change sound, @eSilverStrike ?

@eSilverStrike
Copy link
Member Author

That sounds like a good idea.

So we could then add some general error tracking for maybe 404 errors handled by Geeklog in COM_handle404 and the SPAM-X plugin using the isSpeeding flag. Types could be "error-404" and "error-spam"

Then the ban plugin could have the required function for PLG_onSpeeding and then know to ban the ip when a certain threshold is met for those types.

mystralkk added a commit that referenced this issue Apr 14, 2022
@mystralkk
Copy link
Member

Implemented. I defined $max argument for COM_checkSpeedlimit explicitly in the top of "lib-plugins.php" and added a fourth argument &$isSpeeding to the function.

@eSilverStrike
Copy link
Member Author

Added a feature request to the ban plugin for this and was just quickly going over things to see how it worked.

COM_checkSpeedlimit will call plugin_onSpeeding_ban($type, $property, $last). At this point ban needs to determine what to do based on what is stored in the speedlimit database table either by using the constants stored in lib-plugins or by having its own config values.

So doesn't this mean COM_updateSpeedlimit() function calls needs to be added to Geeklog Core for the types? 'error-403', 'error-404', 'error-spam'? Or am I not looking at this right?

@mystralkk
Copy link
Member

I forgot about COM_updateSpeedlimit(). I added calling COM_updateSpeedlimit() after calling COM_checkSpeedlimit with $type being 'error-403', 'error-404' and 'error-spam'.

eSilverStrike added a commit that referenced this issue Apr 29, 2022
For feature #1030
Now speedlimit errors themselves can be tracked.
eSilverStrike added a commit to Geeklog-Plugins/ban that referenced this issue Apr 29, 2022
For Feature #17 and Geeklog-Core/geeklog#1030

Also optimize some code in Ban_Check to improve speed.

Added $_BAN_IP_STATUS global variable to track current IP status.
@eSilverStrike
Copy link
Member Author

@mystralkk FYI I also added error-speedlimit type that tracks when speedlimit errors happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Issues that describe new features.
Projects
None yet
Development

No branches or pull requests

2 participants