Fix Move activity losing target when sent to followers#3102
Open
Fix Move activity losing target when sent to followers#3102
Conversation
The outbox_activity filter for Move activities was overwriting the target with the object value, causing all outgoing Move activities to have origin == target. Remote instances correctly ignored these as no-ops. Fix by removing the unnecessary filter entirely — the stored outbox JSON already has the correct values. Also fix verify_move to use camelCase JSON keys (alsoKnownAs) matching raw HTTP responses, and broaden origin matching to check id, url, and webfinger identifiers.
There was a problem hiding this comment.
Pull request overview
This PR fixes ActivityPub account migration (Move) issues where outgoing Move activities could lose their intended target, and improves inbound Move verification to match real-world actor JSON shapes.
Changes:
- Removed the
activitypub_get_outbox_activityfilter for Move activities that could overwritetarget. - Updated inbound Move verification to use
alsoKnownAs(camelCase) and to match origin viaid,url, orwebfinger. - Updated/added PHPUnit coverage for Move handler scenarios and key casing.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| includes/handler/class-move.php | Removes the outbox filter for Move; updates verify_move() to use alsoKnownAs and broaden origin matching. |
| tests/phpunit/tests/includes/handler/class-test-move.php | Updates mocked actor payload keys to alsoKnownAs; adds tests for origin matching by url and webfinger. |
| tests/phpunit/tests/includes/class-test-move.php | Updates test fixture JSON to use alsoKnownAs. |
| .github/changelog/fix-move-activity-target | Adds a changelog entry documenting the fix. |
Some JSON-LD payloads may represent single-value properties as a string rather than an array.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 https://wordpress.org/support/topic/unmigrate-followers/
Proposed changes:
outbox_activityfilter for Move activities that was overwriting thetargetwith theobjectvalue. This caused all outgoing Move activities to haveorigin == target, so remote instances correctly ignored them as no-ops. The stored outbox JSON already has the correct values, making the filter unnecessary.verify_moveto use camelCase JSON keys (alsoKnownAs) matching raw HTTP responses fromHttp::get_remote_object(), which returnsjson_decode'd data without key transformation.verify_moveto checkid,url, andwebfingeridentifiers against the target'salsoKnownAsarray.Other information:
Testing instructions:
alsoKnownAs.wp activitypub move <local-actor-url> <remote-actor-url>to trigger an external Move.targetpoints to the remote account (not the local one).Changelog entry
Changelog Entry Details
Significance
Type
Message
Fix account migration (Move) not working when moving back to an external account.