[bug] Potentially malformed status passes nil url to media proxy function breaking the timeline #482

Closed
opened 2023-02-21 16:26:52 +00:00 by floogulinc · 5 comments

Your setup

OTP

Extra details

Ubuntu 22.04

Version

2023.02 (3.6.0-0-g71d0899)

PostgreSQL version

14.6 (Ubuntu 14.6-0ubuntu0.22.04.1)

What were you trying to do?

View my home timeine or the user who has what seems to be a malformed status. I cannot find specifcally which status it is because of the errors. The user that seems to have this bad status is from https://bird.makeup/.

What did you expect to happen?

The API calls to reutrn normally.

What actually happened?

/api/v1/accounts/{id}/statuses and /api/v1/timelines/home return 500:

{"errors":{"detail":"Internal server error"}}

Logs

15:54:39.990 request_id=F0Xh9U2XA3GWQXsAMa0h [error] Internal server error: %FunctionClauseError{module: Base, function: :url_encode64, arity: 2, kind: nil, args: nil, clauses: nil}
15:54:39.990 [error] #PID<0.20691.13> running Pleroma.Web.Endpoint (connection #PID<0.20612.13>, stream id 9) terminated
Server: <DOMAIN> (http)
Request: GET /api/v1/accounts/ASWLX60KI3qY4WqZbU/statuses?with_muted=true&exclude_replies=1&limit=20
** (exit) an exception was raised:
    ** (FunctionClauseError) no function clause matching in Base.url_encode64/2
        (elixir 1.14.3) lib/base.ex:415: Base.url_encode64(nil, [padding: false])
        (pleroma 3.6.0-0-g71d0899) lib/pleroma/web/media_proxy.ex:93: Pleroma.Web.MediaProxy.base64_sig64/1
        (pleroma 3.6.0-0-g71d0899) lib/pleroma/web/media_proxy.ex:110: Pleroma.Web.MediaProxy.encode_preview_url/2
        (pleroma 3.6.0-0-g71d0899) lib/pleroma/web/mastodon_api/views/account_view.ex:207: Pleroma.Web.MastodonAPI.AccountView.do_render/2
        (pleroma 3.6.0-0-g71d0899) lib/pleroma/web/mastodon_api/views/status_view.ex:368: Pleroma.Web.MastodonAPI.StatusView.render/2
        (pleroma 3.6.0-0-g71d0899) lib/pleroma/web/mastodon_api/views/status_view.ex:159: Pleroma.Web.MastodonAPI.StatusView.render/2
        (elixir 1.14.3) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2
        (phoenix_view 2.0.2) lib/phoenix_view.ex:557: Phoenix.View.render_to_iodata/3

Severity

I cannot use the software

Have you searched for this issue?

  • I have double-checked and have not found this issue mentioned anywhere.
### Your setup OTP ### Extra details Ubuntu 22.04 ### Version 2023.02 (3.6.0-0-g71d0899) ### PostgreSQL version 14.6 (Ubuntu 14.6-0ubuntu0.22.04.1) ### What were you trying to do? View my home timeine or the user who has what seems to be a malformed status. I cannot find specifcally which status it is because of the errors. The user that seems to have this bad status is from https://bird.makeup/. ### What did you expect to happen? The API calls to reutrn normally. ### What actually happened? /api/v1/accounts/{id}/statuses and /api/v1/timelines/home return 500: ```json {"errors":{"detail":"Internal server error"}} ``` ### Logs ``` 15:54:39.990 request_id=F0Xh9U2XA3GWQXsAMa0h [error] Internal server error: %FunctionClauseError{module: Base, function: :url_encode64, arity: 2, kind: nil, args: nil, clauses: nil} 15:54:39.990 [error] #PID<0.20691.13> running Pleroma.Web.Endpoint (connection #PID<0.20612.13>, stream id 9) terminated Server: <DOMAIN> (http) Request: GET /api/v1/accounts/ASWLX60KI3qY4WqZbU/statuses?with_muted=true&exclude_replies=1&limit=20 ** (exit) an exception was raised: ** (FunctionClauseError) no function clause matching in Base.url_encode64/2 (elixir 1.14.3) lib/base.ex:415: Base.url_encode64(nil, [padding: false]) (pleroma 3.6.0-0-g71d0899) lib/pleroma/web/media_proxy.ex:93: Pleroma.Web.MediaProxy.base64_sig64/1 (pleroma 3.6.0-0-g71d0899) lib/pleroma/web/media_proxy.ex:110: Pleroma.Web.MediaProxy.encode_preview_url/2 (pleroma 3.6.0-0-g71d0899) lib/pleroma/web/mastodon_api/views/account_view.ex:207: Pleroma.Web.MastodonAPI.AccountView.do_render/2 (pleroma 3.6.0-0-g71d0899) lib/pleroma/web/mastodon_api/views/status_view.ex:368: Pleroma.Web.MastodonAPI.StatusView.render/2 (pleroma 3.6.0-0-g71d0899) lib/pleroma/web/mastodon_api/views/status_view.ex:159: Pleroma.Web.MastodonAPI.StatusView.render/2 (elixir 1.14.3) lib/enum.ex:1658: Enum."-map/2-lists^map/1-0-"/2 (phoenix_view 2.0.2) lib/phoenix_view.ex:557: Phoenix.View.render_to_iodata/3 ``` ### Severity I cannot use the software ### Have you searched for this issue? - [x] I have double-checked and have not found this issue mentioned anywhere.
floogulinc added the
bug
label 2023-02-21 16:26:52 +00:00
Contributor

having this same problem on my instance right now. @floogulinc, did you figure out a workaround for this or did you just wait for the problem to go away?

... or is it still occurring?

having this same problem on my instance right now. @floogulinc, did you figure out a workaround for this or did you just wait for the problem to go away? ... or is it still occurring?
Contributor

as a temporary workaround, disabling the media proxy makes the timeline work again

as a temporary workaround, disabling the media proxy makes the timeline work again
Contributor

the media preview proxy specifically

the media preview proxy specifically
Contributor

i think i've found the culprit. my instance has a user record in its database with a banner value of %{"type" => "Image", "url" => [%{"href" => nil}]}. with the media preview proxy enabled, that user's profile reliably fails to render and breaks my home timeline when a post of theirs shows up.

aside: this was a major pain to debug because for some reason akkoma/phoenix wouldn't produce a full stack trace from 500's thrown while rendering the timeline, but i did get a full stack trace when visiting the users profile directly.

i think i've found the culprit. my instance has a user record in its database with a banner value of `%{"type" => "Image", "url" => [%{"href" => nil}]}`. with the media preview proxy enabled, that user's profile reliably fails to render and breaks my home timeline when a post of theirs shows up. aside: this was a major pain to debug because for some reason akkoma/phoenix wouldn't produce a full stack trace from 500's thrown while rendering the timeline, but i did get a full stack trace when visiting the users profile directly.
Author

having this same problem on my instance right now. @floogulinc, did you figure out a workaround for this or did you just wait for the problem to go away?

... or is it still occurring?

well the post thay was causing the problem just eventually ended up down the timeline enough to not be as much of a problem but it's still there if I scroll enough or try to view posts in the admin view. Including what you've said this seems to be a general issue when an image url is nill or perhaps another malformed value, in this case as part of a post and in your case a banner or avatar.

> having this same problem on my instance right now. @floogulinc, did you figure out a workaround for this or did you just wait for the problem to go away? > > ... or is it still occurring? well the post thay was causing the problem just eventually ended up down the timeline enough to not be as much of a problem but it's still there if I scroll enough or try to view posts in the admin view. Including what you've said this seems to be a general issue when an image url is nill or perhaps another malformed value, in this case as part of a post and in your case a banner or avatar.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 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#482
No description provided.