Commit graph

10,792 commits

Author SHA1 Message Date
Henry Jameson
bcc8b1e296 Mark currently accessing token in oauth token management API 2026-11-05 16:16:38 +02:00
lain
2c872cf474 Merge branch 'develop' into fix/card-skip-quote-link 2026-11-03 18:24:23 +00:00
lain
d2b89f5723 Merge pull request 'Federation: do not federate Undo Block when outgoing_blocks is off' (#8044) from lambadalambda/pleroma:fix/undo-block-outgoing-blocks into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8044
2026-11-02 09:07:03 +00:00
lain
b1c51018a3 Merge pull request 'HTTP: back off from hosts that answer 429 or 503' (#8049) from lambadalambda/pleroma:feat/http-backoff into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8049
2026-11-02 08:38:04 +00:00
Lain Soykaf
4070b7be21
fix(http): back off from the host that answered, and read Unix resets
After a redirect the 429/503 came from the final host, but the backoff
was recorded for the requested one. X-RateLimit-Reset is also accepted
as a Unix timestamp or as seconds.
2026-11-01 17:03:11 +04:00
lain
ec6c522ba6 Merge pull request 'Gun: connect to hosts that only have IPv6 addresses' (#8052) from lambadalambda/pleroma:fix/gun-ipv6-only-hosts into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8052
2026-11-01 12:38:29 +00:00
lain
356daab6af Merge pull request 'Federation: refetch a stale Move target once' (#8051) from lambadalambda/pleroma:fix/move-refetch-target into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8051
2026-11-01 10:56:52 +00:00
lain
23f9484a76 Merge pull request 'Akkoma fixes: context, polls, media proxy, ConfigDB, API params' (#8047) from lambadalambda/pleroma:fix/akkoma-tier2 into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8047
2026-11-01 09:11:11 +00:00
lain
d3495ceead Merge pull request 'Rate limit C2S outbox posts and emoji reactions' (#8042) from lambadalambda/pleroma:fix/c2s-rate-limit into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8042
2026-10-31 16:22:00 +00:00
lain
240bc1be1f Merge pull request 'Search: fetch remote statuses only when resolving is allowed' (#8031) from lambadalambda/pleroma:fix/search-remote-fetch into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8031
2026-10-31 16:20:39 +00:00
lain
2f9252c858 Merge pull request 'CastAndValidate: keep replace_params: false when strict is off' (#8045) from lambadalambda/pleroma:fix/cast-and-validate-cast-opts into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8045
2026-10-31 16:19:35 +00:00
lain
0157ade4d3 Merge pull request 'MRF: match domain rules literally' (#8046) from lambadalambda/pleroma:fix/mrf-domain-regex-escape into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8046
2026-10-31 16:18:35 +00:00
Lain Soykaf
542f8b2aef
fix(media_proxy): do not proxy data: URLs
Ported from Akkoma 7632765b4.

Co-authored-by: nopjmp <nop@unearthly.dev>
2026-10-31 18:47:54 +04:00
Lain Soykaf
13663cba71
fix(mastodon_api): use the Mastodon date format for marker updated_at
Ported from Akkoma 720785b4c.

Co-authored-by: Oneric <oneric@oneric.stub>
2026-10-31 18:47:54 +04:00
Lain Soykaf
d601a94c69
fix(api_spec): drop every unexpected query param in permissive mode
Ported from Akkoma 7e6efb235.

Co-authored-by: Oneric <oneric@oneric.stub>
2026-10-31 18:47:27 +04:00
Lain Soykaf
88a9562a9b
fix(config): skip ConfigDB settings for modules that no longer exist
Ported from Akkoma af7c3fab9; the rescue is in the Ecto type load so
admin input is still validated.

Co-authored-by: FloatingGhost <hannah@coffee-and-dreams.uk>
2026-10-31 18:47:26 +04:00
Lain Soykaf
6f31149d21
fix(gun): connect to hosts that only have IPv6 addresses
Gun resolves host names over IPv4 only unless :inet6 is in tcp_opts.
When the A lookup finds nothing, retry once with :inet6. Gun now runs
under its supervisor, so a failed connect no longer kills the pool
worker through the link; the worker still links after a successful open.
2026-10-31 15:53:51 +04:00
Lain Soykaf
3cd201c365
fix(activitypub): refetch a stale Move target once
A Move usually follows right after the alias was added, and the cached
remote target may not have it yet. Refetch the target when the alias is
missing instead of rejecting the Move. Same issue as Akkoma f18e2ba42.
2026-10-31 15:53:41 +04:00
Lain Soykaf
e0546f188d
fix(activitypub): do not require the personal inbox owner to be addressed
Bridgy Fed delivers Follow and Accept to the personal inbox addressed
only to Public. Any server can already address a local user directly,
so the check gave no protection. Ported from Akkoma 2b885288f.

Co-authored-by: Oneric <oneric@oneric.stub>
2026-10-31 15:37:41 +04:00
Lain Soykaf
654a41b2c9
fix(activitypub): accept emoji reactions with a single tag object
Ported from Akkoma 462225880.

Co-authored-by: Oneric <oneric@oneric.stub>
2026-10-31 15:37:41 +04:00
Lain Soykaf
b29d9d0981
fix(workers): snooze incoming jobs while a host is backed off
With 5 attempts and Oban's short retry delays, an incoming activity from
an unknown actor on a backed-off host was discarded without a request.
ReceiverWorker and SignatureRetryWorker now snooze for up to 2 hours.
Also lowercase backoff host keys and log backed-off user fetches at debug.
2026-10-31 14:35:58 +04:00
Lain Soykaf
8ce283f966
feat(http): back off from hosts that answer 429 or 503
Object fetches and WebFinger stop sending requests to a host until
Retry-After or X-RateLimit-Reset (default 5 minutes, max 1 hour).
Ported from Akkoma's Pleroma.HTTP.Backoff.

Co-authored-by: FloatingGhost <hannah@coffee-and-dreams.uk>
Co-authored-by: Oneric <oneric@oneric.stub>
2026-10-31 14:18:45 +04:00
Lain Soykaf
58a6534a44
fix(media_proxy): serve static previews instead of redirecting to the main host
Ported from Akkoma 4a810bb2e.

Co-authored-by: Oneric <oneric@oneric.stub>
2026-10-31 13:43:59 +04:00
Lain Soykaf
c3fb297b89
fix(activitypub): apply the Note fixups to incoming Questions
Ported from Akkoma 678f6fdb7.

Co-authored-by: Oneric <oneric@oneric.stub>
2026-10-31 13:43:59 +04:00
Lain Soykaf
b486a84fef
fix(context): show local-only replies to local users
Ported from Akkoma 7869030e0.

Co-authored-by: Oneric <oneric@oneric.stub>
2026-10-31 13:43:59 +04:00
Lain Soykaf
7e157d8cc9
fix(mrf): match domain rules literally
Escape the domain so `.` only matches a dot, and use an optional
group for the `*.` prefix, which matches the same hosts without
exponential backtracking. Bad entries now match nothing instead of
raising on every check.
2026-10-31 13:17:50 +04:00
Lain Soykaf
163c49c649
fix(api_spec): pass cast options on the first permissive cast
Without them replace_params: false was ignored when strict is off, so
conn.params got atom keys and RateLimiter params: ["id"] buckets
collapsed to one per user.
2026-10-31 13:12:15 +04:00
Floatingghost
06612c802b
Do not federate undo->block activities
the :do_not_federate checks were omitted from the undo pipeline,
which could lead to them federating.

this commit enforces :outgoing_blocks on undos as well - and
any existing value of :do_not_federate is preserved, if one exists

Akkoma issue 957.

[Pleroma: block/unblock test calls use the Pleroma (blocked, blocker) argument order.]

(cherry picked from commit eca7ed572b8a10a0235fb1a381eac4803614dee4)
2026-10-31 12:36:22 +04:00
Lain Soykaf
db43aec782
fix(search): fetch remote statuses only when resolving is allowed
Status search fetched any http(s) query from its remote server, for
anonymous users, on every result page and with resolve=false, so anyone
could make the server fetch URLs. As in Mastodon and in Pleroma's user
search, fetch only with resolve=true, on the first page, and for
anonymous users only if [:instance, :limit_to_local_content] is false.

Based on Akkoma ca9e33ed2 and 17efec060.

Co-authored-by: Oneric <oneric@oneric.stub>
2026-10-31 12:30:57 +04:00
Lain Soykaf
a4f1300578
fix(pleroma_api): rate limit emoji reactions
The emoji reaction create and delete endpoints had no rate limiter.
Apply :statuses_actions like the other status actions, plus a per-status
:status_id_action bucket ("status_id_action:emoji_react") in the same way
favourite and reblog do.
2026-10-31 11:51:28 +04:00
Lain Soykaf
44adf271c2
fix(activitypub): rate limit C2S outbox posts
POST /users/:nickname/outbox had no rate limiter, so a client could send
unlimited activities through the C2S API. Apply :statuses_actions to
update_outbox. RateLimiter keys buckets by limiter name and user, so the
outbox shares one counter with the Mastodon API status actions and mixing
both APIs does not double the limit.
2026-10-31 11:51:24 +04:00
lain
3e9dc477c9 Merge pull request 'Uploads: replace exiftool with the built-in exif_stripper' (#8028) from lambadalambda/pleroma:feature/exif-stripper into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8028
2026-10-31 07:48:00 +00:00
Lain Soykaf
53b79781da
fix(mastodon_api): rate limit status actions per status id
StatusController keeps string param keys (replace_params: false, since
b8db67daf), so params: [:id] never matched and status_id_action became
one bucket per user across all statuses (3 favourites/reblogs a minute).
2026-10-30 10:40:18 +04:00
lain
160c5c8f7d Merge pull request 'Stats: read peers from the instances table' (#8030) from lambadalambda/pleroma:perf/stats-peers-from-instances into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8030
2026-10-29 10:15:17 +00:00
lain
ca44028928 Merge pull request 'Federation: reject stale and incomplete HTTP signatures' (#8033) from lambadalambda/pleroma:fix/signature-freshness into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8033
2026-10-29 09:35:47 +00:00
Lain Soykaf
fa8541309c
fix(search): set gin_fuzzy_search_limit only for search queries
The limit was a connection parameter, so it applied to every GIN index
scan, not only full-text search: recipient lookups and Oban job queries
could return incomplete, random results. Set it with SET LOCAL around
the search query only, configurable under Pleroma.Search.DatabaseSearch.

The default stays 500 for search: measured on a 74M-object database,
higher limits or none make searches for common words exceed the query
timeout. Remote fetches for URL queries run outside the transaction.

Based on Akkoma 811f0a468.

Co-authored-by: Oneric <oneric@oneric.stub>
2026-10-29 11:26:02 +04:00
Lain Soykaf
1849356abe
fix(instances): record the instance when refreshing known users too
Hosts without a row (IPv6 literals skipped by the backfill, rows deleted
later) were never added again, because known users take the update path.
2026-10-29 10:42:54 +04:00
Lain Soykaf
958166589e
fix(stats): leave our own host out of the peers
Favicon lookups for local accounts can add our own host to instances.
Also skip userinfo and IPv6 literals in the backfill migration.
2026-10-29 10:42:54 +04:00
Lain Soykaf
e8f238359f
perf(stats): read peers from instances, update every 5 minutes
The peers query read the nickname of every remote user every minute
(2.7 s and 1.2M buffer hits on a large instance). The instances table
now has a row for every host we know users from, so read it instead,
and recompute the stats every 5 minutes.

Based on Akkoma 138b1aea2 and 7b76fdeed.

Co-authored-by: Oneric <oneric@oneric.stub>
Co-authored-by: FloatingGhost <hannah@coffee-and-dreams.uk>
2026-10-29 10:42:54 +04:00
Lain Soykaf
8e3404a239
feat(instances): record the instance of new remote users
The instances table only got rows from fetches, reachability changes
and favicon lookups, so most hosts we know users from had none. Insert
a row when a remote user is created, keeping existing rows.
2026-10-29 10:42:54 +04:00
lain
24038667b2 Merge pull request 'fix(http): treat an empty proxy_url as no proxy' (#8010) from lambadalambda/pleroma:fix/empty-proxy-url into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8010
2026-10-29 06:39:21 +00:00
lain
dca6c07631 Merge pull request 'Federation: always prefer the shared inbox' (#8029) from lambadalambda/pleroma:perf/shared-inbox into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8029
2026-10-29 05:41:18 +00:00
Lain Soykaf
3890fbc127
feat(api): add the Mastodon quote entity to statuses
Mastodon 4.4+ clients read quotes from a top-level quote object with
state and quoted_status; Pleroma only had pleroma.quote, so they did
not show quote posts. Quoted statuses get a shallow quote with only
quoted_status_id, as quotes are rendered one level deep.

Inspired by Akkoma 5b7209980, which can not use the shallow form because
Akkoma already had a top-level quote status.
2026-10-28 11:38:49 +04:00
lain
ecd20c7587 Merge pull request 'Federation: validate actor hosts and fetched object ids' (#8034) from lambadalambda/pleroma:fix/actor-containment into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8034
2026-10-28 07:19:42 +00:00
lain
24738790c3 Merge pull request 'MediaProxy: proxy network-path URLs (//host/path)' (#8027) from lambadalambda/pleroma:fix/media-proxy-network-path into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8027
2026-10-28 05:03:14 +00:00
Lain Soykaf
90e330e5b3
fix(containment): return nil for actor shapes without an id
Containment.get_actor raised on remote shapes it did not know, such as
an attributedTo object without an id. This crashed object fetches and
poll refetches. Return nil, so containment rejects the object.
2026-10-27 22:03:13 +04:00
Lain Soykaf
c81b1261dc
fix(federation): treat empty actor fields as missing
An empty inbox, collection or key id was rejected as being on another
host. Treat empty strings like null and only check fields with a value.
2026-10-27 22:02:31 +04:00
Lain Soykaf
f22caeff53
fix(user): update the known user when fetched from a display URL
A fetch from a display URL (e.g. https://host/@user) returns the
actor with its canonical id. make_user_from_ap_id looked the user up
by the fetch URL, did not find it and tried to insert a duplicate.
Look the user up by the fetched id.

Based on Akkoma 48b3a3579.
2026-10-27 21:58:46 +04:00
Lain Soykaf
f1337d8159
fix(fetcher): keep id and author fixed when refetching objects
refetch_object (used for poll updates) accepted whatever the remote
served. A hostile server could swap in another object or move the post
to another author.

The refetch now goes to the stored id without redirects, and the
returned id and actor must equal the stored ones.

Based on Akkoma 9061d148b and fee57eb37.
2026-10-27 21:58:46 +04:00
Lain Soykaf
20354e0aee
fix(fetcher): require fetched documents to have the fetched id
The fetcher accepted any document whose id was on the same host as the
fetch URL. Anyone who can place a JSON file on a host, for example
through an upload, could pass it off as another object or actor from
that host.

The id of a fetched document must now be the URL it came from (after
redirects), ignoring a trailing slash, the fragment, the host case and
differences that our URL encoding removes.
If it differs, as for Mastodon's /@user/123 display URLs, we refetch
once from that id, which must be on the same host. The refetch must
not redirect and must match exactly.

Test mocks that served a document under a different URL now serve it
from its own id.

Based on Akkoma 8684964c5 and 940792f8b.
2026-10-27 21:58:41 +04:00