Commit graph

7,132 commits

Author SHA1 Message Date
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 Soykaf
1c8c6048de
fix(http): treat an empty proxy_url as no proxy 2026-10-24 14:12:47 +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
2982472d00
Merge branch 'fix/emudhra-ca-trust' (#77) into release/2.11 2026-10-22 16:37:08 +04:00
Lain Soykaf
9ea8d37e9f
Merge branch 'audit-mix-audit-report' (#69) into release/2.11
# Conflicts:
#	lib/pleroma/http/adapter_helper/hackney.ex
2026-10-22 16:37:08 +04:00
Lain Soykaf
532762bd9b
fix(http): keep the configured TLS options with Gun
[:http, :adapter, :ssl_options] is Hackney's key, and AdminFE sets it.
Gun reads tls_opts, so with Gun as the default these settings were lost
without a warning. Use them as tls_opts unless tls_opts is set.
2026-10-22 16:36:16 +04:00
Lain Soykaf
b2e4580a81
feat(http): make Gun the default HTTP client
Hackney 4 reads every response completely before Pleroma can check its
size, so max_body no longer limits downloads or memory there; Gun stops
at the limit. Document the Hackney limitation for those who switch back.
2026-10-22 16:36:16 +04:00
Lain Soykaf
1be50ed28b
fix(html): check link schemes the way browsers read them
FastSanitize checks the scheme with URI.parse/1, which finds none in
java<TAB>script:alert(1). Browsers remove tabs and newlines and leading
control characters first and run it as a javascript: link. The scrubbers
now use Pleroma.HTML.URIAttributes, which normalizes the URL the same
way before the scheme check.
2026-10-22 16:36:16 +04:00
Lain Soykaf
58d4f6aa2c
fix(formatter): percent-encode quotes in Markdown URLs instead of cutting
Cutting the URL at the first quote dropped the rest of valid links such
as ?q=&quot;cat&quot;&page=2. Percent-encoding ", < and > keeps the URL
complete and still keeps it inside the attribute.
2026-10-22 16:28:06 +04:00
Lain Soykaf
de6ac2392c
fix(formatter): keep links with formatted text in MFM posts
The email autolink clause also matched a link whose only child is an
element, raised on "mailto:" <> element, and the rescue turned the
whole post into escaped source text.
2026-10-22 16:25:54 +04:00
Lain Soykaf
e52ba68303
fix(http): make Hackney use HTTP/1.1 only
Hackney 4 negotiates HTTP/2 and shares one connection per host. The
media proxy closes a response with :hackney.close/1, which stops the
whole connection, so parallel downloads from one host broke each other.
2026-10-22 16:24:47 +04:00
Lain Soykaf
4943e6a914
fix(http): pass IP proxy hosts to Hackney as strings
ConfigDB turns a numeric proxy host into an IP tuple. Hackney 1 took it,
Hackney 4 ignores such a proxy and connects directly, which skips a
SOCKS proxy (Tor) without any error.
2026-10-22 16:23:40 +04:00
Lain Soykaf
302039e437
fix(http): keep admin CAs, secure HTTPS proxies, make insecure explicit
- An admin-set cacerts no longer gets the CAStore cacertfile added;
  Hackney drops cacerts when both are set.
- Set proxy_ssl_options too: with an HTTPS proxy, Hackney 4 uses them
  for the proxy connection and falls back to certifi.
- Hackney 4 ignores the top-level insecure option and uses certifi.
  Turn it into an explicit verify_none.
2026-10-22 15:31:30 +04:00
Lain Soykaf
a03e5df39c
fix: install admin-fe from the package registry 2026-10-22 13:04:20 +04:00
Lain Soykaf
fc91131892
Merge branch 'fix/emudhra-ca-trust' (#77) into release/2.11 2026-10-22 11:27:15 +04:00
Lain Soykaf
accadd99f3
fix(mailer): make Mua trust the CAStore bundle
Mua (the SMTP adapter in the docs) trusts the OS CA store unless it gets
a CA. Pass the CAStore bundle, but keep a CA that the admin set.
2026-10-22 11:21:50 +04:00
Lain Soykaf
d698b96579
fix(search): make the Qdrant clients trust the CAStore bundle
The Qdrant and OpenAI clients do not go through Pleroma.HTTP, so on
Hackney they trusted certifi. Both send API keys. Give them the
configured adapter with the same TLS options.
2026-10-22 11:21:00 +04:00
Lain Soykaf
e0ed6b5d39
Merge branch 'fix/emudhra-ca-trust' (#77) into release/2.11
# Conflicts:
#	lib/pleroma/http/adapter_helper/hackney.ex
#	mix.lock
2026-10-22 10:05:45 +04:00
Lain Soykaf
65076aa2f8
fix(http): reject Hackney's certifi partial chains
Hackney 4 merges given ssl_options into its defaults and keeps its own
partial_chain, which trusts any certificate in the peer chain that is in
certifi. A peer could send the emSign ECC Root CA - G3 root in its chain
and pass. Set partial_chain so certifi is never a trust anchor.
2026-10-22 10:05:12 +04:00
Lain Soykaf
92a112cf15
fix(mailer): drop the TLS 1.2 pin
The pin worked around a TLS 1.3 problem with Hackney on OTP 23
(swoosh/swoosh#478). Pleroma no longer supports OTP 23.
2026-10-22 08:48:56 +04:00
Lain Soykaf
830455d197
fix(mailer): keep certificate checks for Swoosh HTTP adapters
The TLS version override replaced all Hackney TLS defaults. On OTP 26+
this fails with cacerts: :undefined; on older OTP it skipped certificate
checks. Closes #7962 on the public tracker.
2026-10-21 08:27:30 +04:00
Lain Soykaf
d8c880e494
fix(http): make Hackney trust the CAStore bundle
Hackney trusts its own certifi bundle, which still has the roots of the
compromised eMudhra intermediate CAs. Pass explicit ssl_options with the
CAStore bundle. Hackney drops all its TLS defaults when ssl_options are
given, so keep peer and hostname checks in the options.
2026-10-21 08:21:43 +04:00
Lain Soykaf
d13000b2b9
RichMedia: skip the quote fallback link when picking the card URL
Mastodon, Misskey and InlineQuotePolicy put "RE: <url>" in a .quote-inline
element at the start of a quote post. Its link was taken for the link card,
which then showed the quoted post a second time.
2026-10-13 21:39:43 +04:00
Lain Soykaf
e93f05a79f
fix(retention): keep threads whose post a local user quoted
A quote has a context of its own, so the quoted remote thread counted as
untouched and was evicted, breaking the local quote. On lain.com 45 of
134 quoted posts went this way. The objects_quote_url index keeps the
lookup at one probe per post.
2026-09-25 08:50:41 +04:00
Lain Soykaf
5e425ce9f5
fix(retention): see local reactions of the legacy EmojiReaction type
Older data stores emoji reactions as EmojiReaction. The per-thread check
only looked at EmojiReact, so a thread whose only local interaction was
such a reaction was evicted.
2026-09-23 15:43:02 +04:00
Lain Soykaf
5d1e331589
fix(retention): only delete objects that belong to an evicted thread
Eviction took the object ids of every activity in a thread. A Like or
Announce whose context differs from its object's then deleted a post in
another, possibly pinned thread. Found on a copy of a real instance:
593 posts from threads with local activity in the first 2M objects.
2026-09-23 13:45:02 +04:00
Lain Soykaf
5a4ada881f
test(retention): cover the recipients pin in prune_objects and watermark activity 2026-09-23 08:26:24 +04:00
Lain Soykaf
75b158c1d0
perf(retention): only clean up hashtags of evicted objects
Each run scanned the whole hashtags table. Collect the hashtag ids of
the objects about to be deleted and check just those.
2026-09-23 08:24:09 +04:00
Lain Soykaf
3cbcae2de3
fix(retention): keep threads younger than a day over the watermark
Over the watermark the walk went up to the present, so posts that had
just arrived could be evicted while people were reading them.
2026-09-23 08:23:05 +04:00
Lain Soykaf
1a0212bf9a
fix(retention): pin threads addressed to a local user
A mention or DM was only pinned by its notification, so clearing
notifications let retention evict a user's direct messages. Check the
activity recipients instead, which does not go away.
2026-09-23 08:22:14 +04:00
Phantasm
72d45a9f8b
Merge branch 'develop' into audit-mix-audit-report 2026-09-08 21:58:23 +02:00
lain
70d743bff9 Merge branch 'develop' into fix/domain-block-subplan-cost 2026-09-02 10:19:27 +00:00
Lain Soykaf
635bc19ac8
fix(notifications): cost the followed-accounts subselect once
Wrap the followed ap_ids subselect in keep_following_or_not_domain_blocked
in ARRAY(...) so it becomes an InitPlan. As a plain subselect the planner
charged its startup per rescan of the actor lookup, which could make
Notification.for_user pick a plan that scans every active user per row.
2026-09-02 13:42:48 +04:00
Lain Soykaf
6c8ed0a3b8
feat(retention): walk activities incrementally with a persisted cursor
Grouping the whole activities table by thread every run is unusable on
a large instance: on a 312 GB database it plans as a seq scan plus a
50M-row on-disk sort. Instead, walk activities in id order (flake ids
are time-ordered) from a persisted cursor up to the id that corresponds
to the deadline, and verify only the threads those activities belong to
through the (type, context) index. Measured on that instance: 147 ms
for a 50k-activity range scan, 349 ms warm / 14 s cold to verify ~700
threads.

The cursor is persisted per chunk so a killed run resumes. The
watermark walk keeps a cursor of its own so it cannot leave the
age-based walk stranded behind the deadline. Adds the retention_cursors
table.
2026-09-02 12:32:09 +04:00
Lain Soykaf
fa4fb00910
refactor(database): reuse retention query in prune_objects
prune_objects --keep-threads now shares the thread selection with
Pleroma.Retention, which additionally keeps threads that mention a
local user or that are referenced by a report. The hashtag cleanup
is shared as well.
2026-09-02 11:53:42 +04:00
Lain Soykaf
cd796f007d
feat(retention): run eviction from an Oban cron worker
Adds config :pleroma, :retention (disabled by default) and an hourly
crontab entry that evicts one bounded batch per run.
2026-09-02 11:53:42 +04:00
Lain Soykaf
1ebcd4f79d
feat(retention): add bounded eviction of old remote threads
Pleroma.Retention treats remote content as a cache: a thread is evicted
once nobody local has interacted with it and it has been quiet for
longer than remote_post_retention_days, or when the objects table is
over an optional row watermark. Local posts are never deleted.

A single grouping scan collects activity and object ids per thread so
the deletes only touch primary key and ap_id indexes.
2026-09-02 11:53:41 +04:00
Phantasm
45459c8398
Merge branch 'develop' into audit-mix-audit-report 2026-08-19 22:20:55 +02:00
Phantasm
f672ab337c
Revert "Merge pull request 'MediaProxy: detect images when there's no file extension' (#7933) from mediaproxy-content-type into develop"
A partial revert, keeping the updated @inline_content_types list and
cosmetic changes.

This reverts commit 4fe567064a, reversing
changes made to 9b8aa2e2ee.
2026-08-13 22:02:11 +02:00
nicole mikołajczyk
2876fed876 Embed notificaiton details for grouped move/reaction/chat/report notification
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
2026-08-02 22:13:31 +02:00
Lain Soykaf
478b021fbe
fix(migrations): make Rebased rollback safe 2026-07-29 15:22:13 +04:00
lain
1dd6a345bf Merge pull request 'Respect activity restrictions in account statuses' (#7943) from mkljczk/pleroma:issue-2604-restrict-account-statuses into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/7943
2026-07-29 06:44:26 +00:00
Lain Soykaf
4a47a756be
fix(mastodon-api): optimize account status restrictions 2026-07-28 16:01:48 +04:00
lain
a45eb365ed Merge pull request 'Abort incomplete media proxy responses' (#7946) from lambadalambda/pleroma:fix/media-proxy-truncated-cache into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/7946
2026-07-27 15:08:06 +00:00
Lain Soykaf
bc999b3309
fix(media-proxy): abort truncated streams 2026-07-27 16:32:44 +04:00
Lain Soykaf
030c7e929c
style(oauth): use single alias directives 2026-07-27 12:14:58 +04:00
Lain Soykaf
d30d205f0b
fix(oauth): preserve dependent app cleanup 2026-07-27 11:57:16 +04:00
Lain Soykaf
b4c624911c
Merge branch 'develop' into gitlab-mr-iid-4315 2026-07-27 11:34:31 +04:00
lain
8ab0e046b1 Merge pull request 'Allow creating accounts without a password in the AdminAPI, update docs' (#7937) from mkljczk/pleroma:admin-api-passwordless-user-creation into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/7937
2026-07-27 07:17:14 +00:00