]> cat aescling's git repositories - mastodon.git/commitdiff
Fix validates :sign_count of WebauthnCredential (#14806)
authorkawaguchi <jiikko@users.noreply.github.com>
Wed, 16 Sep 2020 18:16:46 +0000 (03:16 +0900)
committerGitHub <noreply@github.com>
Wed, 16 Sep 2020 18:16:46 +0000 (20:16 +0200)
app/models/webauthn_credential.rb
spec/models/webauthn_credentials_spec.rb

index 4129ce53971768e39c2b70c272122befcde29267..7d423e38d71f59949ea8f959db36a71dd44fa571 100644 (file)
@@ -18,5 +18,5 @@ class WebauthnCredential < ApplicationRecord
   validates :external_id, uniqueness: true
   validates :nickname, uniqueness: { scope: :user_id }
   validates :sign_count,
-            numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 2**32 - 1 }
+            numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 2**63 - 1 }
 end
index 9289c371e650250d9d9aed2fd9996f58bd124ce0..a63ae6cd24893ea33c8169be9b526cd9ff75de60 100644 (file)
@@ -69,8 +69,8 @@ RSpec.describe WebauthnCredential, type: :model do
       expect(webauthn_credential).to model_have_error_on_field(:sign_count)
     end
 
-    it 'is invalid if sign_count is greater 2**32 - 1' do
-      webauthn_credential = Fabricate.build(:webauthn_credential, sign_count: 2**32)
+    it 'is invalid if sign_count is greater 2**63 - 1' do
+      webauthn_credential = Fabricate.build(:webauthn_credential, sign_count: 2**63)
 
       webauthn_credential.valid?