Suspect that the RateLimiter class is breaking the block editor for Editor roles
-
An Editor on my site is running into a lot of 429 too many requests errors in the block editor when trying to add/edit a post.
I think that is might be related to the Ninja Forms
RateLimiterclass which seems to apply to any logged in user who is NOT an admin (as checked by theif ( is_user_logged_in() && current_user_can( 'manage_options' ) ) {
I think only admins havemanage_optionscapabilities right? So this would impact non-editors in the admin area? For now I have a snippet to increase the limit for my user, but shouldn’t this be limited to the frontend only?namespace NinjaForms\Blocks\Authentication;
/**
* Rate limiter for Views REST API endpoints.
*
* Prevents DoS attacks by limiting requests per IP address.
*/
class RateLimiter {
/** @var int Default rate limit (requests per window) */
const DEFAULT_LIMIT = 60;
/** @var int Default time window in seconds */
const DEFAULT_WINDOW = 60; // 1 minute
/** @var string Transient key prefix */
const TRANSIENT_PREFIX = 'nf_views_rate_limit_';
/**
* Check if the current request should be rate limited.
*
* @param string $endpoint Endpoint identifier (e.g., 'submissions', 'forms')
* @param int $limit Maximum requests per window (default 60)
* @param int $window Time window in seconds (default 60)
*
* @return bool|\WP_Error True if allowed, WP_Error if rate limited
*/
public static function check( $endpoint, $limit = null, $window = null ) {
// Allow disabling rate limiting via constant
if ( defined( 'NF_VIEWS_DISABLE_RATE_LIMITING' ) && NF_VIEWS_DISABLE_RATE_LIMITING ) {
return true;
}
// Allow disabling for logged-in admins
if ( is_user_logged_in() && current_user_can( 'manage_options' ) ) {
return true;
}
// truncated
You must be logged in to reply to this topic.