Commit graph

6,666 commits

Author SHA1 Message Date
Lain Soykaf
6c73ebe484 Merge branch 'phnt/mastoapi-misattribution-3381' into release/2.10-sec 2025-12-29 09:47:54 +04:00
Phantasm
38b3bff4e8
MastoAPI: Add more post attribution tests when fetched by Activity ID
Types returning 404:
- Accept
- Reject
- Delete
- Flag
- Follow
- Undo

Types returning posts:
- Create
- Update
- Like
- Announce
- EmojiReact
- Add/Remove
2025-12-25 20:40:21 +01:00
Phantasm
96de44b3d8
Tests AP Factory: fix featured collection factories
Internally it created Objects, tests passed Activities
2025-12-25 20:40:12 +01:00
lain
1a313fa30c Merge branch 'replies_collection' into 'develop'
Provide full replies collection in ActivityPub objects (ported from akkoma)

See merge request pleroma/pleroma!4370
2025-12-25 10:22:53 +00:00
Lain Soykaf
4c537534ad NoteHandlingTest: Replies go on an object, not an activity. 2025-12-24 13:33:03 +04:00
Lain Soykaf
73b446bb07 ActivityPubControllerTest, UserViewTest: Add failing tests for reply collection related issues. 2025-12-24 12:20:11 +04:00
Phantasm
7c93cd351b
MastoAPI StatusController: add tests for fetching context via Activity 2025-12-23 16:52:45 +01:00
Phantasm
ba8235ef50
lint 2025-12-23 16:51:59 +01:00
lain
2f48544937 Merge branch 'akkoma-fixes-1014-1018' into 'develop'
Status visibility checks for post interactions, stop leaking internal Activity representation (Akkoma PR 1014 and 1018)

Closes #3383

See merge request pleroma/pleroma!4400
2025-12-23 13:55:18 +00:00
Phantasm
b9601ae11a
MastoAPI: Add Announce and EmojiReact attribution tests
Introduces a new EmojiReact Activity factory
2025-12-23 00:17:16 +01:00
Phantasm
01ffaba3d2
MastoAPI: Fix unauth visibility checks when fetching by Activity FlakeID
- Adds another Pleroma.ActivityPub.Visibility.visible_for_user?/2 func
- Modifies existing tests to include a local Activity referencing a
  remote Object
- Changes Announce Activity test factory to reference Objects instead of
  Activities and use a different Actor for the Announce
- Changes ap_id of remote user in Announce test factory to match Objects
- Adds `object_local` option to Note factories that explicitly changes
  the domain in the URL to not match the endpoint URL in the test env
  to properly work with the new visibility func, since we don't store
  locality of Object unlike Activities
2025-12-23 00:07:16 +01:00
lain
1d366c0138 Merge branch 'transmogrifier/handle-as-public' into 'develop'
Transmogrifier: convert "as:Public" to full w3 URL

See merge request pleroma/pleroma!4394
2025-12-22 07:39:44 +00:00
lain
d19b992417 Merge branch 'webfinger-actual-fix' into 'develop'
Fix WebFinger for split-domain setups

See merge request pleroma/pleroma!4405
2025-12-22 07:38:55 +00:00
Lain Soykaf
f70d1a436b WebFingerTest: Add test for more webfinger spoofing. 2025-12-21 17:46:20 +04:00
Lain Soykaf
4496dc81c4 TransmogrifierTest, CreateGenericValidatorTest: Add regression tests for addressing. 2025-12-21 15:19:05 +04:00
Lain Soykaf
ed538603fb TransmogrifierTest: Add failing test for Update. 2025-12-21 14:04:19 +04:00
nicole mikołajczyk
e0ab2c9c9c Merge remote-tracking branch 'origin/develop' into mastodon-quote-id-api
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
2025-12-17 13:43:45 +01:00
nicole mikołajczyk
c06fcc7f5d Merge branch 'order-favourites-reblogs' into 'develop'
Order favourites and reblogs list from newest to oldest

See merge request pleroma/pleroma!4399
2025-12-16 23:49:01 +01:00
nicole mikołajczyk
d41e2fbaaf Merge branch 'preferred-frontend' into 'develop'
Port Akkoma frontend preference code

See merge request pleroma/pleroma!4398
2025-12-16 20:54:00 +01:00
nicole mikołajczyk
c6298be9f0 Merge branch 'scrobbles-scope' into 'develop'
Add `write:scrobbles` and `read:scrobbles` scope for scrobbling

See merge request pleroma/pleroma!4379
2025-12-16 20:53:32 +01:00
nicole mikołajczyk
e5be1d04d6 Update tests, make the mastodon subdomain example not have the /.well-known/host-meta redirect, as the docs don't include it
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
2025-12-15 17:01:56 +01:00
nicole mikołajczyk
3e2573f1c4 Fix WebFinger for split-domain set ups
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
2025-12-15 17:01:53 +01:00
Phantasm
4985902b02
Add Actor images normalization from array of urls to string 2025-12-15 00:00:57 +01:00
Phantasm
49a5630c75
CommonAPI: Standardize visibility error, use helper function if possible 2025-12-12 18:05:58 +01:00
Phantasm
374305d5fe
AP C2S: Add reply test 2025-12-12 00:04:28 +01:00
Phantasm
fe7108cbc2
MastoAPI: Unify pin/bookmark/mute/fav not visible responses to 404
Also adds more tests for these interactions.
2025-12-12 00:04:27 +01:00
Phantasm
73a3f06f71
PleromaAPI: Change EmojiReact to invisible post response from 400 to 404 2025-12-12 00:03:59 +01:00
Phantasm
293628fb24
MastoAPI/CommonAPI: Return 404 when post not visible to user
Akkoma patches returned 403 and some of my previous commits returned 422.
This unifies the errors returned to 404 "Record not found", gaslighting
user just like we do for other endpoints and how Mastodon does it.
2025-12-11 23:32:21 +01:00
Phantasm
9d89156b84
AP C2S: Explicitly reject Updates to Actors that failed silently 2025-12-11 23:32:21 +01:00
Phantasm
63bdf4dc2b
C2S: New Add/Remove and Actor creation tests
Creating Actors via C2S doesn't make sense, thus it should fail.
Tests creating Actors with type: Application/Person/Service.

All Create Activities for new Actors currently fail with
`validator not set` in the pipeline.
2025-12-11 23:32:11 +01:00
Phantasm
426535bc38
CommonAPI: Forbid disallowed status (un)muting and unpinning
When a user tried to unpin a status not belonging to them, a full
MastoAPI response was sent back even if status was not visible to them.

Ditto with (un)mutting except ownership.
2025-12-11 23:30:04 +01:00
Phantasm
f914748510
Transmogrifier: make Listen Activity test more strict 2025-12-11 23:30:04 +01:00
Phantasm
3f16965178
Transmogrifier: update internal fields list according to constant 2025-12-11 23:30:04 +01:00
Phantasm
21b2fd1e05
AP C2S: reject Flag activities, add visibility refutes to some tests 2025-12-11 23:30:04 +01:00
Phantasm
2b76243ec8
CommonAPI: Fail when user sends report with posts not visible to them 2025-12-11 23:30:03 +01:00
Phantasm
a4e480a636
lint and credo 2025-12-11 23:30:03 +01:00
Phantasm
b3887a6fa7
AP C2S: Validate visibility for C2S requests to /users/:nickname/outbox
A local user could previously send Announce/EmojiReact/Like activities
to their outbox referencing objects that aren't visible to them and they
would get processed as if can see them. Only requirement is knowing
the URI of the object and the users instance having C2S enabled (currently
disabled by default).
2025-12-11 23:30:03 +01:00
Phantasm
75353282ee
AP ObjectView: add test for Listen activities 2025-12-11 23:30:03 +01:00
Oneric
885ba3a46f
test: add more representation tests for perpare_outgoing
Port of commit 272799da6242dbf7387d2d42dfc98512cd7efd7e from
Akkoma PR 1018.

Changes from Akkoma commit:
- changed order of arguments in CommonAPI.(un)block, because Akkoma
  hasn't backported our change for the unified arg order yet

In particular this covers the case
e88f36f72b5317debafcc4209b91eb35ad8f0691 was meant to fix and
2025-12-11 23:30:03 +01:00
Oneric
59fcb5c96e
api: ensure only visible posts are interactable
Port of Akkoma PR 1014 with a few changes:
- comments regarding akkomafe changed to Pleroma-FE when applicable
- different error message for replying to/interacting with invisible post
  in Pleroma.Web.CommonAPI.ActivityDraft.in_reply_to/1
- split "doesn't do funny things to other users favs" test into three:
  - can't unfavourite post that isn't favourited
  - can't unfavourite other user's favs
  - can't unfavourite other user's favs using their activity
- switched order of args for some CommonAPI function since Akkoma hasn't
  backported our old change for that

Pleroma.Web.CommonAPI.ActivityDraft.in_reply_to/1 now refactored to use
`with` statement as in Akkoma. Some defp in_reply_to/1 were therefore removed

Original PR author: Oneric
Original commit message:
It doesn't make sense to like, react, reply, etc to something you cannot
see and is unexpected for the author of the interacted with post and
might make them believe the reacting user actually _can_ see the post.

Wrt to fav, reblog, reaction indexes the missing visibility check was
also leaking some (presumably/hopefully) low-severity data.

Add full-API test for all modes of interactions with private posts.
2025-12-11 23:30:02 +01:00
Phantasm
7d8a188967
Disable Hackney URL encoding function
Hackney interferes with out URI encoding and implements older RFC 2396
instead of RFC 3986 which we and Elixir implement. As an example "'"
and "!" will get encoded by it and cause problems with our MediaProxy
making unexpected 302 redirects.

If an admin supplies a different function via *.secret.exs, we
don't override it.

https://github.com/benoitc/hackney/issues/399
2025-12-10 14:56:07 +01:00
Phantasm
73b337245b
Make URI encoding query quirks host-aware 2025-12-10 14:56:06 +01:00
Phantasm
0935823be9
Add test for mangling incorrect URL in MediaProxy link generation 2025-12-10 14:56:06 +01:00
Phantasm
bfe8372ad2
Remove "preserve ASCII encoding" test in MediaProxy
issue 580: Should not happen again, tested in HTTPTest
issue 1055: Fixed with quirk support in query encoding, tested
in HTTPTest
2025-12-10 14:56:06 +01:00
Phantasm
c31454fac1
Fix unicode URL encoding test 2025-12-10 14:56:05 +01:00
Phantasm
f290b15987
Move custom URI encoding functions to Pleroma.Utils.URIEncoding 2025-12-10 14:56:05 +01:00
Phantasm
cfd2c08ef6
lint 2025-12-10 14:56:05 +01:00
Phantasm
a0f73d0e2f
Reimplement URI.encode_query/2 to support quirks, add Guardian quirk
This solves the issue with Guardian rich media cards not loading, thanks
to them using "," and ":" in queries which get improperly encoded.
Guardian also needs specific ordering of the query keys, this also fixes
that.
2025-12-10 14:56:05 +01:00
Phantasm
1b438fd167
MediaProxy: fix query params test
Elixir and Erlang both add a traling = when encoding queries
2025-12-10 14:56:04 +01:00
Phantasm
d413f9bf70
MediaProxy: fix Pleroma.HTTP.encode_url not being available in test env 2025-12-10 14:56:04 +01:00