diff --git a/app/models/concerns/web_hooks/hook.rb b/app/models/concerns/web_hooks/hook.rb index 666bc95dbac31411a90b5e9dc46ad9afc2cf84c2..5660c697148da43c42fabe8c43b30c5c0fe04d4c 100644 --- a/app/models/concerns/web_hooks/hook.rb +++ b/app/models/concerns/web_hooks/hook.rb @@ -65,6 +65,8 @@ module Hook validates :interpolated_url, public_url: true, if: ->(hook) { hook.url_variables? && hook.errors.empty? } validates :custom_headers, json_schema: { filename: 'web_hooks_custom_headers' } validates :custom_webhook_template, length: { maximum: 4096 } + validates :name, length: { maximum: 255 } + validates :description, length: { maximum: 2048 } enum :branch_filter_strategy, { wildcard: 0, diff --git a/spec/support/shared_examples/models/concerns/web_hooks/web_hook_shared_examples.rb b/spec/support/shared_examples/models/concerns/web_hooks/web_hook_shared_examples.rb index 4a31a208ad0cc85c89c9cdff303f5dcff34fdd30..7ec0564eafbfcd1bcc89fe6e80d2419faf99248b 100644 --- a/spec/support/shared_examples/models/concerns/web_hooks/web_hook_shared_examples.rb +++ b/spec/support/shared_examples/models/concerns/web_hooks/web_hook_shared_examples.rb @@ -18,6 +18,8 @@ describe 'validations' do it { is_expected.to validate_presence_of(:url) } it { is_expected.to validate_length_of(:custom_webhook_template).is_at_most(4096) } + it { is_expected.to validate_length_of(:name).is_at_most(255) } + it { is_expected.to validate_length_of(:description).is_at_most(2048) } describe 'url_variables' do it { is_expected.to allow_value({}).for(:url_variables) }