Skip to content
Snippets Groups Projects
Commit 7c1d8045 authored by Alex Gleason's avatar Alex Gleason
Browse files

Merge branch 'fix-search-dos' into 'develop'

Search: limit number of results (prevent DoS)

See merge request !3563
parents b686d68c 108dfd1f
No related branches found
No related tags found
3 merge requests!3816Release 2.5.0,!3724Draft: Release/2.5.0,!3563Search: limit number of results (prevent DoS)
Pipeline #38317 passed
......@@ -17,6 +17,8 @@ defmodule Pleroma.Web.MastodonAPI.SearchController do
require Logger
@search_limit 40
plug(Pleroma.Web.ApiSpec.CastAndValidate)
# Note: Mastodon doesn't allow unauthenticated access (requires read:accounts / read:search)
......@@ -77,7 +79,7 @@ defp search_options(params, user) do
[
resolve: params[:resolve],
following: params[:following],
limit: params[:limit],
limit: min(params[:limit], @search_limit),
offset: params[:offset],
type: params[:type],
author: get_author(params),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment