SECURITY: Limit length of edit reason column
This commit is contained in:
parent
62a609ea2d
commit
dcc825bda5
|
@ -64,6 +64,7 @@ class Post < ActiveRecord::Base
|
|||
has_many :reviewables, as: :target, dependent: :destroy
|
||||
|
||||
validates_with PostValidator, unless: :skip_validation
|
||||
validates :edit_reason, length: { maximum: 1000 }
|
||||
|
||||
after_commit :index_search
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ RSpec.describe Post do
|
|||
end
|
||||
|
||||
it { is_expected.to validate_presence_of :raw }
|
||||
it { is_expected.to validate_length_of(:edit_reason).is_at_most(1000) }
|
||||
|
||||
# Min/max body lengths, respecting padding
|
||||
it { is_expected.not_to allow_value("x").for(:raw) }
|
||||
|
|
Loading…
Reference in New Issue