about summary refs log tree commit diff
path: root/app/services/fetch_remote_status_service.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2023-02-10 22:16:37 +0100
committerGitHub <noreply@github.com>2023-02-10 22:16:37 +0100
commit0c9eac80d887cdf7f1efa582b21006248d2f83eb (patch)
tree208ac4a6745b34f45e5d69b96262ce92aa59c59f /app/services/fetch_remote_status_service.rb
parent719bb799be9a03b767bd9f55d30abf2b7bc318ec (diff)
Fix unbounded recursion in post discovery (#23506)
* Add a limit to how many posts can get fetched as a result of a single request

* Add tests

* Always pass `request_id` when processing `Announce` activities

---------

Co-authored-by: nametoolong <nametoolong@users.noreply.github.com>
Diffstat (limited to 'app/services/fetch_remote_status_service.rb')
-rw-r--r--app/services/fetch_remote_status_service.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/services/fetch_remote_status_service.rb b/app/services/fetch_remote_status_service.rb
index eafde4d4a..08c2d24ba 100644
--- a/app/services/fetch_remote_status_service.rb
+++ b/app/services/fetch_remote_status_service.rb
@@ -1,7 +1,7 @@
 # frozen_string_literal: true
 
 class FetchRemoteStatusService < BaseService
-  def call(url, prefetched_body = nil)
+  def call(url, prefetched_body: nil, request_id: nil)
     if prefetched_body.nil?
       resource_url, resource_options = FetchResourceService.new.call(url)
     else
@@ -9,6 +9,6 @@ class FetchRemoteStatusService < BaseService
       resource_options = { prefetched_body: prefetched_body }
     end
 
-    ActivityPub::FetchRemoteStatusService.new.call(resource_url, **resource_options) unless resource_url.nil?
+    ActivityPub::FetchRemoteStatusService.new.call(resource_url, **resource_options.merge(request_id: request_id)) unless resource_url.nil?
   end
 end