Fix infinite recursion when storing remote actors with mentions #2369
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2366, the infinite recursion bug that fills error logs when storing remote actors with @mentions in their bios.
Proposed changes:
The Problem
When a remote actor's bio contains mentions (e.g.,
@[email protected]), the mention processing filter fetches that mentioned actor, which then processes mentions in their bio, creating an infinite loop that results in stack overflow errors.The Solution
In
Remote_Actors::prepare_custom_post_type(), temporarily remove theactivitypub_activity_object_arrayfilters (Mention, Hashtag, Link) aroundto_json(), then re-add them. This prevents filters from triggering during storage while preserving functionality for outgoing federation.Other information:
test_create_actor_with_self_mention_no_recursiontest_create_actor_with_cross_mentions_no_recursionTesting instructions:
npm run env-test -- --filter=test_create_actor_withnpm run env-testChangelog entry
Changelog Entry Details
Significance
Type
Message
Fix infinite recursion when storing remote actors with mentions in their bios