mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
Ensure abuse hit counter is not increased for admin/API keys
This commit is contained in:
parent
1273f4c9b7
commit
8da011ad78
1 changed files with 7 additions and 4 deletions
|
|
@ -115,11 +115,14 @@ App::init()
|
|||
;
|
||||
}
|
||||
|
||||
$enabled = App::getEnv('_APP_OPTIONS_ABUSE', 'enabled') !== 'disabled';
|
||||
|
||||
if (
|
||||
(App::getEnv('_APP_OPTIONS_ABUSE', 'enabled') !== 'disabled' // Route is rate-limited
|
||||
&& $abuse->check()) // Abuse is not disabled
|
||||
&& (!$isAppUser && !$isPrivilegedUser)
|
||||
) { // User is not an admin or API key
|
||||
$enabled // Abuse is enabled
|
||||
&& !$isAppUser // User is not API key
|
||||
&& !$isPrivilegedUser // User is not an admin
|
||||
&& $abuse->check() // Route is rate-limited
|
||||
) {
|
||||
throw new Exception(Exception::GENERAL_RATE_LIMIT_EXCEEDED);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue