Fix ActivityPub node count check (#41482)

This commit is contained in:
Claire committed 2026-11-03 15:50:57 +01:00
1 parent 88c6c937d8
commit aeb73fa842
1 file changed
+7 -1
@@ -21,7 +21,13 @@ class ActivityPub::ProcessActivityService < BaseService
# Doing JSON-LD compaction early ensures we know what we are working with, and avoids
# issues like attacks involving swapping external context documents between processing steps.
begin
@json = compact(@json) if @json['signature'].is_a?(Hash)
if @json['signature'].is_a?(Hash)
check_jsonld_limits!(@json)
@json = compact(@json)
end
# Unsupported features can be aliased, so re-check after compaction
check_jsonld_limits!(@json)
rescue Mastodon::InvalidJsonLdError => e
Rails.logger.debug { "JSON-LD handling for document from #{value_or_id(@json['actor'])} skipped: #{e.message}" }