Commit graph

18,379 commits

Author SHA1 Message Date
Lain Soykaf
695dd340de
fix(federation): reject actors that point at other hosts
A remote actor could set its inbox or shared inbox to a third-party
host, so our signed deliveries went there. It could also claim
another actor's followers collection, which the visibility checks
trust.

Validate fetched actors and incoming actor Updates: inbox,
endpoints.sharedInbox, followers, following, featured and the
publicKey id must be on the same host as the actor id.

Based on Akkoma f07eb4cb5. The Bridgy fixture gets the key id that
current Bridgy Fed serves.
2026-10-27 21:37:20 +04:00
lain
d54ff52691 Merge pull request 'StatusView: handle attachments with zero width or height' (#8026) from lambadalambda/pleroma:fix/attachment-zero-size into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8026
2026-10-27 15:00:18 +00:00
lain
7ccdd47134 Merge pull request 'User: stop passing the ignored is_active key to User.Query' (#8025) from lambadalambda/pleroma:fix/user-query-is-active into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8025
2026-10-27 14:58:44 +00:00
Lain Soykaf
283035ad4f
test(status_view): cover attachments with zero dimensions 2026-10-27 17:27:41 +04:00
Oneric
9443aba06c
api/view: handle explicitly zero dimensions in attachments
Some peertube videos are federated with explicitly zero dimensions
for their mp4 link leading to a division-by-zero exception here.
E.g.: https://spectra.video/videos/watch/66c12674-2013-47a4-9126-51ff8eb8d0a8
      (as of writing using peertube 8.1.1)

Reported by temp3 on IRC

(cherry picked from commit 6833281051aa86b3d82232be29497fed47bf5fb1)
2026-10-27 17:27:28 +04:00
Lain Soykaf
555d93bc33
fix(user): use deactivated: false for familiar followers
User.Query ignores is_active. The friends subquery already drops
deactivated users here, so this only removes the last ignored key.
Also add a changelog entry and a test.
2026-10-27 17:26:20 +04:00
Oneric
f5898ab0fb
Fix malformed is_active qualifiers in User.Query usages
While "is_active" is a property of users, it is not a recognised keyword
for the User.Query helper; instead "deactivated" with negated value must
be used.
This arose because originally the user property was also called
"deactivated" until it was renamed adn negated five years ago
in 860b5c7804. This included renaiming
the parameter in most but not all User.Query usages.
Notably the parameter in User.get_followers_query was renamed
but not in User.get_friends_query (friends == following).
The accepted query parameter in User.Query however was not changed.
This lead to the former mistakenly including deleted users causing
too large values to be reported in the ActivityPub follower, but not
following collection as reported in #1078.

In Masto API responses filtering by `User.is_visible` weeded out
the extra accounts before they got displayed to API users.

On the surface it might seem logical to align the name of the User.Query
parameter with the actual property name. However, User.Query already
accepts an "active" parameter which is an alias for limiting to accounts
which are neither deleted nor deactivated by moderators (both indicated
by is_active) and also are not newly created account requests still
pending an admin approval (is_approved) or necessary email confirmation
(is_confirmed); in short as the alias suggests whether the account is
active. Two highly similar parameter names like this would be much too
confusing.

The renamed "is_active" on the other hand does not actually suffice to
say whether an account is actually active, only whether it has (not yet)
ceased to be active (by its own volition or moderator action).
Meaning its "new" name is actively misleading. Arguably the rename
made things worse for no reason whatsoever and should not ever have
happened.

For now, we’ll just revert the incorrect query helper parameter renames.

Fixes: https://akkoma.dev/AkkomaGang/akkoma/ issues/ 1078
(cherry picked from commit a899663ddc0e3a2084a239eabd79608a94ac5493)
2026-10-27 17:24:58 +04:00
lain
c2bdfb6a34 Merge pull request 'Federation: do not deliver to instances rejected by SimplePolicy' (#8021) from lambadalambda/pleroma:fix/federation-reject-instances into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8021
2026-10-27 13:20:00 +00:00
lain
f4e8834e65 Merge pull request 'Filters: treat phrases as literal text' (#8020) from lambadalambda/pleroma:fix/filter-regex-escape into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8020
2026-10-27 12:39:47 +00:00
lain
a4ce628a50 Merge pull request 'Notifications: do not notify tagged users who cannot see the post' (#8022) from lambadalambda/pleroma:fix/mention-notify-access into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8022
2026-10-27 12:38:20 +00:00
lain
9d2c8d384e Merge branch 'develop' into fix/federation-reject-instances 2026-10-27 12:37:46 +00:00
lain
d15e62fa0a Merge pull request 'Tests: fix flaky RateLimiter tests' (#8024) from lambadalambda/pleroma:fix/rate-limiter-test-flake into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8024
2026-10-27 12:37:27 +00:00
lain
539db4b978 Merge pull request 'Notifications: do not crash on posts without content when filters exist' (#8023) from lambadalambda/pleroma:fix/notification-filter-nil-content into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8023
2026-10-27 12:36:46 +00:00
Lain Soykaf
985ad29724
test(rate_limiter): use windows that cannot expire during the test
The bucket entry expires one window after the first request. With a 50
or 80 ms window, a slow CI run could lose it between two requests, so
inspect_bucket/3 returned {0, 5} (seen on #8021 with Elixir 1.17). The
reset test expires the bucket itself, so a long window costs nothing.
2026-10-27 16:10:14 +04:00
lain
c5498c018d Merge pull request 'MRF ObjectAgePolicy: keep old DMs and followers-only posts private' (#8019) from lambadalambda/pleroma:fix/object-age-non-public into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8019
2026-10-27 12:03:58 +00:00
Lain Soykaf
21a5d1dca2
fix(notifications): skip the filter check for objects without content
Regex.match? raised on objects without content (for example posts with
only attachments), so no notifications were created for them when the
recipient had an irreversible filter.
2026-10-27 12:53:21 +04:00
Lain Soykaf
04fbb59932
fix(federation): cancel queued deliveries to blocked instances
Delivery jobs only checked reachability, so a job queued (or retrying)
before the admin rejected or quarantined an instance was still sent.
Check should_federate? again when the job runs.
2026-10-27 12:51:14 +04:00
Lain Soykaf
422a1d1475
fix(filters): honour whole_word
The whole_word field was stored and returned by the API, but the regex
always used word boundaries. As in Mastodon, a filter with whole_word
false now also matches inside words.
2026-10-27 12:50:04 +04:00
Lain Soykaf
cccbb39309
fix(notifications): handle unknown users when filtering tagged mentions
The access check from the previous commit crashed on tags of unknown
users in followers-only posts, so such posts failed to be received.
Also add tests for the check.
2026-10-27 12:39:02 +04:00
Lain Soykaf
a766335679
fix(federation): do not deliver to instances rejected by SimplePolicy
Public activities went to every inbox, so followers on an instance in
the SimplePolicy reject list still got our posts. With authorized fetch
mode on, signed fetches from those instances were also accepted, unless
the instance was in :instance, :rejected_instances too.

Check the SimplePolicy reject and accept lists for deliveries and signed
fetches, when the policy is enabled. Quarantine keeps its meaning (no
private activities). An inbox without a host no longer crashes.

Based on the Akkoma changes 90c4785b8, ca000f830, 03662501c and d2b0d8647.

Co-authored-by: FloatingGhost <hannah@coffee-and-dreams.uk>
Co-authored-by: Atsuko Karagi <atsuko.karagi@localhost>
2026-10-27 12:38:18 +04:00
Lain Soykaf
f975db8719
fix(filters): treat phrases as literal text in the regex
Phrases went into the Postgres and Elixir regexes as they were, so a
phrase like "(" broke the timeline and notification queries. The :re
form also put the word boundaries only around the whole alternation.

Escape each phrase and, as Mastodon does, add a word boundary only where
the phrase starts or ends with a word character.

Reported in Akkoma (d6209837b).
2026-10-27 12:36:09 +04:00
Lain Soykaf
0d93c903f7
test(mrf): cover ObjectAgePolicy with private, direct and unlisted posts 2026-10-27 12:35:16 +04:00
Oneric
df5e756862
Do not notify users unable to access post
Known implementations all intend to only tag users who are _also_ allowed to access the post,
but this is not guaranteed by ActivityPub semantics, thus recheck against the authorative
AP addressing fields.
An alternative worth considering is directly using the addressing fields to decide whom
to notify ignoring tags. However, MastoAPI later uses tags and thus this may lead to
confusing results if a recipient is addressed but not tagged and receives a notification about
being mentioned while the API claims they are not mentioned.

Addresses the receiving side of: https://akkoma.dev/AkkomaGang/akkoma/issues/1135

(cherry picked from commit 5cff1fac24bb3e6c22160202a7b846f8a62f2477)
2026-10-27 12:31:14 +04:00
Oneric
2a55239ca8
mrf/object_age: fix handling of non-public objects
Current logic unconditionally adds public adressing to "cc"
and follower adressing to "to" after attempting to strip it
from the other one. This creates serious problems:

First the bug prompting this investigation and fix,
unconditional addition creates duplicates when adressing
URIs already were in their intended final field; e.g.
this is prominently the case for all "unlisted" posts.
Since List.delete only removes the first occurence,
this then broke follower-adress stripping later on
making the policy ineffective.

It’s also just not safe in general wrt to non-public adressing:
e.g. pre-existing duplicates didn’t get fully stripped,
bespoke adressing modes with only one of public addressing
or follower addressing are mangled — and most importantly:
any belatedly received DM or follower-only post
also got public adressing added!
Shockingly this last point was actually asserted as "correct" in tests;
it appears to be a mistake from mindless match adjustments
while fixing crashes on nil adressing in
10c792110e.

Clean up this sloppy logic up, making sure no more duplicates are
added by us, all instances of relevant adresses are purged and only
readded when they actually existed to begin with.

(cherry picked from commit 932810c35ecba9d11fa4f11112c3444b62c45b65)
2026-10-27 12:27:09 +04:00
lain
90eb5e4015 Merge pull request 'ActivityPub: check OAuth scopes on C2S endpoints' (#8015) from lambadalambda/pleroma:fix/ap-c2s-oauth-scopes into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8015
2026-10-27 07:08:48 +00:00
lain
745926189f Merge pull request 'OAuth: require security scopes for /api/oauth_tokens' (#8013) from lambadalambda/pleroma:fix/oauth-tokens-scopes into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8013
2026-10-27 07:08:34 +00:00
lain
b9fcb8bbe0 Merge pull request 'Remove unrouted PleromaAPI token and password controllers' (#8014) from lambadalambda/pleroma:chore/remove-dead-pleroma-api-controllers into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8014
2026-10-27 07:06:53 +00:00
lain
6963c22fcf Merge pull request 'OAuth: support the profile scope' (#8012) from lambadalambda/pleroma:feature/oauth-profile-scope into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/8012
2026-10-27 07:06:03 +00:00
lain
70f9b8542f Merge pull request 'Merge stable 2.11.1 into develop' (#8017) from merge-stable-2.11.1 into develop 2026-10-26 19:36:51 +00:00
Lain Soykaf
15361ea917
Merge stable 2.11.1 into develop 2026-10-26 22:40:31 +04:00
lain
762058f2c5 Merge pull request 'Release 2.11.1' (#8016) from release/2.11.1 into stable 2026-10-26 18:39:46 +00:00
Lain Soykaf
006ad1c7d0
Prepare 2.11.1 release 2026-10-26 22:02:51 +04:00
Lain Soykaf
26486b041b
docs(http): update hackney comments for 4.9 2026-10-26 22:02:41 +04:00
Lain Soykaf
48ec8518a3
fix(http): drop the partial body from truncated-read errors
Hackney 4.9 returns {:error, {:closed, partial}}. RelMe caches errors,
so it would keep up to max_body bytes per URL.
2026-10-26 22:02:18 +04:00
Lain Soykaf
eabdde8a20
Sec: Update hackney to version 4.9.1
Hackney 4.9 enforces max_body while it reads and returns
{:error, {:closed, partial}} for a truncated body; the hackney
regression tests now pin that. The certifi override goes, as
hackney itself now asks for certifi ~> 2.18.0.
2026-10-26 21:52:03 +04:00
Lain Soykaf
90479b3415
Sec: Update bandit to version 1.14.0 2026-10-26 21:48:31 +04:00
Lain Soykaf
da7e75ca73
fix(activitypub): check OAuth scopes on C2S endpoints
The C2S routes and the outbox/followers/following/replies collections
accepted a token with any scope. Requests with an OAuth token now need
the matching scope; HTTP signatures and Basic auth are not changed.
2026-10-26 12:49:58 +04:00
Lain Soykaf
dd42b02ca2
chore: remove unrouted PleromaAPI token and password controllers
Leftover copies from 120719f28; the router uses the OAuth ones. The
token copy still skipped the OAuth scope check.
2026-10-26 12:44:32 +04:00
Lain Soykaf
530ae4b339
feat(oauth): support the profile scope
A token with only the profile scope can call verify_credentials, as in
Mastodon 4.3. The answer is the public account, so apps can use it to
log users in without seeing their email or settings.
2026-10-26 12:29:51 +04:00
Lain Soykaf
c686b701dd
fix(oauth): require security scopes to list and revoke tokens
/api/oauth_tokens skipped the scope check, so a token with any scope
could list the user's sessions and revoke them.
2026-10-26 12:28:04 +04:00
lain
9edce3a0a6 Merge pull request 'Merge stable 2.11.0 into develop' (#8009) from merge-stable-2.11.0 into develop 2026-10-24 07:52:45 +00:00
lain
256882f8fb Merge pull request 'Release 2.11.0' (#8008) from release/2.11 into stable 2026-10-24 07:51:52 +00:00
Lain Soykaf
3f139680a3
Changelog: fix two list items in 2.11.0 2026-10-24 11:29:06 +04:00
Lain Soykaf
16d86dbaa9
Changelog: add plug_crypto 2.2.1 to 2.11.0 2026-10-24 09:38:16 +04:00
Lain Soykaf
e415eee9b6
Merge remote-tracking branch 'secteam/audit-mix-audit-report' into release/2.11 2026-10-24 09:37:34 +04:00
Lain Soykaf
6c5c5f2970
Sec: Update plug_crypto to version 2.2.1 2026-10-24 09:37:01 +04:00
Lain Soykaf
902fb8abc7
Changelog: add certifi 2.18.0 to 2.11.0 2026-10-24 08:47:35 +04:00
Lain Soykaf
8a5512f69f
Merge remote-tracking branch 'secteam/audit-mix-audit-report' into release/2.11 2026-10-24 08:46:14 +04:00
Lain Soykaf
932d1b6f94
Sec: Update certifi to version 2.18.0 2026-10-24 08:46:06 +04:00
feld
256c493ec6 Merge pull request 'Delete legacy Postgres sequences' (#7969) from legacy_sequences into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/7969
2026-10-22 18:10:36 +00:00