webauthn 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/CHANGELOG.md +8 -0
- data/README.md +9 -2
- data/lib/webauthn/attestation_statement.rb +7 -0
- data/lib/webauthn/attestation_statement/android_safetynet.rb +2 -1
- data/lib/webauthn/attestation_statement/fido_u2f.rb +2 -1
- data/lib/webauthn/attestation_statement/none.rb +1 -1
- data/lib/webauthn/attestation_statement/packed.rb +19 -7
- data/lib/webauthn/authenticator_attestation_response.rb +10 -2
- data/lib/webauthn/version.rb +1 -1
- data/webauthn.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 861ba8a05d52230a89d8ba009d93e656c42c7f9add389767f0cd3cf6bf97c8c2
|
4
|
+
data.tar.gz: a3c7d357340f381c4ea06e3ed8aa5711549573eb9f59e591a332f7224a55a2dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcad6286a076eea7af7d3bfde6c708cb291a2d8102c8722db8a6372baedf6541df470d54717ed2c347a2f0e703a7bcf190cffbef9c8f90cbe6475064ee00f542
|
7
|
+
data.tar.gz: 8b28576e8ce15e632ca54e78fd4cf94ac2c34a506c84b085baa19623787e50d60eb0ed7253edbd87523639353a4cdb448c7bfc94dedf1563ae764e9ff1e4cd28
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v1.7.0] - 2018-11-08
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- _Registration_ ceremony
|
8
|
+
- `WebAuthn::AuthenticatorAttestationResponse` exposes attestation type and trust path via `#attestation_type` and `#attestation_trust_path` methods. Thank you @bdewater!
|
9
|
+
|
3
10
|
## [v1.6.0] - 2018-11-01
|
4
11
|
|
5
12
|
### Added
|
@@ -97,6 +104,7 @@ Note: Both additions should help making it compatible with Chrome for Android 70
|
|
97
104
|
- `WebAuthn::AuthenticatorAttestationResponse.valid?` can be used to validate fido-u2f attestations returned by the browser
|
98
105
|
- Works with ruby 2.5
|
99
106
|
|
107
|
+
[v1.7.0]: https://github.com/cedarcode/webauthn-ruby/compare/v1.6.0...v1.7.0/
|
100
108
|
[v1.6.0]: https://github.com/cedarcode/webauthn-ruby/compare/v1.5.0...v1.6.0/
|
101
109
|
[v1.5.0]: https://github.com/cedarcode/webauthn-ruby/compare/v1.4.0...v1.5.0/
|
102
110
|
[v1.4.0]: https://github.com/cedarcode/webauthn-ruby/compare/v1.3.0...v1.4.0/
|
data/README.md
CHANGED
@@ -21,11 +21,16 @@ This gem will help your ruby server act as a conforming [_Relying-Party_](https:
|
|
21
21
|
Currently supporting [Web Authentication API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API):
|
22
22
|
- [Mozilla Firefox](https://www.mozilla.org/firefox/) 60+
|
23
23
|
- [Google Chrome](https://www.google.com/chrome/) 67+
|
24
|
-
- [Google Chrome for Android
|
24
|
+
- [Google Chrome for Android](https://play.google.com/store/apps/details?id=com.android.chrome) 70+
|
25
25
|
|
26
26
|
### A conforming Authenticator
|
27
27
|
|
28
|
-
|
28
|
+
* Roaming authenticators
|
29
|
+
* [Security Key by Yubico](https://www.yubico.com/product/security-key-by-yubico/)
|
30
|
+
* [YubiKey 5 Series](https://www.yubico.com/products/yubikey-5-overview/) key
|
31
|
+
* Platform authenticators
|
32
|
+
* Android's Fingerprint Scanner
|
33
|
+
* MacBook [Touch ID](https://en.wikipedia.org/wiki/Touch_ID)
|
29
34
|
|
30
35
|
NOTE: Firefox states ([Firefox 60 release notes](https://www.mozilla.org/en-US/firefox/60.0/releasenotes/)) they only support USB FIDO2 or FIDO U2F enabled devices in their current implementation (version 60).
|
31
36
|
It's up to the gem's user to verify user agent compatibility if any other device wants to be used as the authenticator component.
|
@@ -48,6 +53,8 @@ Or install it yourself as:
|
|
48
53
|
|
49
54
|
## Usage
|
50
55
|
|
56
|
+
NOTE: You can find a working example on how to use this gem in a __Rails__ app in [webauthn-rails-demo-app](https://github.com/cedarcode/webauthn-rails-demo-app).
|
57
|
+
|
51
58
|
### Registration
|
52
59
|
|
53
60
|
#### Initiation phase
|
@@ -9,6 +9,13 @@ module WebAuthn
|
|
9
9
|
ATTESTATION_FORMAT_PACKED = 'packed'
|
10
10
|
ATTESTATION_FORMAT_ANDROID_SAFETYNET = "android-safetynet"
|
11
11
|
|
12
|
+
ATTESTATION_TYPE_NONE = "None"
|
13
|
+
ATTESTATION_TYPE_BASIC = "Basic"
|
14
|
+
ATTESTATION_TYPE_SELF = "Self"
|
15
|
+
ATTESTATION_TYPE_ATTCA = "AttCA"
|
16
|
+
ATTESTATION_TYPE_ECDAA = "ECDAA"
|
17
|
+
ATTESTATION_TYPE_BASIC_OR_ATTCA = "Basic_or_AttCA"
|
18
|
+
|
12
19
|
def self.from(format, statement)
|
13
20
|
case format
|
14
21
|
when ATTESTATION_FORMAT_NONE
|
@@ -18,7 +18,8 @@ module WebAuthn
|
|
18
18
|
valid_attestation_domain? &&
|
19
19
|
valid_version? &&
|
20
20
|
valid_nonce?(authenticator_data, client_data_hash) &&
|
21
|
-
cts_profile_match?
|
21
|
+
cts_profile_match? &&
|
22
|
+
[WebAuthn::AttestationStatement::ATTESTATION_TYPE_BASIC, attestation_certificate]
|
22
23
|
end
|
23
24
|
|
24
25
|
private
|
@@ -11,7 +11,8 @@ module WebAuthn
|
|
11
11
|
def valid?(authenticator_data, client_data_hash)
|
12
12
|
valid_format? &&
|
13
13
|
valid_certificate_public_key? &&
|
14
|
-
valid_signature?(authenticator_data, client_data_hash)
|
14
|
+
valid_signature?(authenticator_data, client_data_hash) &&
|
15
|
+
[WebAuthn::AttestationStatement::ATTESTATION_TYPE_BASIC_OR_ATTCA, [attestation_certificate]]
|
15
16
|
end
|
16
17
|
|
17
18
|
private
|
@@ -15,7 +15,8 @@ module WebAuthn
|
|
15
15
|
valid_format? &&
|
16
16
|
valid_certificate_chain?(authenticator_data.credential) &&
|
17
17
|
meet_certificate_requirement? &&
|
18
|
-
valid_signature?(authenticator_data, client_data_hash)
|
18
|
+
valid_signature?(authenticator_data, client_data_hash) &&
|
19
|
+
attestation_type_and_trust_path
|
19
20
|
end
|
20
21
|
|
21
22
|
private
|
@@ -67,12 +68,15 @@ module WebAuthn
|
|
67
68
|
|
68
69
|
# Check https://www.w3.org/TR/2018/CR-webauthn-20180807/#packed-attestation-cert-requirements
|
69
70
|
def meet_certificate_requirement?
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
71
|
+
if attestation_certificate
|
72
|
+
subject = attestation_certificate.subject.to_a
|
73
|
+
|
74
|
+
attestation_certificate.version == 2 &&
|
75
|
+
subject.assoc('OU')&.at(1) == "Authenticator Attestation" &&
|
76
|
+
attestation_certificate.extensions.find { |ext| ext.oid == 'basicConstraints' }&.value == 'CA:FALSE'
|
77
|
+
else
|
78
|
+
true
|
79
|
+
end
|
76
80
|
end
|
77
81
|
|
78
82
|
def valid_signature?(authenticator_data, client_data_hash)
|
@@ -86,6 +90,14 @@ module WebAuthn
|
|
86
90
|
def verification_data(authenticator_data, client_data_hash)
|
87
91
|
authenticator_data.data + client_data_hash
|
88
92
|
end
|
93
|
+
|
94
|
+
def attestation_type_and_trust_path
|
95
|
+
if raw_attestation_certificates&.any?
|
96
|
+
[WebAuthn::AttestationStatement::ATTESTATION_TYPE_BASIC_OR_ATTCA, attestation_certificate_chain]
|
97
|
+
else
|
98
|
+
[WebAuthn::AttestationStatement::ATTESTATION_TYPE_SELF, nil]
|
99
|
+
end
|
100
|
+
end
|
89
101
|
end
|
90
102
|
end
|
91
103
|
end
|
@@ -11,6 +11,8 @@ require "webauthn/client_data"
|
|
11
11
|
|
12
12
|
module WebAuthn
|
13
13
|
class AuthenticatorAttestationResponse < AuthenticatorResponse
|
14
|
+
attr_reader :attestation_type, :attestation_trust_path
|
15
|
+
|
14
16
|
def initialize(attestation_object:, **options)
|
15
17
|
super(options)
|
16
18
|
|
@@ -18,8 +20,14 @@ module WebAuthn
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def valid?(original_challenge, original_origin, rp_id: nil)
|
21
|
-
super
|
22
|
-
|
23
|
+
valid_response = super
|
24
|
+
return false unless valid_response
|
25
|
+
|
26
|
+
valid_attestation = attestation_statement.valid?(authenticator_data, client_data.hash)
|
27
|
+
return false unless valid_attestation
|
28
|
+
|
29
|
+
@attestation_type, @attestation_trust_path = valid_attestation
|
30
|
+
true
|
23
31
|
end
|
24
32
|
|
25
33
|
def credential
|
data/lib/webauthn/version.rb
CHANGED
data/webauthn.gemspec
CHANGED
@@ -38,5 +38,5 @@ Gem::Specification.new do |spec|
|
|
38
38
|
spec.add_development_dependency "byebug", "~> 10.0"
|
39
39
|
spec.add_development_dependency "rake", "~> 12.0"
|
40
40
|
spec.add_development_dependency "rspec", "~> 3.0"
|
41
|
-
spec.add_development_dependency "rubocop", "0.
|
41
|
+
spec.add_development_dependency "rubocop", "0.60.0"
|
42
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webauthn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gonzalo Rodriguez
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-11-
|
12
|
+
date: 2018-11-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cbor
|
@@ -135,14 +135,14 @@ dependencies:
|
|
135
135
|
requirements:
|
136
136
|
- - '='
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.
|
138
|
+
version: 0.60.0
|
139
139
|
type: :development
|
140
140
|
prerelease: false
|
141
141
|
version_requirements: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - '='
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0.
|
145
|
+
version: 0.60.0
|
146
146
|
description:
|
147
147
|
email:
|
148
148
|
- gonzalo@cedarcode.com
|
@@ -203,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
203
|
version: '0'
|
204
204
|
requirements: []
|
205
205
|
rubyforge_project:
|
206
|
-
rubygems_version: 2.7.
|
206
|
+
rubygems_version: 2.7.7
|
207
207
|
signing_key:
|
208
208
|
specification_version: 4
|
209
209
|
summary: WebAuthn in ruby ― Ruby implementation of a WebAuthn Relying Party
|