chore: Add max length validation to text fields (#7073)

Introduces a default max length validation for all string and text fields to prevent processing large payloads.
This commit is contained in:
Sojan Jose
2023-05-12 22:12:21 +05:30
committed by GitHub
parent 198cd9b28d
commit 385eab6b96
6 changed files with 89 additions and 6 deletions

View File

@@ -36,7 +36,6 @@ class Contact < ApplicationRecord
validates :phone_number,
allow_blank: true, uniqueness: { scope: [:account_id] },
format: { with: /\+[1-9]\d{1,14}\z/, message: I18n.t('errors.contacts.phone_number.invalid') }
validates :name, length: { maximum: 255 }
belongs_to :account
has_many :conversations, dependent: :destroy_async