Commit 5b5ff7708be0eb896aca0eb203a38663242da08b

Authored by Dmitriy Zaporozhets
1 parent 6e1ee1fe

More strict validation for SSH Key content

Showing 1 changed file with 1 additions and 1 deletions   Show diff stats
app/models/key.rb
@@ -22,7 +22,7 @@ class Key < ActiveRecord::Base @@ -22,7 +22,7 @@ class Key < ActiveRecord::Base
22 before_validation :strip_white_space 22 before_validation :strip_white_space
23 23
24 validates :title, presence: true, length: { within: 0..255 } 24 validates :title, presence: true, length: { within: 0..255 }
25 - validates :key, presence: true, length: { within: 0..5000 }, format: { with: /ssh-.{3} / }, uniqueness: true 25 + validates :key, presence: true, length: { within: 0..5000 }, format: { with: /\Assh-.*\Z/ }, uniqueness: true
26 validate :fingerprintable_key 26 validate :fingerprintable_key
27 27
28 delegate :name, :email, to: :user, prefix: true 28 delegate :name, :email, to: :user, prefix: true