FEATURE: Support RS256 algorithm for webauthn (#8385)
* Add support for RS256 webauthn algorithm (-257)
This commit is contained in:
parent
b57e108e84
commit
5ad6dc01c1
|
@ -6,7 +6,10 @@ require 'webauthn/security_key_authentication_service'
|
|||
module Webauthn
|
||||
ACCEPTABLE_REGISTRATION_TYPE = "webauthn.create".freeze
|
||||
ACCEPTABLE_AUTHENTICATION_TYPE = "webauthn.get".freeze
|
||||
SUPPORTED_ALGORITHMS = [-7].freeze
|
||||
|
||||
# -7 - ES256
|
||||
# -257 - RS256 (Windows Hello supported alg.)
|
||||
SUPPORTED_ALGORITHMS = [-7, -257].freeze
|
||||
VALID_ATTESTATION_FORMATS = ['none', 'packed', 'fido-u2f'].freeze
|
||||
|
||||
class SecurityKeyError < StandardError; end
|
||||
|
|
|
@ -49,7 +49,7 @@ module Webauthn
|
|||
# attribute of one of the items in options.pubKeyCredParams.
|
||||
# https://w3c.github.io/webauthn/#table-attestedCredentialData
|
||||
# See https://www.iana.org/assignments/cose/cose.xhtml#algorithms for supported algorithm
|
||||
# codes, -7 which Discourse uses is ECDSA w/ SHA-256
|
||||
# codes.
|
||||
credential_public_key, credential_public_key_bytes, credential_id = extract_public_key_and_credential_from_attestation(auth_data)
|
||||
raise(UnsupportedPublicKeyAlgorithmError, I18n.t('webauthn.validation.unsupported_public_key_algorithm_error')) if ::Webauthn::SUPPORTED_ALGORITHMS.exclude?(credential_public_key.alg)
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ describe Webauthn::SecurityKeyRegistrationService do
|
|||
before do
|
||||
@original_supported_alg_value = Webauthn::SUPPORTED_ALGORITHMS
|
||||
silence_warnings do
|
||||
Webauthn::SUPPORTED_ALGORITHMS = [-257]
|
||||
Webauthn::SUPPORTED_ALGORITHMS = [-999]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue