Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pleroma
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jeff
pleroma
Commits
093d39b6
Commit
093d39b6
authored
6 years ago
by
kaniini
Browse files
Options
Downloads
Plain Diff
Merge branch 'feature/hellthread-mitigation' into 'develop'
implement hellthread mitigation Closes
#474
See merge request
!588
parents
61a88a67
a7f07bb6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
config/config.exs
+2
-0
2 additions, 0 deletions
config/config.exs
docs/config.md
+3
-0
3 additions, 0 deletions
docs/config.md
lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex
+18
-0
18 additions, 0 deletions
lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex
with
23 additions
and
0 deletions
config/config.exs
+
2
−
0
View file @
093d39b6
...
...
@@ -163,6 +163,8 @@ config :pleroma, :mrf_rejectnonpublic,
allow_followersonly:
false
,
allow_direct:
false
config
:pleroma
,
:mrf_hellthread
,
threshold:
10
config
:pleroma
,
:mrf_simple
,
media_removal:
[],
media_nsfw:
[],
...
...
This diff is collapsed.
Click to expand it.
docs/config.md
+
3
−
0
View file @
093d39b6
...
...
@@ -121,6 +121,9 @@ This section is used to configure Pleroma-FE, unless ``:managed_config`` in ``:i
*
`allow_followersonly`
: whether to allow followers-only posts
*
`allow_direct`
: whether to allow direct messages
## :mrf_hellthread
*
`threshold`
: Number of mentioned users after which the message gets discarded as spam
## :media_proxy
*
`enabled`
: Enables proxying of remote media to the instance’s proxy
*
`base_url`
: The base URL to access a user-uploaded file. Useful when you want to proxy the media files via another host/CDN fronts.
...
...
This diff is collapsed.
Click to expand it.
lib/pleroma/web/activity_pub/mrf/hellthread_policy.ex
0 → 100644
+
18
−
0
View file @
093d39b6
defmodule
Pleroma
.
Web
.
ActivityPub
.
MRF
.
HellthreadPolicy
do
@behaviour
Pleroma
.
Web
.
ActivityPub
.
MRF
@impl
true
def
filter
(%{
"type"
=>
"Create"
}
=
object
)
do
threshold
=
Pleroma
.
Config
.
get
([
:mrf_hellthread
,
:threshold
])
recipients
=
(
object
[
"to"
]
||
[])
++
(
object
[
"cc"
]
||
[])
if
length
(
recipients
)
>
threshold
do
{
:reject
,
nil
}
else
{
:ok
,
object
}
end
end
@impl
true
def
filter
(
object
),
do
:
{
:ok
,
object
}
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment