Commit graph

16017 commits

Author SHA1 Message Date
Oneric
c3d163d34d Merge pull request 'mediaproxy: proxy network-path references' (#903) from Oneric/akkoma:mediaproxy_networkpathref into develop
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/903
2025-05-09 20:13:55 +00:00
Oneric
8cdfbf872d Merge pull request 'federation/out: tweak publish retry backoff' (#884) from Oneric/akkoma:publish_backoff into develop
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/884
2025-05-09 20:12:56 +00:00
Oneric
13940a558a Merge pull request 'Expose stats about finally failed AP deliveries in prometheus' (#882) from Oneric/akkoma:telemetry-failed-deliveries into develop
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/882
2025-05-09 20:12:01 +00:00
Oneric
aac5493dd5 Merge pull request 'Don’t pretend internal actors have follow(er|ing) collections' (#856) from Oneric/akkoma:fetch-actor-follow-collections into develop
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/856
2025-05-09 20:10:41 +00:00
Oneric
d6f5f4db18 Merge pull request 'receiver_worker: prevent duplicate jobs' (#886) from Oneric/akkoma:receive_dedupe into develop
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/886
2025-05-09 19:13:14 +00:00
floatingghost
fffac8bc7c Merge pull request 'Always prefer shared inbox' (#881) from Oneric/akkoma:shared-inbox into develop
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/881
2025-05-09 16:54:19 +00:00
floatingghost
9a46685e64 Merge pull request 'Set cleanup_attachments to true by default' (#910) from norm/akkoma:cleanup-attachments-default-true into develop
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/910
Reviewed-by: Oneric <oneric@noreply.akkoma>
2025-05-09 16:49:49 +00:00
Norm
8712e06d27 Set cleanup_attachments to true by default
Since bcfbfbcff5 (part of
<https://akkoma.dev/AkkomaGang/akkoma/pulls/789>), the overhead for
cleaning up orphaned attachments has been drattically reduced.

Most admins are unaware of this option even existing, but may notice an
increase in the size of the uploads directory (or S3 bucket size if used
instead) even if auto-expiring posts are used. This should hopefully
make this problem more manageable.

For those that still encounter performance issues, the setting can still
be disabled if needed.
2025-05-08 18:12:56 -04:00
Oneric
a80444041c federation: always prefer the shared inbox
In theory a pedantic reading of the spec indeed suggests
DMs must only be delivered to personal inboxes. However,
in practice the normative force of real-world implementations
disagrees. Mastodon, Iceshrimp.NET and GtS (the latter notably has a
config option to never use sharedInboxes) all unconditionally prefer
sharedInbox for everything without ill effect. This saves on duplicate
deliveries on the sending and processing on the receiving end.
(Typically the receiving side ends up rejecting
 all but the first copy as duplicates)

Furthermore current determine_inbox logic also actually needs up
forcing personal inboxes for follower-only posts, unless they
additionally explicitly address at least one specific actor.
This is even much wasteful and directly contradicts
the explicit intent of the spec.

There’s one part where the use of sharedInbox falls apart,
namely spec-compliant bcc and bto addressing. AP spec requires
bcc/bto fields to be stripped before delivery and then implicitly
reconstructed by the receiver based on the addressed personal inbox.
In practice however, this addressing mode is almost unused. Neither of
the three implementations brought up above supports it and while *oma
does use bcc for list addressing, it does not use it in a spec-compliant
way and even copies same-host recipients into cc before delivery.
Messages with bcc addressing are handled in another function clause,
always force personal inboxes for every recipient and not affected by
this commit.
In theory it would be beneficial to use sharedInbox there too for all
but bcc recipients. But in practice list addressing has been broken for
quite some time already and is not actually exposed in any frontend,
as discussed in https://akkoma.dev/AkkomaGang/akkoma/issues/812.
Therefore any changes here have virtually no effect anyway
and all code concerning it may just be outright removed.
2025-05-06 17:38:24 +02:00
Oneric
0d38385d6f publisher: don't mangle between string and atom
Oban jobs only can have string args and there’s no reason to insist on atoms here.

Plus this used unchecked string_to_atom
2025-05-06 17:38:18 +02:00
Oneric
6b97f085d8 Refresh mix.lock
Fixes omission in 936be4edbb
2025-05-06 17:24:58 +02:00
Oneric
818ddeca84 Merge pull request 'add instruction to make asdf work when logging into it with sudo' (#894) from shadowjonathan/akkoma:add-sudo-asdf into develop
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/894
2025-05-05 20:45:50 +00:00
floatingghost
f0653efe13 Merge pull request 'Fix Pleroma’s unlisted posts' (#885) from Oneric/akkoma:pleroma_unlisted into develop
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/885
2025-05-02 22:26:59 +00:00
floatingghost
cb51d69108 Merge pull request 'deps: upgrade flake_id to fix crash' (#906) from Oneric/akkoma:fix_flake_crash into develop
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/906
Reviewed-by: floatingghost <hannah@coffee-and-dreams.uk>
2025-05-02 22:26:41 +00:00
Oneric
936be4edbb deps: upgrade flake_id to fix crash
Currently FlakeId.flake_id crashes if receiving non-UTF-8 binaries,
but we use it e.g. in the /:nick_or_id path used in akkoma-fe user
profiles.
With the upgrade such invalid binaries simply fail the id check.

Reported-in: https://meta.akkoma.dev/t/frontend-unicodeconversionerror/847
2025-05-02 21:46:04 +02:00
Jonathan de Jong
bb50e9050b rearrange shims 2025-04-26 16:17:31 +02:00
Oneric
bbf974adc8 mediaproxy: proxy network-path references
Discovered-by: snow
Fixes: https://akkoma.dev/AkkomaGang/akkoma/issues/900
2025-04-18 01:50:27 +02:00
Oneric
1f6f5edf85 telemetry: expose stats about failed deliveries
And also log about it which we so far didn't do
2025-04-15 19:41:12 +02:00
Oneric
2fee79e1f5 Use apropriate cancellation type for oban jobs
:discard marks jobs as "discarded", i.e. jobs which permanently failed
due to e.g. exhausting all retries or explicitly being discared due to a
fatal error.
:cancel marks jobs as "cancelled" which does not imply failure.

While neither method counts as a job "exception" in the set of
telemetries we currently export via Prometheus, the different state
is visible in the (not-exported) metadata of oban job telemetry.
We can use handlers of those events to build bespoke statistics.

Ideally we'd like to distinguish in the receiver worker between
"invalid" and "already present or delete of unknown" documents,
but this is cumbersome to get get right with a list of
free-form, human-readable descriptions oof the violated constraints.
For now, just count both as an fatal error.
        # but that is cumbersome to get right with a list of string error descriptions
2025-04-15 19:40:26 +02:00
floatingghost
6a6d4254d5 Merge pull request 'api/statuses: allow expires_in to override user-level status_ttl_default' (#899) from Oneric/akkoma:expires_in_overriding_default_status_ttl into develop
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/899
2025-04-09 12:24:26 +00:00
Oneric
984e5a121a api/statuses: allow expires_in to override user-level status_ttl_default
Fixes: https://akkoma.dev/AkkomaGang/akkoma/issues/898
2025-04-08 23:43:59 +02:00
Jonathan de Jong
64e7f25252 add instruction to make asdf work when logging into it with sudo 2025-03-31 13:27:25 +02:00
floatingghost
ff3aaa73ee Merge pull request 'exiftool/strip: hide warnings from log' (#883) from Oneric/akkoma:exiftool-hide-warning into develop
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/883
2025-03-31 10:28:55 +00:00
floatingghost
3d032493eb Merge pull request 'fix: docs: arch linux split erlang package' (#879) from a/akkoma:develop into develop
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/879
2025-03-31 10:27:26 +00:00
Oneric
caf6b4606f Fix representaton of internal actors
CUrrently internal actors are supposed to be identified in the database
by either a NULL nickname or a nickname prefixed by "internal.". For old
installations this is true, but only if they were created over five
years ago before 70410dfafd.
Newer installations will use "relay" as the nickname of the realy actor
causing ii to be treated as a regular user.

In particular this means all installations in the last five years never
made use of the reduced endpoint case, thus it is dropped.

Simplify this distinction by properly marking internal actors asa an
Application type in the database. This was already implemented before by
ilja in https://akkoma.dev/AkkomaGang/akkoma/pulls/457 but accidentally
reverted during a translation update in
eba3cce77b. This commit effectively
restores this patch together with further changes.

Also service actors unconditionally expose follow* collections atm,
eventhough the internal fetch actor doesn't actually implement them.
Since they are optional per spec and with Mastodon omitting them too
for its instance actor proving the practical viability, we should just
omit them. The relay actor however should continue to expose such
collections and they are properly implemented here.
Here too we now just use the values or their absence in the database.

We do not have any other internal.* actors besides fetch atm.

Fixes: https://akkoma.dev/AkkomaGang/akkoma/issues/855

Co-authored-by: ilja space <git@ilja.space>
2025-03-26 17:14:28 +01:00
Oneric
b58b6af3ba cosmetic: adapt software name in internal actor descriptions 2025-03-26 05:03:18 +01:00
a
ab9a4ce0d5 remove specific split packages, refer only to erlang-headless or erlang 2025-03-19 20:15:57 +00:00
a
699c051101 erlang-headless now exists 2025-03-19 03:15:07 +00:00
Oneric
195042bdc9 receiver_worker: prevent duplicate jobs
E.g. \*oma federates (most) follower-only posts multiple times
to each personal inbox. This commonly leads to race conditions
with jobs of several copies running at the same time and getting
past the initial "already known" check but then later all but
one will crash with an exception from the unique db index.

Since the only special thing we do with copies anyway is to discard them,
just don't create such duplicate jobs in the first place.
For the same reason and since failed jobs don't count towards
duplicates, this should have virtually no effect on federation.
2025-03-18 03:46:33 +01:00
Oneric
7ffbe2ad26 upload/filter/exiftool/strip: hide warnings from log 2025-03-18 01:01:47 +01:00
Oneric
0abe01be2e federation/in: always copy object addressing into its Create activity
Since we later only consider the Create activity for
access permission checks, but the semantically more
sensible set of fields are the object’s.

Changing the check itself to use the object may have unintended
consequences on already existing legacy posts as the old code
which processed it when it arrived may have never considered
effects on the objects addressing fields.
2025-03-17 23:08:27 +01:00
Oneric
cdf576b951 federation/in: fix activity addressing of Pleroma unlisted
While the object itself has the expected adressing for an
"unlisted" post, we always use the Create activity’s
adressing fields for permission checks.

To avoid unintended effects on legacy objects
we will continue to use the activity for access perm checks,
but fix its addressing fields based on its object data.

Ref: https://git.pleroma.social/pleroma/pleroma/-/issues/3323
2025-03-17 23:06:16 +01:00
Oneric
4011d20dbe federation/out: tweak publish retry backoff
With the current strategy the individual
and cumulative backoff looks like this
(the + part denotes max extra random delay):

attempt  backoff_single   cumulative
   1      16+30                16+30
   2      47+60                63+90
   3     243+90  ≈ 4min       321+180
   4    1024+120 ≈17min      1360+300  ≈23+5min
   5    3125+150 ≈20min      4500+450  ≈75+8min
   6    7776+180 ≈ 2.1h    12291+630   ≈3.4h
   7   16807+210 ≈ 4.6h    29113+840   ≈8h
   8   32768+240 ≈ 9.1h    61896+1080  ≈17h
   9   59049+270 ≈16.4h   120960+1350  ≈33h
  10  100000+300 ≈27.7h   220975+1650  ≈61h

We default to 5 retries meaning the least backoff runs with attempt=4.
Therefore outgoing activiities might already be permanently dropped by a
downtime of only 23 minutes which doesn't seem too implausible to occur.
Furthermore it seems excessive to retry this quickly this often at the
beginning.
At the same time, we’d like to have at least one quick'ish retry to deal
with transient issues and maintain reasonable federation responsiveness.

If an admin wants to tolerate one -day downtime of remotes,
retries need to be almost doubled.

The new backoff strategy implemented in this commit instead
switches to an exponetial after a few initial attempts:

attempt  backoff_single   cumulative
   1      16+30              16+30
   2     143+60             159+90
   3    2202+90  ≈37min    2361+180 ≈40min
   4    8160+120 ≈ 2.3h   10521+300 ≈ 3h
   5   77393+150 ≈21.5h   87914+450 ≈24h

Initial retries are still fast, but the same amount of retries
now allows a remote downtime of at least 40 minutes. Customising
the retry count to 5 allows for whole-day downtimes.
2025-03-17 19:37:54 +01:00
a
dcfae9bfbf erlang-os_mon as well 2025-03-12 20:27:27 +00:00
a
efb901bdb5 fix: docs: arch linux split erlang package 2025-03-12 20:15:34 +00:00
Floatingghost
74182abb5b bump version 2025-03-11 20:48:27 +00:00
floatingghost
0a9cf8fa8b Merge pull request 'Test lowest and highest language versions, elixir 1.18 support' (#875) from ci-testing-all-versions into develop
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/875
2025-03-11 20:47:54 +00:00
Oneric
066d5b48ed Fix Content-Type sanitisation for emoji and local uploads
This was accidentally broken in c8e0f7848b
due to a one-letter mistake in the plug option name and an absence of
tests. Therefore it was once again possible to serve e.g. Javascript or
CSS payloads via uploads and emoji.
However due to other protections it was still NOT possible for anyone to
serve any payload with an ActivityPub Content-Type. With the CSP policy
hardening from previous JS payload exloits predating the Content-Type
sanitisation, there is currently no known way of abusing this weakened
Content-Type sanitisation, but should be fixed regardless.

This commit fixes the option name and adds tests to ensure
such a regression doesn't occur again in the future.

Reported-by: Lain Soykaf <lain@lain.com>
2025-03-10 19:45:26 +01:00
Floatingghost
4a05b2d643 we do actually want to start oban-met... 2025-03-02 13:36:52 +00:00
Floatingghost
93200a8073 use latest ASDF instructions 2025-03-02 13:36:14 +00:00
Floatingghost
41a4ed1db5 specify correct version 2025-03-02 13:17:52 +00:00
Floatingghost
8e789c6236 1.14.1 min version 2025-03-02 13:07:03 +00:00
Floatingghost
184c62359f drop back to 1.14/OTP25 2025-03-02 13:04:10 +00:00
Floatingghost
829af03042 we don't support otp24, bump to 25 2025-03-02 12:19:14 +00:00
Floatingghost
842414b927 run the lint task on the latest version 2025-03-02 11:56:15 +00:00
Floatingghost
f176294d6d elixir 1.18 formatting 2025-03-02 11:54:00 +00:00
Floatingghost
b1c0b9e01a test lowest and highest supported versions on PR 2025-03-02 11:49:41 +00:00
Floatingghost
fc2c740008 dependency upgrade 2025-03-02 11:34:09 +00:00
Floatingghost
9da2cb881e upgrade oban migrations to v12 2025-03-02 11:32:40 +00:00
Floatingghost
522a168af6 force signatures for pinned posts 2025-03-01 17:27:45 +00:00