Regex reject pattern from Fedibird

This commit is contained in:
Mike Barnes 2025-03-27 21:01:08 +11:00
commit 9ee03ac660
9 changed files with 57 additions and 1 deletions

View file

@ -14,7 +14,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
private
def create_status
return reject_payload! if unsupported_object_type? || non_matching_uri_hosts?(@account.uri, object_uri) || tombstone_exists? || !related_to_local_activity?
return reject_payload! if unsupported_object_type? || non_matching_uri_hosts?(@account.uri, object_uri) || tombstone_exists? || !related_to_local_activity? || reject_pattern?
with_redis_lock("create:#{object_uri}") do
return if delete_arrived_first?(object_uri) || poll_vote?
@ -410,6 +410,10 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
Tombstone.exists?(uri: object_uri)
end
def reject_pattern?
Setting.reject_pattern.present? && @object['content']&.match?(Setting.reject_pattern)
end
def forward_for_reply
return unless @status.distributable? && @json['signature'].present? && reply_to_local?