FIX: do not allow unbound membership lookups
Previously we would allow looking up membership limits in an unbound way via the API, this introduces an upper limit of 1000 per page.
This commit is contained in:
parent
fe4f0a4369
commit
704c579550
|
@ -211,6 +211,10 @@ class GroupsController < ApplicationController
|
|||
raise Discourse::InvalidParameters.new(:limit)
|
||||
end
|
||||
|
||||
if limit > 1000
|
||||
raise Discourse::InvalidParameters.new(:limit)
|
||||
end
|
||||
|
||||
if offset < 0
|
||||
raise Discourse::InvalidParameters.new(:offset)
|
||||
end
|
||||
|
|
|
@ -351,6 +351,9 @@ describe GroupsController do
|
|||
|
||||
get "/groups/#{group.name}/members.json?offset=-1"
|
||||
expect(response.status).to eq(400)
|
||||
|
||||
get "/groups/trust_level_0/members.json?limit=2000"
|
||||
expect(response.status).to eq(400)
|
||||
end
|
||||
|
||||
it "ensures the group can be seen" do
|
||||
|
|
Loading…
Reference in New Issue