Skip to content

Conversation

@santib
Copy link
Collaborator

@santib santib commented Dec 30, 2025

Follow-up of #706 (comment)

@santib santib changed the title Try removing all dev dependencies [POC] Try removing all dev dependencies Dec 30, 2025
@santib santib force-pushed the try-removing-dev-deps branch from 56eaaca to 62a0e32 Compare January 5, 2026 15:21
@santib santib force-pushed the try-removing-dev-deps branch from 62a0e32 to 47610c3 Compare January 5, 2026 15:25
@santib santib force-pushed the try-removing-dev-deps branch from 3bc94cb to 8c257ba Compare January 5, 2026 15:59
Rack::Attack.blocklist("allow2ban pentesters") do |request|
Rack::Attack::Allow2Ban.filter(request.ip, maxretry: 2, findtime: 30, bantime: 60) do
request.path.include?("scarce-resource")
if defined?(::ActiveSupport::Cache::MemoryStore)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests shouldn't be tied to active support


describe "Blocking an IP" do
let(:notifications) { [] }
if defined?(::ActiveSupport::Notifications)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests shouldn't be tied to active support

before do
Rack::Attack.blocklist do |request|
request.ip == "1.2.3.4"
if defined?(::ActiveSupport::Notifications)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests shouldn't be tied to active support


describe "Blocking an IP subnet" do
let(:notifications) { [] }
if defined?(::ActiveSupport::Notifications)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests shouldn't be tied to active support

describe "Customizing throttled response" do
before do
Rack::Attack.cache.store = ActiveSupport::Cache::MemoryStore.new
if defined?(::ActiveSupport::Cache::MemoryStore)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests shouldn't be tied to active support


describe "fail2ban" do
let(:notifications) { [] }
if defined?(::ActiveSupport::Cache::MemoryStore)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests shouldn't be tied to active support


describe "Safelist an IP" do
let(:notifications) { [] }
if defined?(::ActiveSupport::Notifications)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests shouldn't be tied to active support

before do
Rack::Attack.blocklist do |request|
request.ip == "1.2.3.4"
if defined?(::ActiveSupport::Notifications)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests shouldn't be tied to active support


describe "Safelisting an IP subnet" do
let(:notifications) { [] }
if defined?(::ActiveSupport::Notifications)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests shouldn't be tied to active support


describe "#throttle" do
let(:notifications) { [] }
if defined?(::ActiveSupport::Cache::MemoryStore)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests shouldn't be tied to active support


describe "#track" do
let(:notifications) { [] }
if defined?(::ActiveSupport::Notifications)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests shouldn't be tied to active support


describe "#track with throttle-ish options" do
let(:notifications) { [] }
if defined?(::ActiveSupport::Cache::MemoryStore)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests shouldn't be tied to active support

get '/', {}, 'REMOTE_ADDR' => '1.2.3.4'

_(last_response.status).must_equal 200
if defined?(::ActiveSupport::Cache::MemoryStore)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests shouldn't be tied to active support


Rack::Attack.blocklist('pentest') do |req|
Rack::Attack::Fail2Ban.filter(req.ip, @f2b_options) { req.query_string =~ /OMGHAX/ }
if defined?(::ActiveSupport::Cache::MemoryStore)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests shouldn't be tied to active support

Rack::Attack.cache.store = ActiveSupport::Cache::MemoryStore.new
Rack::Attack.throttle('ip/sec', limit: 1, period: @period) { |req| req.ip }
end
if defined?(::ActiveSupport::Cache::MemoryStore)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests shouldn't be tied to active support


describe 'Rack::Attack.track' do
let(:notifications) { [] }
if defined?(::ActiveSupport::Notifications)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests shouldn't be tied to active support

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant