Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,4 @@ gem 'omniauth-google-oauth2'
gem 'omniauth-rails_csrf_protection'
gem 'rack-cors'
gem 'hashids'
gem 'rack-attack'
7 changes: 5 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ GEM
jbuilder (2.14.1)
actionview (>= 7.0.0)
activesupport (>= 7.0.0)
json (2.17.1)
json (2.18.0)
jsonpath (1.1.5)
multi_json
jwt (3.1.2)
Expand Down Expand Up @@ -341,7 +341,7 @@ GEM
omniauth-oauth2 (1.8.0)
oauth2 (>= 1.4, < 3)
omniauth (~> 2.0)
omniauth-rails_csrf_protection (2.0.0)
omniauth-rails_csrf_protection (2.0.1)
actionpack (>= 4.2)
omniauth (~> 2.0)
openseadragon (1.0.17)
Expand Down Expand Up @@ -371,6 +371,8 @@ GEM
raabro (1.4.0)
racc (1.8.1)
rack (3.2.4)
rack-attack (6.8.0)
rack (>= 1.0, < 4)
rack-cors (3.0.0)
logger
rack (>= 3.0.14)
Expand Down Expand Up @@ -595,6 +597,7 @@ DEPENDENCIES
openseadragon (~> 1.0)
propshaft
puma (>= 5.0)
rack-attack
rack-cors
rails!
request_store
Expand Down
7 changes: 7 additions & 0 deletions config/initializers/rack_attack.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Rack::Attack
# Block all bots from /catalog
blocklist('block bots from catalog') do |req|
req.path.start_with?('/catalog') &&
req.user_agent.to_s =~ /bot|crawler|spider|scraper/i
end
end