[BE] [Bug]: ActivePub federation incoming "Page" is not properly parsed from RawAnnouncableActivities into a AnnouncableActivities:Page, code logic to detect "Page" is not being reached #3639
[BE] [Bug]: ActivePub federation incoming "Page" is not properly parsed from RawAnnouncableActivities into a AnnouncableActivities:Page, code logic to detect "Page" is not being reached #3639
Requirements Is this a bug report? For questions or discussions use https://lemmy.ml/c/lemmy_support Did you check to see if this issue already exists? Is this only a single bug? Do not put multipl...
Requirements
- [X] Is this a bug report? For questions or discussions use https://lemmy.ml/c/lemmy_support
- [X] Did you check to see if this issue already exists?
- [X] Is this only a single bug? Do not put multiple bugs in one issue.
- [X] Is this a backend issue? Use the lemmy-ui repo for UI / frontend issues.
Summary
lemmy_server code fails to convert RawAnnouncableActivities into a AnnouncableActivities:Page before reaching logic to reject Page.
let activity: AnnouncableActivities = self.clone().try_into()?;
// This is only for sending, not receiving so we reject it.
if let AnnouncableActivities::Page(_) = activity {
return Err(LemmyErrorType::CannotReceivePage)?;
}
The code errors on the first line with data did not match any variant of untagged enum AnnouncableActivities
, not reaching the second line of code that would return Err(LemmyErrorType::CannotReceivePage)
.
Steps to Reproduce
- Subscribe a lemmy instance to various bots mentioned below
- Look in server error logs for
data did not match any variant of untagged enum AnnouncableActivities
- capture the raw incoming data to analyze
Example of incoming raw data causing this match problem:
RawAnnouncableActivities { id: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("lemmit.online")), port: None, path: "/activities/announce/f513b770-c440-48f3-b0f0-21317b9e85b7", query: None, fragment: None }, actor: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("lemmit.online")), port: None, path: "/c/comics", query: None, fragment: None }, other: {"to": Array [String("https://www.w3.org/ns/activitystreams#Public")], "object": Object {"id": String("https://lemmit.online/post/201322"), "actor": String("https://lemmit.online/u/bot"), "type": String("Page"), "attributedTo": String("https://lemmit.online/u/bot"), "to": Array [String("https://lemmit.online/c/comics"), String("https://www.w3.org/ns/activitystreams#Public")], "name": String("I guess my son qualifies as my pet as well."), "cc": Array [], "content": String("<h5>This is an automated archive made by the <a href=\"https://lemmit.online/post/14692\">Lemmit Bot</a>.</h5>\n<p>The original was posted on <a href=\"https://old.reddit.com/r/comics/comments/151el8i/i_guess_my_son_qualifies_as_my_pet_as_well/\">/r/comics</a> by <a href=\"https://old.reddit.com/u/AlloyComics\">/u/AlloyComics</a> on 2023-07-16 21:08:16.</p>\n"), "mediaType": String("text/html"), "source": Object {"content": String("##### This is an automated archive made by the [Lemmit Bot](https://lemmit.online/post/14692).\nThe original was posted on [/r/comics](https://old.reddit.com/r/comics/comments/151el8i/i_guess_my_son_qualifies_as_my_pet_as_well/) by [/u/AlloyComics](https://old.reddit.com/u/AlloyComics) on 2023-07-16 21:08:16.\n"), "mediaType": String("text/markdown")}, "attachment": Array [Object {"href": String("https://i.redd.it/q53smvggldcb1.png"), "type": String("Link")}], "commentsEnabled": Bool(true), "sensitive": Bool(false), "published": String("2023-07-17T01:58:34.158916+00:00"), "language": Object {"identifier": String("en"), "name": String("English")}, "audience": String("https://lemmit.online/c/comics")}, "cc": Array [String("https://lemmit.online/c/comics/followers")], "type": String("Announce")} }
Technical Details
It seems bods are generating these type: Page
https://lemmy.world/u/MatchThreadBot
https://lemmit.online/u/bot
Example of a post that comes as type: Page and causes this problem: https://lemmit.online/post/201322
Version
BE: 0.18.2
Lemmy Instance URL
No response