MRF.ObjectAgePolicy: Check objects alongside Create activities #845
No reviewers
Labels
No labels
approved, awaiting change
bug
configuration
documentation
duplicate
enhancement
extremely low priority
feature request
Fix it yourself
help wanted
invalid
mastodon_api
needs change/feedback
needs docs
needs tests
not a bug
planned
pleroma_api
privacy
question
static_fe
triage
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: AkkomaGang/akkoma#845
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "norm/akkoma:fix-object-age-policy"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
ObjectAgePolicy only checked Create activites, which still resulted in
some old posts making it to user timelines, even when it was enabled.
This fixes that issue by also checking objects of an updatable type
as defined in
Pleroma.Constants.updatable_object_types
.There might be a better way of refactoring the new stuff, so tips would be appreciated for doing that.
fc2ba27d80
to17e3655886
reminder to run
mix test
; the function clause mismatches show up there and speaking ofmix test
it’d be good to add a test for objects not being fully rejected but still strippedBtw, I know I suggested the base idea with object types and it still seems sensible, but did you confirm it works in practice when e.g. searching an URL of an old, not-yet-known post of a followed user?
@ -15,0 +27,4 @@
end
defp check_date(%{"published" => published} = message) do
This now checks for
published
in the top-level object, but the code path for activities still passes the top-level activity instead of the child object tocheck_date
. The activity might not have apublished
field and thus crash the process@ -100,2 +110,4 @@
end
@impl true
def filter(%{"type" => type} = message) when type in Pleroma.Constants.updatable_object_types() do
Two things:
"published" => _
parameter like for child objects above, else there won't be a function clause match later incheck_date
and processing crashes (effectively rejecting the post with added perf overhead from retries)fetchable_object_types
or perhaps just a completeobject_types
constant would be clearer imho.Checking some other object type matches in the codebase, the only type missing from
updatable_object_types
appears to beAnswer
(transmogrifier mapsNote
s in response to aQuestion
to a separateAnswer
type)@ -101,1 +111,4 @@
@impl true
def filter(%{"type" => type} = message) when type in Pleroma.Constants.updatable_object_types() do
# Don't reject fetched objects, only delist/strip followers
Instead of duplicating the base function, i’d prefer to lift the logic out into a shared function and pass a flag to it indicating whether or not a full reject is allowed
17e3655886
to3c0d98dd7f
3c0d98dd7f
to84ef99daac
84ef99daac
tod78927113e
d78927113e
to7507984e07
7507984e07
toa1ba6357e8
a1ba6357e8
to50f7b6367f
Tests should pass now, will test the functionality a bit later
Checking this out with debug logs reveals current unpatched develop:
"Create"
for manually fetched objects — and passes only the Create to MRFs, breaking the assumption underlying this fixpublished
field:reject
is set making it a pretty destructive optioncalling into question why some MRFs check raw objects at allAfter the Create activity passed the actual fetched object also passes through MRFs.
Well, how come the MRF obviously doesn’t prevent fetched posts from entering TLs?
it actually successfully
:delists
”public” posts (only stripping the generated activity though, not the object recipients)*it also removes follower collection from the public post’s activity
this also works to prevent those psots from showing up in the timeline
but... note how i specified “public” post above; the issue actually lies in the delisting logic. Taking a look at debug logs for an “unlisted” post:
Whoops, the existing follower address and public scope scope indicator get duplicated, and in accordance with
List.delete
’s documentation only the first instance dropped later.Actually, the logic would even add public indicators to any received DMs if they arrive late enough... ouch
... and it converting DMs to "unlisted" is even checked in tests, marvellous (this seems like an accident from mindlessly adjusting matches; it got added when Pleroma fixed crashes on
nil
adressing)Tested fix in #851
looks like this PR isn't needed then as the problem lays elsewhere.
Pull request closed