mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 01:14:29 +08:00
SECURITY: Ensure the invite JSON API matches the UX
Anonymous users could query the invite json and see counts and summaries which is not allowed in the UX of Discourse. This commit has those endpoints return a 403 unless the user is allowed to invite.
This commit is contained in:
@ -274,6 +274,8 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
def invited
|
||||
guardian.ensure_can_invite_to_forum!
|
||||
|
||||
inviter = fetch_user_from_params(include_inactive: current_user.try(:staff?) || (current_user && SiteSetting.show_inactive_accounts))
|
||||
offset = params[:offset].to_i || 0
|
||||
filter_by = params[:filter]
|
||||
@ -290,6 +292,8 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
def invited_count
|
||||
guardian.ensure_can_invite_to_forum!
|
||||
|
||||
inviter = fetch_user_from_params(include_inactive: current_user.try(:staff?) || (current_user && SiteSetting.show_inactive_accounts))
|
||||
|
||||
pending_count = Invite.find_pending_invites_count(inviter)
|
||||
|
Reference in New Issue
Block a user