Skip to content

Commit 0b0d3d2

Browse files
authored
Add rate limit for media proxy requests (mastodon#10490)
30 per 30 minutes, like media uploads
1 parent f135567 commit 0b0d3d2

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

config/initializers/rack_attack.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ def web_request?
5757
req.authenticated_user_id if req.post? && req.path.start_with?('/api/v1/media')
5858
end
5959

60+
throttle('throttle_media_proxy', limit: 30, period: 30.minutes) do |req|
61+
req.ip if req.path.start_with?('/media_proxy')
62+
end
63+
6064
throttle('throttle_api_sign_up', limit: 5, period: 30.minutes) do |req|
6165
req.ip if req.post? && req.path == '/api/v1/accounts'
6266
end

0 commit comments

Comments
 (0)