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

Excluding logged in users from rate-limiting #2686

Open
2 tasks done
olegbliaher opened this issue Oct 25, 2024 · 5 comments
Open
2 tasks done

Excluding logged in users from rate-limiting #2686

olegbliaher opened this issue Oct 25, 2024 · 5 comments

Comments

@olegbliaher
Copy link

Checklist

❓ Question

Is it possible to exclude logged in users from rate-limits?

πŸ“Ž Additional context

Running pwpush 1.47.1 with Caddy.

I also noticed I can configure safelist_ip-addresses via config/initializers/rack_attack.rb. Would be nice if it would be possible to specify those IP-addresses as an environment variable.

Copy link

Hello @olegbliaher, thanks for contributing to the Password Pusher community! We will respond as soon as possible.

@pglombardo
Copy link
Owner

Hi @olegbliaher - I can do that. But if you want it to apply to all logged in users, there might be a better solution rather than by IP:

throttle("req/minute/ip", limit: 120, period: 1.minute) do |req|
  req.ip if req.session[:warden] && req.session[:warden]["user.user.id"].nil? && !req.path.start_with?("/assets")
end

Needs testing though.

@olegbliaher
Copy link
Author

Hi @pglombardo, thank you for the very swift response! Personally, I'd prefer excluding all logged-in users, instead of dealing with IP-addresses and ranges.

Your suggestion looks perfect.

@pglombardo
Copy link
Owner

Sounds good - I have a couple other things in progress right but hopefully I can add this over the weekend. I'll update once the addition is out. Thanks for pointing this out!

@olegbliaher
Copy link
Author

Hi again, I would just like to point out that if you could add support for excluding IP-addresses/ranges, we would find usage to that in my organization as well :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants