mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 01:23:38 +08:00
SECURITY: Limit length of edit reason column
This commit is contained in:
parent
6695d568ca
commit
23c2fd5efe
|
@ -63,6 +63,7 @@ class Post < ActiveRecord::Base
|
||||||
has_many :post_hotlinked_media, dependent: :destroy, class_name: "PostHotlinkedMedia"
|
has_many :post_hotlinked_media, dependent: :destroy, class_name: "PostHotlinkedMedia"
|
||||||
|
|
||||||
validates_with PostValidator, unless: :skip_validation
|
validates_with PostValidator, unless: :skip_validation
|
||||||
|
validates :edit_reason, length: { maximum: 1000 }
|
||||||
|
|
||||||
after_commit :index_search
|
after_commit :index_search
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ RSpec.describe Post do
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to validate_presence_of :raw }
|
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
|
# Min/max body lengths, respecting padding
|
||||||
it { is_expected.not_to allow_value("x").for(:raw) }
|
it { is_expected.not_to allow_value("x").for(:raw) }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user