Get started in three steps
Get your protection ready in 3 easy steps.Step 1: Install the gem
Install via the Gemfile
Install via the Gemfile
Add this line to your application’s Gemfile:Then run:
Require in your Rack/Rails app
Require in your Rack/Rails app
Add BlackLab to your middleware stack. For example, in
config.ru:Step 2: Configure BlackLab
Create an initializer
Create an initializer
Create a file at
config/initializers/black_lab.rb and configure it:Only enable the plugins you need — keep it lightweight!
Customize behavior
Customize behavior
You can tweak:
- block_message → What users see when blocked
- block_duration → How long to block IPs
- plugins → Choose detection plugins (SQLi, XSS, Path traversal, etc.)
- callback_threshold → How many points until an IP is blocked
Start with defaults, then tighten rules based on your app’s needs.
Step 3: Go live
Deploy with protection
Deploy with protection
- Commit your changes.
- Deploy your app as usual.
- BlackLab WAF will automatically protect your endpoints against SQLi, XSS, and more!
Next steps
Now that BlackLab WAF is running, explore these key features:Add more plugins
Extend BlackLab with additional security plugins.
Customize block actions
Run custom logic when a request is blocked (e.g., alerting).
Tuning thresholds
Balance security and usability by adjusting thresholds.
Monitoring & logs
Learn how to monitor and analyze blocked requests.
Need help? Create an issue in our Github repository.