Commit graph

14185 commits

Author SHA1 Message Date
Pierre-Louis Bonicoli 05c21ac191
hackney adapter helper & reverse proxy client: enable TLSv1.3
The list of TLS versions was added by
8bd2b6eb13 when hackney version was
pinned to 1.15.2. Later hackney version was upgraded
(166455c884) but the list of TLS
versions wasn't removed. From the hackney point of view, this list has
been replaced by the OTP defaults since 0.16.0
(734694ea4e24f267864c459a2f050e943adc6694).

It looks like the same issue already occurred before:
0cb7b0ea84.

A way to test this issue (where example.com is an ActivityPub site
which uses TLSv1.3 only):

   $ PLEROMA_CONFIG_PATH=/path/to/config.exs pleroma start_iex
   Erlang/OTP 22 [erts-10.7.2.16] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]

   Erlang/OTP 22 [erts-10.7.2.16] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]

   Interactive Elixir (1.10.4) - press Ctrl+C to exit (type h() ENTER for help)
   iex(pleroma@127.0.0.1)2> Pleroma.Object.Fetcher.fetch_and_contain_remote_object_from_id("https://example.com/@/Nick/")
   {:error,
    {:tls_alert,
     {:protocol_version,
      'TLS client: In state hello received SERVER ALERT: Fatal - Protocol Version\n'}}}

With this patch, the output is the expected one:

   iex(pleroma@127.0.0.1)3> Pleroma.Object.Fetcher.fetch_and_contain_remote_object_from_id("https://example.com/@/Nick/")
   {:error,
   {:ok,
    %{
      "@context" => [
        "https://www.w3.org/ns/activitystreams",
        "https://w3id.org/security/v1",
        %{
          "Emoji" => "toot:Emoji",
          "Hashtag" => "as:Hashtag",
          "atomUri" => "ostatus:atomUri",
          "conversation" => "ostatus:conversation",
          "featured" => "toot:featured",
          "focalPoint" => %{"@container" => "@list", "@id" => "toot:focalPoint"},
          "inReplyToAtomUri" => "ostatus:inReplyToAtomUri",
          "manuallyApprovesFollowers" => "as:manuallyApprovesFollowers",
          "movedTo" => "as:movedTo",
          "ostatus" => "http://ostatus.org#",
          "sensitive" => "as:sensitive",
          "toot" => "http://joinmastodon.org/ns#"
        }
      ],
      "endpoints" => %{"sharedInbox" => "https://example.com/inbox"},
      "followers" => "https://example.com/@/Nick/followers",
      "following" => nil,
      "icon" => %{
        "type" => "Image",
        "url" => "https://example.com/static/media/[...].png"
      },
      "id" => "https://example.com/@/Nick/",
      "inbox" => "https://example.com/@/Nick/inbox",
      "liked" => nil,
      "name" => "Nick",
      "outbox" => "https://example.com/@/Nick/outbox",
      "preferredUsername" => "Nick",
      "publicKey" => %{
        "id" => "https://example.com/@/Nick/#main-key",
        "owner" => "https://example.com/@/Nick/",
        "publicKeyPem" => "[...]
      },
      "summary" => "",
      "type" => "Person",
      "url" => "https://example.com/@/Nick/"
    }}

A way to test the reverse proxy bits of this issue (where example.com allows TLSv1.3 only):

    iex(pleroma@127.0.0.1)1> Pleroma.ReverseProxy.Client.Hackney.request("GET", "https://example.com", [], [])
    {:error,
     {:tls_alert,
      {:protocol_version,
       'TLS client: In state hello received SERVER ALERT: Fatal - Protocol Version\n'}}}
2022-06-11 13:59:14 +02:00
Sam Therapy bbfcb44083
Add more reacts to MRF
Signed-off-by: Sam Therapy <sam@samtherapy.net>
2022-05-30 15:36:54 +02:00
Pete 6a3a0270a2
Add index hotspots
squash
2022-05-26 20:08:17 +02:00
lewdthewides 45fd8e2521
Instruct users to run 'git pull' as the pleroma user 2022-05-26 20:06:41 +02:00
Hélène bb768244a4
StealEmojiPolicy: fix String rejected_shortcodes
* rejected_shortcodes is defined as a list of strings in the
  configuration description. As such, database-based configuration was
  led to handle those settings as strings, and not as the actually
  expected type, Regex.
* This caused each message passing through this MRF, if a rejected
  shortcode was set and the emoji did not exist already on the instance,
  to fail federating, as an exception was raised, swiftly caught and
  mostly silenced.
* This commit fixes the issue by introducing new behavior: strings are
  now handled as perfect matches for an emoji shortcode (meaning that if
  the emoji-to-be-pulled's shortcode is in the blacklist, it will be
  rejected), while still supporting Regex types as before.
2022-05-26 20:06:41 +02:00
Ilja 75169a45f6
Also use actor_type to determine if an account is a bot in antiFollowbotPolicy 2022-05-09 10:44:43 -05:00
Haelwenn (lanodan) Monnier 7b25571fb8
mix: Bump to 2.4.52 for 2.4.3 mergeback 2022-05-09 10:44:43 -05:00
Tusooa Zhu ecf4e51849
Skip cache when /objects or /activities is authenticated
Ref: fix-local-public
2022-05-09 10:44:43 -05:00
Tusooa Zhu 370a241dbc
Allow to skip cache in Cache plug
Ref: fix-local-public
2022-05-09 10:44:43 -05:00
Ilja 0fe674d898
update sweet_xml [Security] 2022-05-09 10:44:43 -05:00
Tusooa Zhu f52283004b
Fix incorrect fallback when English is set to first language 2022-05-09 10:44:43 -05:00
Ilja d48ade7629
Fix eratic test for POST /api/pleroma/admin/reports/:id/notes
It retrieved two ReportNotes and then checked one of them. But the order isn't guaranteed, while the test tested on the content of the first ReportNote.

I made the test on the content more generic
2022-05-09 10:44:43 -05:00
Tusooa Zhu 57faa36243
Support fallbacking to other languages 2022-05-09 10:44:43 -05:00
Tusooa Zhu ed9681270e
Lint 2022-05-09 10:44:43 -05:00
Tusooa Zhu 20c6b3c597
Support multiple locales from userLanguage cookie 2022-05-09 10:44:43 -05:00
Tusooa Zhu f3b7ee7836
Support multiple locales formally
elixir gettext current does not fully support fallback to another language [0].
But it might in the future. We adapt it so that all languages in Accept-Language
headers are received by Pleroma.Web.Gettext. User.languages is now a comma-separated
list.

[0]: https://github.com/elixir-gettext/gettext/issues/303
2022-05-09 10:44:43 -05:00
Tusooa Zhu ef1a046a2d
Make lint happy 2022-05-09 10:44:43 -05:00
Tusooa Zhu 2b8a625083
Add test for fallbacking to a general language 2022-05-09 10:44:43 -05:00
Tusooa Zhu 3e5bfa03d0
Fallback to a variant if the language in general is not supported
For an example, here, zh is not supported, but zh_Hans and zh_Hant
are. If the user asks for zh, we should choose a variant for them
instead of fallbacking to default.

Some browsers (e.g. Firefox) does not allow users to customize
their language codes. For example, there is no zh-Hans, but only
zh, zh-CN, zh-TW, zh-HK, etc. This provides a workaround for
those users suffering from bad design decisions.
2022-05-09 10:44:43 -05:00
Tusooa Zhu 887720158f
Add changelog 2022-05-09 10:44:43 -05:00
Tusooa Zhu d3c818700f
Document API addition 2022-05-09 10:44:43 -05:00
Tusooa Zhu d831e57089
Allow user to register with custom language 2022-05-09 10:44:43 -05:00
Tusooa Zhu 4157fe8e11
Allow update_credentials to update User.language 2022-05-09 10:44:43 -05:00
Tusooa Zhu 8e1d3b5591
Send emails i18n'd using backend-stored user language 2022-05-09 10:44:43 -05:00
Tusooa Zhu a4d9251cab
Make all emails translatable 2022-05-09 10:44:43 -05:00
Tusooa Zhu 7e05ec625d
Fix digest test 2022-05-09 10:44:43 -05:00
Tusooa Zhu dff9733943
Make mail and mailer translatable 2022-05-09 10:44:43 -05:00
Tusooa Zhu c7dff104ea
Make static fe translatable 2022-05-09 10:44:43 -05:00
Tusooa Zhu be33d11d69
Fix tests 2022-05-09 10:44:43 -05:00
Tusooa Zhu 87d54a0ab0
Make mfa pages translatable 2022-05-09 10:44:43 -05:00
Tusooa Zhu 5c674211ea
Make oauth pages translatable 2022-05-09 10:44:43 -05:00
Tusooa Zhu 0ffb91a2d3
Use proper lang attributes in htmls 2022-05-09 10:44:43 -05:00
Tusooa Zhu 95b905443c
Make tag feed translatable 2022-05-09 10:44:43 -05:00
Tusooa Zhu 7b467dd955
Make password reset pages translatable 2022-05-09 10:44:43 -05:00
Tusooa Zhu ece007c6f9
Make lint happy 2022-05-09 10:44:43 -05:00
Tusooa Zhu 4446fc675b
Extract translatable text 2022-05-09 10:44:43 -05:00
Tusooa Zhu 304fad22b2
Make remote follow pages translatable 2022-05-09 10:44:43 -05:00
Tusooa Zhu 2e69846e65
Prefer userLanguage cookie over Accept-Language header in detecting locale
https://git.pleroma.social/pleroma/pleroma-meta/-/issues/60
2022-05-09 10:44:43 -05:00
sleepycrow fd551b84b2
Update Caddyfile to Caddy v2 2022-05-09 10:44:43 -05:00
Ilja e49d8aba86
After code review
Use patern matching to see if someone was superuser before
2022-05-09 10:44:43 -05:00
Ilja d3ad9e927d
Delete report notifs when demoting from superuser
When someone isn't a superuser any more, they shouldn't see the reporsts any more either.
Here we delete the report notifications from a user when that user gets updated from being a superuser to a non-superuser.
2022-05-09 10:44:43 -05:00
Sam Therapy 05facac1a4
ReactToLike: add missing emojis, make the log clear 2022-03-19 18:39:10 +01:00
Sam Therapy 5e7e56e305
Add a react to like MRF
Signed-off-by: Sam Therapy <sam@samtherapy.net>
2022-03-19 18:09:22 +01:00
Haelwenn (lanodan) Monnier 46da3d8168
mix: Check .git presence 2022-03-19 16:57:39 +01:00
Ilja 28c37dc386
Fix test get_user_apps/1
For some reason I had a test who suddenly failed, mix test test/pleroma/web/o_auth/app_test.exs:54. A user has a list of applications and this test adds them and then sees if the list it gets back is the same as the apps it added.

When I ran mix test a day before I didn't have this problem and when I pushed code today in a different MR, the pipeline succeeded (see https://git.pleroma.social/ilja/pleroma/-/jobs/205827), yet locally it failed. So it seems the test can sometimes succeed and sometimes fail, which makes it untrustworthy.

The failure I see is because the returned list is in reverse order. I assume that's not per sé wrong. You just want to know if the apps you added are actually there. I fixed the test by first ordering the lists before comparing.

AFAICT (and as far as that's relevant) the test got introduced in commit cb2a072e62
2022-03-19 16:57:38 +01:00
feld 9d518b65fd
Revert "Merge branch 'revert/notice-routes' into 'develop'"
This reverts merge request !3576
2022-03-05 00:34:01 +01:00
Sean King 2842684e81
Revert "Merge branch 'notice-routes' into 'develop'" 2022-03-05 00:34:00 +01:00
Sam Therapy a665b34769
Add unicode 14 support
and add a test with a unicode 14 emoji
2022-02-21 17:27:22 -06:00
Sam Therapy 12d45faa0d
Unicode 14.0 support 2022-02-21 12:16:06 -06:00
Sam Therapy 0fb1684fb7
Update copyright, also
https://codeberg.org/newroma-dev/newroma/pulls/12

Signed-off-by: Sam Therapy <sam@samtherapy.net>
2022-02-12 11:53:32 -06:00