mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 01:21:23 +08:00
SECURITY: Limit the character count of group membership requests (#19993)
When creating a group membership request, there is no character limit on the 'reason' field. This can be potentially be used by an attacker to create enormous amount of data in the database. Co-authored-by: Ted Johansson <ted@discourse.org>
This commit is contained in:
@ -1,8 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class GroupRequest < ActiveRecord::Base
|
||||
REASON_CHARACTER_LIMIT = 280
|
||||
|
||||
belongs_to :group
|
||||
belongs_to :user
|
||||
|
||||
validates :reason, length: { maximum: REASON_CHARACTER_LIMIT }
|
||||
end
|
||||
|
||||
# == Schema Information
|
||||
|
Reference in New Issue
Block a user