[bug] malformed banners crash retrieving account #538

Closed
opened 2023-05-10 17:03:44 +00:00 by Crafti · 2 comments

Your setup

From source

Extra details

Ubuntu 22.04.2 LTS

Version

fef4bae00

PostgreSQL version

14.7

What were you trying to do?

  • view timeline
  • view status of an user in Admin-FE
  • etc.

What did you expect to happen?

No response

What actually happened?

Akkoma returned 500.

Logs

Error triggered when fetching timeline:

15:25:07.788 request_id=F13RnOkeyEWXkyYAIwei [error] Internal server error: %FunctionClauseError{args: nil, arity: 2, clauses: nil, function: :url_encode64, kind: nil, module: Base}
15:25:07.791 [error] #PID<0.31085.56> running Pleroma.Web.Endpoint (connection #PID<0.30903.56>, stream id 1) terminated
Server: akkoma.0x68756773.moe:80 (http)
Request: GET /api/v1/timelines/home?with_muted=false&reply_visibility=self&limit=20
** (exit) an exception was raised:
    ** (FunctionClauseError) no function clause matching in Base.url_encode64/2
        (elixir 1.12.2) lib/base.ex:457: Base.url_encode64(nil, [padding: false])
        (pleroma 3.7.1) lib/pleroma/web/media_proxy.ex:93: Pleroma.Web.MediaProxy.base64_sig64/1
        (pleroma 3.7.1) lib/pleroma/web/media_proxy.ex:110: Pleroma.Web.MediaProxy.encode_preview_url/2
        (pleroma 3.7.1) lib/pleroma/web/mastodon_api/views/account_view.ex:207: Pleroma.Web.MastodonAPI.AccountView.do_render/2
        (pleroma 3.7.1) lib/pleroma/web/mastodon_api/views/status_view.ex:370: Pleroma.Web.MastodonAPI.StatusView.render/2
        (pleroma 3.7.1) lib/pleroma/web/mastodon_api/views/status_view.ex:159: Pleroma.Web.MastodonAPI.StatusView.render/2
        (elixir 1.12.2) lib/enum.ex:1582: Enum."-map/2-lists^map/1-0-"/2
        (elixir 1.12.2) lib/enum.ex:1582: Enum."-map/2-lists^map/1-0-"/2

Error when fetching affected account through Admin-FE:

Request: GET /api/v1/pleroma/admin/users/AVGJpOuC4NmNXzCbYW/statuses?godmode=false
** (exit) an exception was raised:
    ** (FunctionClauseError) no function clause matching in Base.url_encode64/2
        (elixir 1.12.2) lib/base.ex:457: Base.url_encode64(nil, [padding: false])
        (pleroma 3.7.1) lib/pleroma/web/media_proxy.ex:93: Pleroma.Web.MediaProxy.base64_sig64/1
        (pleroma 3.7.1) lib/pleroma/web/media_proxy.ex:110: Pleroma.Web.MediaProxy.encode_preview_url/2
        (pleroma 3.7.1) lib/pleroma/web/mastodon_api/views/account_view.ex:207: Pleroma.Web.MastodonAPI.AccountView.do_render/2
        (pleroma 3.7.1) lib/pleroma/web/mastodon_api/views/status_view.ex:370: Pleroma.Web.MastodonAPI.StatusView.render/2
        (pleroma 3.7.1) lib/pleroma/web/admin_api/views/status_view.ex:27: Pleroma.Web.AdminAPI.StatusView.render/2
        (elixir 1.12.2) lib/enum.ex:1582: Enum."-map/2-lists^map/1-0-"/2
        (pleroma 3.7.1) lib/pleroma/web/admin_api/views/status_view.ex:17: Pleroma.Web.AdminAPI.StatusView.render/2

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 From source ### Extra details Ubuntu 22.04.2 LTS ### Version fef4bae00 ### PostgreSQL version 14.7 ### What were you trying to do? - view timeline - view status of an user in Admin-FE - etc. ### What did you expect to happen? _No response_ ### What actually happened? Akkoma returned 500. ### Logs Error triggered when fetching timeline: ``` 15:25:07.788 request_id=F13RnOkeyEWXkyYAIwei [error] Internal server error: %FunctionClauseError{args: nil, arity: 2, clauses: nil, function: :url_encode64, kind: nil, module: Base} 15:25:07.791 [error] #PID<0.31085.56> running Pleroma.Web.Endpoint (connection #PID<0.30903.56>, stream id 1) terminated Server: akkoma.0x68756773.moe:80 (http) Request: GET /api/v1/timelines/home?with_muted=false&reply_visibility=self&limit=20 ** (exit) an exception was raised: ** (FunctionClauseError) no function clause matching in Base.url_encode64/2 (elixir 1.12.2) lib/base.ex:457: Base.url_encode64(nil, [padding: false]) (pleroma 3.7.1) lib/pleroma/web/media_proxy.ex:93: Pleroma.Web.MediaProxy.base64_sig64/1 (pleroma 3.7.1) lib/pleroma/web/media_proxy.ex:110: Pleroma.Web.MediaProxy.encode_preview_url/2 (pleroma 3.7.1) lib/pleroma/web/mastodon_api/views/account_view.ex:207: Pleroma.Web.MastodonAPI.AccountView.do_render/2 (pleroma 3.7.1) lib/pleroma/web/mastodon_api/views/status_view.ex:370: Pleroma.Web.MastodonAPI.StatusView.render/2 (pleroma 3.7.1) lib/pleroma/web/mastodon_api/views/status_view.ex:159: Pleroma.Web.MastodonAPI.StatusView.render/2 (elixir 1.12.2) lib/enum.ex:1582: Enum."-map/2-lists^map/1-0-"/2 (elixir 1.12.2) lib/enum.ex:1582: Enum."-map/2-lists^map/1-0-"/2 ``` Error when fetching affected account through Admin-FE: ``` Request: GET /api/v1/pleroma/admin/users/AVGJpOuC4NmNXzCbYW/statuses?godmode=false ** (exit) an exception was raised: ** (FunctionClauseError) no function clause matching in Base.url_encode64/2 (elixir 1.12.2) lib/base.ex:457: Base.url_encode64(nil, [padding: false]) (pleroma 3.7.1) lib/pleroma/web/media_proxy.ex:93: Pleroma.Web.MediaProxy.base64_sig64/1 (pleroma 3.7.1) lib/pleroma/web/media_proxy.ex:110: Pleroma.Web.MediaProxy.encode_preview_url/2 (pleroma 3.7.1) lib/pleroma/web/mastodon_api/views/account_view.ex:207: Pleroma.Web.MastodonAPI.AccountView.do_render/2 (pleroma 3.7.1) lib/pleroma/web/mastodon_api/views/status_view.ex:370: Pleroma.Web.MastodonAPI.StatusView.render/2 (pleroma 3.7.1) lib/pleroma/web/admin_api/views/status_view.ex:27: Pleroma.Web.AdminAPI.StatusView.render/2 (elixir 1.12.2) lib/enum.ex:1582: Enum."-map/2-lists^map/1-0-"/2 (pleroma 3.7.1) lib/pleroma/web/admin_api/views/status_view.ex:17: Pleroma.Web.AdminAPI.StatusView.render/2 ``` ### 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.
Crafti added the
bug
label 2023-05-10 17:03:44 +00:00
Author

With this SQL query affected accounts can be found:

select nickname, banner, is_active, updated_at from public.users u where is_active and u.banner is not null and u.banner <> '{}' and u.banner ->> 'url' not like '%"href": "%';

All affected accounts were from bird.makeup and had {"url": [{"href": null}], "type": "Image"} as their banner value.

With this SQL query affected accounts can be found: ``` select nickname, banner, is_active, updated_at from public.users u where is_active and u.banner is not null and u.banner <> '{}' and u.banner ->> 'url' not like '%"href": "%'; ``` All affected accounts were from bird.makeup and had `{"url": [{"href": null}], "type": "Image"}` as their banner value.

this was fixed in 3.8.0, you are using an old version

0c77be9308

this was fixed in 3.8.0, you are using an old version https://akkoma.dev/AkkomaGang/akkoma/commit/0c77be9308102cb2e4710fbad02035e9dc7125c3
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#538
No description provided.