flipper
Rack::Attack
flipper | Rack::Attack | |
---|---|---|
10 | 13 | |
3,569 | 5,488 | |
0.8% | 0.4% | |
9.6 | 6.9 | |
9 days ago | 5 days ago | |
Ruby | Ruby | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
flipper
- Ask HN: How did you build feature flags?
-
Feature flags in Rails: How to roll out and manage your features like a pro
Thatâs it! You now have a fully configured feature flagging system in your Rails app. Notice we didnât cover some more advanced features that Flipper offers, including enabling features for a user group or individual users. For that, check out Flipper on Github. We also didnât cover feature flagging frontend features in this post - if that becomes a requirement we could easily create an endpoint that uses the FeaturesRepo and sends enabled features to the frontend to toggle. If you learned something new consider following me here - Iâll be putting out more content on Ruby on Rails and software development as I work on Firecode.io. Preparing for a coding interview? Check out Firecode.io.
-
How do you release experimental features to early adopters?
I think you are calling it Runtime Controls: https://github.com/jnunemaker/flipper/issues/162
-
Add Feature Flags in Ruby on Rails with Flipper
Flipper is a gem that makes feature flags and different ways to toggle them available in Rails. It is highly modular. Apart from the main gem, you'll also have to pick a storage adapter â but more on that later. Let's use the ActiveRecord adapter for now.
-
What Feature Toggle/Flag service are you using?
Since Honeybadger is a Ruby shop, we use the flipper gem.
-
Keeping the Stakes Low while Breaking Production
The next step came about when I learned more about our use of Flipper; a Ruby gem for dynamically toggling on and off features. I didnât know when the feature would roll out, but I wanted control over the feature. I also wanted admins of other Forems to have control as well. This was trivial with Flipper. Once I deployed the code, Foremâs got the original behavior unless they turned âflippedâ on the feature.
- Flags vs. Gates
-
Rails application boilerplate for fast MVP development
flipper with Flipper UI to enable flag management
-
Show Rails: Feature Flagging Gem - Lightning
What advantages does your gem have over Flipper?
Rack::Attack
-
Rails Authentication for Compliance
The first line of defense should be to put rate-limiting on your login endpoints. rack-attack can help with that. I recommend to limit the login attempts to 5 per minute for a username and block the IP for 30 minutes. You should also limit the number of login attempts from the same IP address, but this needs to be adjusted to the application you are working on, because if it is a tool used in classrooms, it might be legit to have 50 logins within a few minutes from the same IP. (I have a few post written about rack-attack)
-
4 Essential Security Tools To Level Up Your Rails Security
Rack::Attack
- Huginnâs IP keeps getting blocked by Kickstarter
- rack/rack-attack: Rack middleware for blocking & throttling
-
Rack-attack gem setup to protect Rails and Rack apps from bad clients
Rack middleware for blocking & throttling abusive requests. Protect your Rails and Rack apps from bad clients. Rack::Attack lets you quickly decide when to allow, block, and throttle based on the properties of the request. Using this gem you can save your web application from attacks, we can whitelist IPs, Block requests according to requirements, and many more⌠Install Rack-attack gem: # In your Gemfile gem 'rack-attack' Enter fullscreen mode Exit fullscreen mode Plugging into the application Then tell your ruby web application to use rack-attack as a middleware. # config/application.rb # rack attack middleware config.middleware.use Rack::Attack Enter fullscreen mode Exit fullscreen mode Once youâve done that, youâll need to configure it. You can do this by creating the file, config/initializers/rack-attack.rband adding the rules to fit your needs. You can disable it permanently (like for a specific environment) or temporarily (can be helpful for specific test cases) by writing: Usage Safe listing Safelists have the most precedence, so any request matching a safelist would be allowed despite matching any number of blocklists or throttles. safelist_ip(ip_address_string) Rack::Attack.safelist_ip(â5.6.7.8â) Enter fullscreen mode Exit fullscreen mode safelist_ip(ip_subnet_string) Rack::Attack.safelist_ip(â5.6.7.0/24â) Enter fullscreen mode Exit fullscreen mode safelist(name, &block) Name your custom safelist and make your ruby-block argument return a truthy value if you want the request to be allowed, and false otherwise. Blocking blocklist_ip(ip_address_string) Rack::Attack.blocklist_ip(â1.2.3.4â) Enter fullscreen mode Exit fullscreen mode blocklist_ip(ip_subnet_string) Rack::Attack.blocklist_ip(â1.2.0.0/16â) Enter fullscreen mode Exit fullscreen mode blocklist(name, &block) Name your custom blocklist and make your ruby-block argument return a truthy value if you want the request to be blocked, and false otherwise. Throttling *throttle(name, options, &block) *( provide limit and period as options) Throttle state is stored in a configurable cache (which defaults to Rails.cache if present). Name your custom throttle, provide limit and period as options, and make your ruby-block argument return the discriminator. This discriminator is how you tell rack-attack whether youâre limiting per IP address, per user email, or any other. For example, if we want to restrict requests other than defined routes and display a custom error page. Error page: If we want to restrict requests/IP and if the request limit increases then send a reminder mail. For Example, we want to allow only 300 requests per 30 seconds after that will restrict requests from this IP till the next 30 seconds interval starting. Get error mail if the limit is extended. Performance The overhead of running Rack::Attack is typically negligible (a few milliseconds per request), but it depends on how many checks youâve configured, and how long they take. Throttles usually require a network roundtrip to your cache server(s), so try to keep the number of throttle checks per request low. If a request is blocklisted or throttled, the response is a very simple Rack response. A single typical ruby web server thread can block several hundred requests per second. Sample rack-attack.rb file For more information: https://github.com/rack/rack-attack If this guide has been helpful to you and your team please share it with others!
-
Limiting the amount of calls user can make to an api
Second vote for rack-attack!
-
Devise and email spam?
You could use something like Rack Attack to mitigate this type of behavior if it becomes an issue.
-
10 things I add to every Rails app
The final gem I like to include in all projects is rack-attack. This is a rate limiting tool which is great for throttling dangerous actions in your app to prevent bot attacks or other malicious users.
-
Rails application boilerplate for fast MVP development
rack-attack to prevent bruteforce and DDoS attacks
-
How to prevent scraping/copying data?
Check out Rack Attack. It lets you block bots that make requests too fast to be real users, or that request obviously-suspect URLs (/phpmyadmin for example). There are lots of other options, but those are the quick wins IMO.
What are some alternatives?
Flipflop your features - Flipflop lets you declare and manage feature flags in your Rails application.
Metasploit - Metasploit Framework
Motorhead - A Rails Engine framework that helps safe and rapid feature prototyping
Rack::Protection - NOTE: This project has been merged upstream to sinatra/sinatra
Abstract Feature Branch - abstract_feature_branch is a Ruby gem that provides a variation on the Branch by Abstraction Pattern by Paul Hammant and the Feature Toggles Pattern by Martin Fowler (aka Feature Flags) to enable Continuous Integration and Trunk-Based Development.
rspec-rails - RSpec for Rails 6+
Pundit - Minimal authorization through OO design and pure Ruby classes
Rack::UTF8Sanitizer - Rack::UTF8Sanitizer is a Rack middleware which cleans up invalid UTF8 characters in request URI and headers.
Ahoy - Simple, powerful, first-party analytics for Rails
BeEF - The Browser Exploitation Framework Project
flagsmith - Open Source Feature Flagging and Remote Config Service. Host on-prem or use our hosted version at https://flagsmith.com/
Gitrob - Reconnaissance tool for GitHub organizations