aminghadersohi commented on code in PR #36195:
URL: https://github.com/apache/superset/pull/36195#discussion_r2544725513
##########
superset/security/manager.py:
##########
@@ -2875,7 +2875,31 @@ def register_views(self) -> None:
SupersetRegisterUserView
)
- super().register_views()
+ # Apply rate limiting to auth view if enabled
+ # This needs to be done after the view is added, otherwise the
blueprint
+ # is not initialized. Only apply if blueprint exists.
+ # We also need to prevent the parent's register_views from trying to
+ # apply rate limiting again (since auth_view already exists), so we
+ # temporarily disable AUTH_RATE_LIMITED during the super() call.
+ if (
+ self.is_auth_limited
+ and hasattr(self.auth_view, "blueprint")
+ and self.auth_view.blueprint is not None
+ ):
+ self.limiter.limit(self.auth_rate_limit, methods=["POST"])(
+ self.auth_view.blueprint
+ )
+
+ # Temporarily disable AUTH_RATE_LIMITED to prevent parent from trying
to
+ # apply rate limiting to a potentially None blueprint
+ original_auth_rate_limited =
current_app.config.get("AUTH_RATE_LIMITED", False)
Review Comment:
done
##########
superset/security/manager.py:
##########
@@ -2875,7 +2875,31 @@ def register_views(self) -> None:
SupersetRegisterUserView
)
- super().register_views()
+ # Apply rate limiting to auth view if enabled
+ # This needs to be done after the view is added, otherwise the
blueprint
+ # is not initialized. Only apply if blueprint exists.
+ # We also need to prevent the parent's register_views from trying to
+ # apply rate limiting again (since auth_view already exists), so we
+ # temporarily disable AUTH_RATE_LIMITED during the super() call.
+ if (
+ self.is_auth_limited
+ and hasattr(self.auth_view, "blueprint")
+ and self.auth_view.blueprint is not None
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]