[bug] Mobilizon Federated Events cause error when using PropertyValue in an Attachment as part of the Event payload #465

Open
opened 2023-02-12 19:14:34 +00:00 by gamerfort · 1 comment

Your setup

OTP

Extra details

No response

Version

3.6.0

PostgreSQL version

15.2

What were you trying to do?

When a Mobilizon group federates an Event to Akkoma, if the request contains an attachment with PropertyValue data in it, it throws an error and Akkoma cannot process it correctly.

I have an anonymized payload so you can look at what I mean in terms of data.

As for how to reproduce it, you can do it from a Mobilizon instance.

Steps:

  1. Create an account on a Mobilizon instance that federates.
  2. Create a group on the instance.
  3. Follow the group's account from Akkoma.

Reference: https://docs.joinmobilizon.org/use/users/follow-federation/

Note: In Mobilizon, you don't follow a user account. User accounts can create and manage Groups and Events. From Akkoma you follow the group account which then pushes new Events and Event updates to the group's followers to Akkoma.

  1. Create a new event in the group making sure that at a minimum the following fields filled in:

  2. Title

  3. Avatar (not sure if needed, but listing anyways)

  4. It can be an online event (toggle)

  5. Description

  6. Website / URL

  7. Under Event Metadata, try adding a Twitch user url
    - Click the text box for "Find or add an element"
    - Start typing in "twitch"
    - Fill in a full twitch url (can be a fake user) like https://twitch.tv/test

  8. Click Create Event

  9. Watch Akkoma error on trying to process the federated event. It is unable to process the event.

I have a sample payload (anomymized) attached. It is not the exact payload that generated the pasted log errors, but it was created using the same steps and same important pieces.

What did you expect to happen?

I expect the event to be processed and pushed to the Akkoma user's timeline without issue.

What actually happened?

Akkoma errors out with errors.

Logs

pleroma: [error] Error while fetching https://example.mobilizon.com/events/11111111-1a1a-2b2b-1s1s-ffffffffffff: {:error, {:transmogrifier, {:error, {:validate, {:error, #Ecto.Changeset<action: :insert, changes: %{actor: "https://example.mobilizon.com/@mobilizonuser", attachment: [#Ecto.Changeset<action: :insert, changes: %{type: "PropertyValue"}, errors: [type: {"is invalid", [validation: :inclusion, enum: ["Link", "Document", "Audio", "Image", "Video"]]}, url: {"can't be blank", [validation: :required]}], data: #Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator<>, valid?: false>, #Ecto.Changeset<action: :insert, changes: %{mediaType: "image/jpeg", name: "Banner", type: "Document", url: [#Ecto.Changeset<action: :insert, changes: %{href: "https://example.mobilizon.com/media/avatar.jpg", mediaType: "image/jpeg", type: "Link"}, errors: [], data: #Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator.UrlObjectValidator<>, valid?: true>]}, errors: [], data: #Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator<>, valid?: true>, #Ecto.Changeset<action: :insert, changes: %{mediaType: "text/html", name: "Website", type: "Link", url: [#Ecto.Changeset<action: :insert, changes: %{href: "https://example.com", mediaType: "text/html", type: "Link"}, errors: [], data: #Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator.UrlObjectValidator<>, valid?: true>]}, errors: [], data: #Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator<>, valid?: true>], attributedTo: "https://example.mobilizon.com/@mobilizonuser", cc: ["https://example.mobilizon.com/@mobilizonuser/followers"], content: "<p>Quick test of federation.</p>", context: "https://<akkoma-instance>/contexts/aaaaaaaa-1111-1111-1111-ffffffffffff", id: "https://example.mobilizon.com/events/11111111-1a1a-2b2b-1s1s-ffffffffffff", name: "Quick Test", published: "2023-02-12T18:41:48Z", tag: [#Ecto.Changeset<action: :insert, changes: %{href: "https://example.mobilizon.com/tags/board-games", name: "#board games", type: "Hashtag"}, errors: [], data: #Pleroma.Web.ActivityPub.ObjectValidators.TagValidator<>, valid?: true>], to: ["https://www.w3.org/ns/activitystreams#Public"], type: "Event", updated: "2023-02-12T18:41:48Z", url: "https://example.mobilizon.com/events/11111111-1a1a-2b2b-1s1s-ffffffffffff"}, errors: [], data: #Pleroma.Web.ActivityPub.ObjectValidators.EventValidator<>, valid?: false>}}}}}

Severity

I cannot use it as easily as I'd like

Have you searched for this issue?

  • I have double-checked and have not found this issue mentioned anywhere.
### Your setup OTP ### Extra details _No response_ ### Version 3.6.0 ### PostgreSQL version 15.2 ### What were you trying to do? When a Mobilizon group federates an Event to Akkoma, if the request contains an attachment with PropertyValue data in it, it throws an error and Akkoma cannot process it correctly. I have an anonymized payload so you can look at what I mean in terms of data. As for how to reproduce it, you can do it from a Mobilizon instance. Steps: 1. Create an account on a Mobilizon instance that federates. 2. Create a group on the instance. 3. Follow the group's account from Akkoma. Reference: https://docs.joinmobilizon.org/use/users/follow-federation/ Note: In Mobilizon, you don't follow a user account. User accounts can create and manage Groups and Events. From Akkoma you follow the group account which then pushes new Events and Event updates to the group's followers to Akkoma. 4. Create a new event in the group making sure that at a minimum the following fields filled in: 1. Title 2. Avatar (not sure if needed, but listing anyways) 3. It can be an online event (toggle) 4. Description 5. Website / URL 6. Under Event Metadata, try adding a Twitch user url - Click the text box for "Find or add an element" - Start typing in "twitch" - Fill in a full twitch url (can be a fake user) like https://twitch.tv/test 7. Click Create Event 8. Watch Akkoma error on trying to process the federated event. It is unable to process the event. I have a sample payload (anomymized) attached. It is not the exact payload that generated the pasted log errors, but it was created using the same steps and same important pieces. ### What did you expect to happen? I expect the event to be processed and pushed to the Akkoma user's timeline without issue. ### What actually happened? Akkoma errors out with errors. ### Logs ```shell pleroma: [error] Error while fetching https://example.mobilizon.com/events/11111111-1a1a-2b2b-1s1s-ffffffffffff: {:error, {:transmogrifier, {:error, {:validate, {:error, #Ecto.Changeset<action: :insert, changes: %{actor: "https://example.mobilizon.com/@mobilizonuser", attachment: [#Ecto.Changeset<action: :insert, changes: %{type: "PropertyValue"}, errors: [type: {"is invalid", [validation: :inclusion, enum: ["Link", "Document", "Audio", "Image", "Video"]]}, url: {"can't be blank", [validation: :required]}], data: #Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator<>, valid?: false>, #Ecto.Changeset<action: :insert, changes: %{mediaType: "image/jpeg", name: "Banner", type: "Document", url: [#Ecto.Changeset<action: :insert, changes: %{href: "https://example.mobilizon.com/media/avatar.jpg", mediaType: "image/jpeg", type: "Link"}, errors: [], data: #Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator.UrlObjectValidator<>, valid?: true>]}, errors: [], data: #Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator<>, valid?: true>, #Ecto.Changeset<action: :insert, changes: %{mediaType: "text/html", name: "Website", type: "Link", url: [#Ecto.Changeset<action: :insert, changes: %{href: "https://example.com", mediaType: "text/html", type: "Link"}, errors: [], data: #Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator.UrlObjectValidator<>, valid?: true>]}, errors: [], data: #Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator<>, valid?: true>], attributedTo: "https://example.mobilizon.com/@mobilizonuser", cc: ["https://example.mobilizon.com/@mobilizonuser/followers"], content: "<p>Quick test of federation.</p>", context: "https://<akkoma-instance>/contexts/aaaaaaaa-1111-1111-1111-ffffffffffff", id: "https://example.mobilizon.com/events/11111111-1a1a-2b2b-1s1s-ffffffffffff", name: "Quick Test", published: "2023-02-12T18:41:48Z", tag: [#Ecto.Changeset<action: :insert, changes: %{href: "https://example.mobilizon.com/tags/board-games", name: "#board games", type: "Hashtag"}, errors: [], data: #Pleroma.Web.ActivityPub.ObjectValidators.TagValidator<>, valid?: true>], to: ["https://www.w3.org/ns/activitystreams#Public"], type: "Event", updated: "2023-02-12T18:41:48Z", url: "https://example.mobilizon.com/events/11111111-1a1a-2b2b-1s1s-ffffffffffff"}, errors: [], data: #Pleroma.Web.ActivityPub.ObjectValidators.EventValidator<>, valid?: false>}}}}} ``` ### Severity I cannot use it as easily as I'd like ### Have you searched for this issue? - [x] I have double-checked and have not found this issue mentioned anywhere.
gamerfort added the
bug
label 2023-02-12 19:14:34 +00:00
Author

Here is the source in the Mobilizon code that explains all of the "types" of PropertyValues that it will use in the attachment fields.

https://framagit.org/framasoft/mobilizon/-/blob/main/js/src/services/EventMetadata.ts

Ex from attached sample above:

"attachment":
    [
        {
            "propertyID": "mz:live:twitch:url",
            "type": "PropertyValue",
            "value": "https://www.twitch.tv/examplestreamer"
        },

This comes from this part in the Mobilizon code:

{
    icon: "twitch",
    key: "mz:live:twitch:url",
    label: t("Twitch live") as string,
    description: t("The URL where the event can be watched live") as string,
    value: "",
    type: EventMetadataType.STRING,
    keyType: EventMetadataKeyType.URL,
    placeholder: "https://www.twitch.tv/",
    pattern: /^(?:https?:\/\/)?(?:www\.|go\.)?twitch\.tv\/([a-z0-9_]+)($|\?)/,
    category: EventMetadataCategories.LIVE,
  },

The full list of possible types might make it a little easier to know how to interpret Mobilizon's event data and different types.

Here is the source in the Mobilizon code that explains all of the "types" of PropertyValues that it will use in the attachment fields. https://framagit.org/framasoft/mobilizon/-/blob/main/js/src/services/EventMetadata.ts Ex from attached sample above: ``` "attachment": [ { "propertyID": "mz:live:twitch:url", "type": "PropertyValue", "value": "https://www.twitch.tv/examplestreamer" }, ``` This comes from this part in the Mobilizon code: ``` { icon: "twitch", key: "mz:live:twitch:url", label: t("Twitch live") as string, description: t("The URL where the event can be watched live") as string, value: "", type: EventMetadataType.STRING, keyType: EventMetadataKeyType.URL, placeholder: "https://www.twitch.tv/", pattern: /^(?:https?:\/\/)?(?:www\.|go\.)?twitch\.tv\/([a-z0-9_]+)($|\?)/, category: EventMetadataCategories.LIVE, }, ``` The full list of possible types might make it a little easier to know how to interpret Mobilizon's event data and different types.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: AkkomaGang/akkoma#465
No description provided.