diff --git a/app/services/activitypub/process_activity_service.rb b/app/services/activitypub/process_activity_service.rb index ec62d10c50..31554b3d14 100644 --- a/app/services/activitypub/process_activity_service.rb +++ b/app/services/activitypub/process_activity_service.rb @@ -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}" }