File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -446,6 +446,11 @@ async def reply_invalid_access() -> None:
446446 await update .message .reply_text ("Too many requests for this username. Try again later." )
447447 return
448448
449+ # Global rate limit (across all chat IDs) - checked before AD to protect LDAP from spam
450+ if not is_admin and not _global_rate_limit_ok ():
451+ await update .message .reply_text ("Global rate limit exceeded. Try again later." )
452+ return
453+
449454 try :
450455 is_enabled , in_group = await asyncio .to_thread (_is_user_enabled_and_in_group , username )
451456 except Exception as exc :
@@ -457,11 +462,6 @@ async def reply_invalid_access() -> None:
457462 await reply_invalid_access ()
458463 return
459464
460- # Global rate limit (across all chat IDs)
461- if not _global_rate_limit_ok ():
462- await update .message .reply_text ("Global rate limit exceeded. Try again later." )
463- return
464-
465465 INVALID_IDENTITY_ATTEMPTS .pop (chat_id , None )
466466 _save_state ()
467467
You can’t perform that action at this time.
0 commit comments