Skip to content

Commit

Permalink
Ignore S3 requests in Rack::Attack
Browse files Browse the repository at this point in the history
  • Loading branch information
Kagemaru committed Aug 20, 2024
1 parent eb6f263 commit 36e2915
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config/initializers/rack_attack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

Rack::Attack.safelist "allow S3 redirects" do |request|
regexes = [
%r~https://[^/]+?/rails/active_storage/blobs/redirect/[A-Za-z0-9=]+--[A-Za-z0-9=]+/~,
%r~https://[^/]+?/rails/active_storage/representations/redirect/[A-Za-z0-9=]+--[A-Za-z0-9=]+/[A-Za-z0-9=]+--[A-Za-z0-9=]+/~
%r~\Ahttps://[^/]+?/rails/active_storage/blobs/redirect/[A-Za-z0-9=]+--[A-Za-z0-9=]+/~,
%r~\Ahttps://[^/]+?/rails/active_storage/representations/redirect/[A-Za-z0-9=]+--[A-Za-z0-9=]+/[A-Za-z0-9=]+--[A-Za-z0-9=]+/~
]

regexes.any? { _1.match? request.url }
Expand Down

0 comments on commit 36e2915

Please sign in to comment.