webauthn 2.1.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +6 -0
  3. data/.github/workflows/build.yml +50 -0
  4. data/.github/workflows/git.yml +21 -0
  5. data/.rubocop.yml +121 -13
  6. data/CHANGELOG.md +169 -0
  7. data/CONTRIBUTING.md +0 -5
  8. data/README.md +80 -14
  9. data/SECURITY.md +7 -4
  10. data/docs/advanced_configuration.md +174 -0
  11. data/docs/u2f_migration.md +14 -20
  12. data/lib/cose/rsapkcs1_algorithm.rb +50 -0
  13. data/lib/webauthn/attestation_object.rb +47 -0
  14. data/lib/webauthn/attestation_statement/android_key.rb +27 -33
  15. data/lib/webauthn/attestation_statement/android_safetynet.rb +27 -11
  16. data/lib/webauthn/attestation_statement/apple.rb +65 -0
  17. data/lib/webauthn/attestation_statement/base.rb +114 -21
  18. data/lib/webauthn/attestation_statement/fido_u2f.rb +8 -6
  19. data/lib/webauthn/attestation_statement/none.rb +7 -1
  20. data/lib/webauthn/attestation_statement/packed.rb +14 -42
  21. data/lib/webauthn/attestation_statement/tpm.rb +38 -75
  22. data/lib/webauthn/attestation_statement.rb +24 -21
  23. data/lib/webauthn/authenticator_assertion_response.rb +22 -11
  24. data/lib/webauthn/authenticator_attestation_response.rb +31 -92
  25. data/lib/webauthn/authenticator_data/attested_credential_data.rb +33 -49
  26. data/lib/webauthn/authenticator_data.rb +59 -51
  27. data/lib/webauthn/authenticator_response.rb +24 -11
  28. data/lib/webauthn/client_data.rb +4 -6
  29. data/lib/webauthn/configuration.rb +38 -40
  30. data/lib/webauthn/credential.rb +4 -4
  31. data/lib/webauthn/credential_creation_options.rb +2 -0
  32. data/lib/webauthn/credential_request_options.rb +2 -0
  33. data/lib/webauthn/encoder.rb +13 -4
  34. data/lib/webauthn/fake_authenticator/attestation_object.rb +25 -4
  35. data/lib/webauthn/fake_authenticator/authenticator_data.rb +25 -10
  36. data/lib/webauthn/fake_authenticator.rb +49 -8
  37. data/lib/webauthn/fake_client.rb +41 -8
  38. data/lib/webauthn/json_serializer.rb +45 -0
  39. data/lib/webauthn/public_key.rb +21 -2
  40. data/lib/webauthn/public_key_credential/creation_options.rb +3 -3
  41. data/lib/webauthn/public_key_credential/entity.rb +5 -28
  42. data/lib/webauthn/public_key_credential/options.rb +11 -32
  43. data/lib/webauthn/public_key_credential/request_options.rb +11 -1
  44. data/lib/webauthn/public_key_credential.rb +52 -8
  45. data/lib/webauthn/public_key_credential_with_assertion.rb +16 -2
  46. data/lib/webauthn/public_key_credential_with_attestation.rb +2 -2
  47. data/lib/webauthn/relying_party.rb +137 -0
  48. data/lib/webauthn/u2f_migrator.rb +8 -4
  49. data/lib/webauthn/version.rb +1 -1
  50. data/lib/webauthn.rb +1 -0
  51. data/webauthn.gemspec +15 -12
  52. metadata +56 -60
  53. data/.travis.yml +0 -36
  54. data/Appraisals +0 -17
  55. data/gemfiles/cose_head.gemfile +0 -7
  56. data/gemfiles/openssl_2_0.gemfile +0 -7
  57. data/gemfiles/openssl_2_1.gemfile +0 -7
  58. data/gemfiles/openssl_head.gemfile +0 -7
  59. data/lib/android_safetynet/attestation_response.rb +0 -116
  60. data/lib/cose/rsassa_algorithm.rb +0 -10
  61. data/lib/tpm/constants.rb +0 -44
  62. data/lib/tpm/s_attest/s_certify_info.rb +0 -14
  63. data/lib/tpm/s_attest.rb +0 -26
  64. data/lib/tpm/sized_buffer.rb +0 -13
  65. data/lib/tpm/t_public/s_ecc_parms.rb +0 -17
  66. data/lib/tpm/t_public/s_rsa_parms.rb +0 -17
  67. data/lib/tpm/t_public.rb +0 -32
  68. data/lib/webauthn/attestation_statement/android_key/authorization_list.rb +0 -39
  69. data/lib/webauthn/attestation_statement/android_key/key_description.rb +0 -37
  70. data/lib/webauthn/attestation_statement/tpm/cert_info.rb +0 -44
  71. data/lib/webauthn/attestation_statement/tpm/pub_area.rb +0 -85
  72. data/lib/webauthn/security_utils.rb +0 -20
  73. data/lib/webauthn/signature_verifier.rb +0 -77
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78367d9a528b780d4e53a29667fe47cf95d03698c976714fc7d71d46b253f4fa
4
- data.tar.gz: ab4e9b0ef6a0bfcb9bd2c33d8220e0f3241f2ba949c57053d52968b6e34a5a61
3
+ metadata.gz: 325d58807c73a2887233d3b68091bea56edcb9be7fb21f57067d1f974006d876
4
+ data.tar.gz: 24a7b26717f6ab10286f14410db64909a21a4e43cea30b1b168f32caa80412c6
5
5
  SHA512:
6
- metadata.gz: f9a3514276b45c34c5509e7d55a6238d8a705ab19534a5ca3a802be4a00f42784b81c3dbc02f3c991918bb61da55b6f20c268a0573b8099224d9467d13932a60
7
- data.tar.gz: e337a703e30a984b881d589f5c31a653e312a9ae4395cf2c411408e0f162871622c7f3d212412ea01de4db121a1ddf2431000ae55968358062f513b5feef812c
6
+ metadata.gz: f12ef1fad4fcf414b7081f9b89a4db5536d301b2c015449a3d2d631ea09a2a087cb6c02f3699f61528f9e9b61d3bf039c37bf0b0885991a7d7e26ac3dadd452a
7
+ data.tar.gz: f6464aaa94ddeec4ddefecb6b94b5fa310ada53d67bd1bf9b146c942dbd29e637790c6ae081d3d4cc81aed12be4a9073f056e2770ab2b846278d07923d67f6bf
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
@@ -0,0 +1,50 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: build
9
+
10
+ on:
11
+ push:
12
+ branches: [master]
13
+ pull_request:
14
+ types: [opened, synchronize]
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-24.04
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ ruby:
23
+ - '3.4'
24
+ - '3.3'
25
+ - '3.2'
26
+ - '3.1'
27
+ - '3.0'
28
+ - '2.7'
29
+ - '2.6'
30
+ - '2.5'
31
+ - truffleruby
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+ - uses: ruby/setup-ruby@v1
35
+ with:
36
+ ruby-version: ${{ matrix.ruby }}
37
+ bundler-cache: true
38
+ - run: bundle exec rspec
39
+ env:
40
+ RUBYOPT: ${{ startsWith(matrix.ruby, '3.4') && '--enable=frozen-string-literal' || '' }}
41
+
42
+ lint:
43
+ runs-on: ubuntu-latest
44
+ steps:
45
+ - uses: actions/checkout@v4
46
+ - uses: ruby/setup-ruby@v1
47
+ with:
48
+ ruby-version: '3.3'
49
+ bundler-cache: true
50
+ - run: bundle exec rubocop -f github
@@ -0,0 +1,21 @@
1
+ # Syntax reference:
2
+ # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
3
+ name: Git Checks
4
+
5
+ on:
6
+ pull_request:
7
+ types: [opened, synchronize]
8
+
9
+ jobs:
10
+ # Fixup commits are OK in pull requests, but should generally be squashed
11
+ # before merging to master, e.g. using `git rebase -i --autosquash master`.
12
+ # See https://github.com/marketplace/actions/block-autosquash-commits
13
+ block-fixup:
14
+ runs-on: ubuntu-latest
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - name: Block autosquash commits
19
+ uses: xt0rted/block-autosquash-commits-action@v2
20
+ with:
21
+ repo-token: ${{ secrets.GITHUB_TOKEN }}
data/.rubocop.yml CHANGED
@@ -1,12 +1,18 @@
1
+ require:
2
+ - rubocop-rspec
3
+ - rubocop-rake
4
+
1
5
  inherit_mode:
2
6
  merge:
3
7
  - AllowedNames
4
8
 
5
9
  AllCops:
6
- TargetRubyVersion: 2.3
10
+ TargetRubyVersion: 2.5
7
11
  DisabledByDefault: true
12
+ NewCops: disable
8
13
  Exclude:
9
14
  - "gemfiles/**/*"
15
+ - "vendor/**/*"
10
16
 
11
17
  Bundler:
12
18
  Enabled: true
@@ -17,18 +23,123 @@ Gemspec:
17
23
  Layout:
18
24
  Enabled: true
19
25
 
20
- Lint:
26
+ Layout/ClassStructure:
27
+ Enabled: true
28
+
29
+ Layout/EmptyLineBetweenDefs:
30
+ AllowAdjacentOneLineDefs: true
31
+
32
+ Layout/EmptyLinesAroundAttributeAccessor:
21
33
  Enabled: true
22
34
 
23
- Metrics/LineLength:
35
+ Layout/FirstMethodArgumentLineBreak:
36
+ Enabled: true
37
+
38
+ Layout/LineLength:
24
39
  Max: 120
25
40
  Exclude:
26
41
  - spec/support/seeds.rb
27
42
 
43
+ Layout/MultilineAssignmentLayout:
44
+ Enabled: true
45
+
46
+ Layout/MultilineMethodArgumentLineBreaks:
47
+ Enabled: true
48
+
49
+ Layout/SpaceAroundMethodCallOperator:
50
+ Enabled: true
51
+
52
+ Lint:
53
+ Enabled: true
54
+
55
+ Lint/DeprecatedOpenSSLConstant:
56
+ Enabled: true
57
+
58
+ Lint/MixedRegexpCaptureTypes:
59
+ Enabled: true
60
+
61
+ Lint/RaiseException:
62
+ Enabled: true
63
+
64
+ Lint/StructNewOverride:
65
+ Enabled: true
66
+
67
+ Lint/BinaryOperatorWithIdenticalOperands:
68
+ Enabled: true
69
+
70
+ Lint/DuplicateElsifCondition:
71
+ Enabled: true
72
+
73
+ Lint/DuplicateRescueException:
74
+ Enabled: true
75
+
76
+ Lint/EmptyConditionalBody:
77
+ Enabled: true
78
+
79
+ Lint/FloatComparison:
80
+ Enabled: true
81
+
82
+ Lint/MissingSuper:
83
+ Enabled: true
84
+
85
+ Lint/OutOfRangeRegexpRef:
86
+ Enabled: true
87
+
88
+ Lint/SelfAssignment:
89
+ Enabled: true
90
+
91
+ Lint/TopLevelReturnWithArgument:
92
+ Enabled: true
93
+
94
+ Lint/UnreachableLoop:
95
+ Enabled: true
96
+
28
97
  Naming:
29
98
  Enabled: true
30
99
 
31
- Naming/UncommunicativeMethodParamName:
100
+ Naming/VariableNumber:
101
+ Enabled: false
102
+
103
+ RSpec/Be:
104
+ Enabled: true
105
+
106
+ RSpec/BeforeAfterAll:
107
+ Enabled: true
108
+
109
+ RSpec/EmptyExampleGroup:
110
+ Enabled: true
111
+
112
+ RSpec/EmptyLineAfterExample:
113
+ Enabled: true
114
+
115
+ RSpec/EmptyLineAfterExampleGroup:
116
+ Enabled: true
117
+
118
+ RSpec/EmptyLineAfterFinalLet:
119
+ Enabled: true
120
+
121
+ RSpec/EmptyLineAfterHook:
122
+ Enabled: true
123
+
124
+ RSpec/EmptyLineAfterSubject:
125
+ Enabled: true
126
+
127
+ RSpec/HookArgument:
128
+ Enabled: true
129
+
130
+ RSpec/LeadingSubject:
131
+ Enabled: true
132
+
133
+ RSpec/NamedSubject:
134
+ Enabled: true
135
+
136
+ RSpec/ScatteredLet:
137
+ Enabled: true
138
+
139
+ RSpec/ScatteredSetup:
140
+ Enabled: true
141
+
142
+ Naming/MethodParameterName:
32
143
  AllowedNames:
33
144
  - rp
34
145
 
@@ -38,9 +149,6 @@ Security:
38
149
  Style/BlockComments:
39
150
  Enabled: true
40
151
 
41
- Style/BracesAroundHashParameters:
42
- Enabled: true
43
-
44
152
  Style/CaseEquality:
45
153
  Enabled: true
46
154
 
@@ -146,9 +254,15 @@ Style/RedundantException:
146
254
  Style/RedundantFreeze:
147
255
  Enabled: true
148
256
 
257
+ Style/RedundantInterpolation:
258
+ Enabled: true
259
+
149
260
  Style/RedundantParentheses:
150
261
  Enabled: true
151
262
 
263
+ Style/RedundantPercentQ:
264
+ Enabled: true
265
+
152
266
  Style/RedundantReturn:
153
267
  Enabled: true
154
268
 
@@ -182,12 +296,6 @@ Style/TrailingMethodEndStatement:
182
296
  Style/TrivialAccessors:
183
297
  Enabled: true
184
298
 
185
- Style/UnneededInterpolation:
186
- Enabled: true
187
-
188
- Style/UnneededPercentQ:
189
- Enabled: true
190
-
191
299
  Style/UnpackFirst:
192
300
  Enabled: true
193
301
 
data/CHANGELOG.md CHANGED
@@ -1,5 +1,149 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.4.0] - 2025-02-17
4
+
5
+ - Added support for Webauthn.config and RelayingParty to accept multiple allowed_origins. [#431](https://github.com/cedarcode/webauthn-ruby/pull/431)[@obroshnij]
6
+
7
+ ## [v3.3.0] - 2025-02-06
8
+
9
+ ### Added
10
+
11
+ - Updated `tpm-key_attestation` dependency from `~> 0.12.0` to `~> 0.14.0`. [#449](https://github.com/cedarcode/webauthn-ruby/pull/449) [@brauliomartinezlm], [@nicolastemciuc]
12
+
13
+ ## [v3.2.2] - 2024-11-14
14
+
15
+ ### Fixed
16
+
17
+ - Fix `PublicKeyCredential::Options#.as_json` not camelCase'ing keys of attributes with hash or arrays as values. [#445](https://github.com/cedarcode/webauthn-ruby/pull/445) [@santiagorodriguez96]
18
+
19
+ ## [v3.2.1] - 2024-11-14
20
+
21
+ ### Fixed
22
+
23
+ - Fix JSON Serializer generating json with attributes with a null value. [#442](https://github.com/cedarcode/webauthn-ruby/pull/442) @santiagorodriguez96
24
+
25
+ ## [v3.2.0] - 2024-11-13
26
+
27
+ ### Added
28
+
29
+ - Added `AuthenticatorAttestationResponse#transports` for accessing the response's `transports` value. [#421](https://github.com/cedarcode/webauthn-ruby/pull/421) [@santiagorodriguez96]
30
+ - `WebAuthn::AuthenticatorAssertionResponse#verify` and `WebAuthn::AuthenticatorAttestationResponse#verify`,
31
+ as well as `RelyingParty#verify_registration` and `RelyingParty#verify_authentication` now accept a `user_presence`
32
+ keyword arg in order to be able to skip the user presence check for specific attestation and assertion verifications.
33
+ By default, user presence will be checked unless `silent_authentication` is enabled for the Relying Party (as it was before).
34
+ [#432](https://github.com/cedarcode/webauthn-ruby/pull/432), [#434](https://github.com/cedarcode/webauthn-ruby/pull/434), [#435](https://github.com/cedarcode/webauthn-ruby/pull/435) ([@nov](https://github.com/nov), [@santiagorodriguez96])
35
+ - `WebAuthn::FakeClient#create` and `WebAuthn::FakeAuthenticator#make_credential` now support a `credential_algorithm` and
36
+ `algorithm` param (respectively) for choosing the algorithm to use for creating the credential.
37
+ Supported values are: 'ES256', 'RSA256' and 'EdDSA'. [#400](https://github.com/cedarcode/webauthn-ruby/pull/400), [#437](https://github.com/cedarcode/webauthn-ruby/pull/437) [@santiagorodriguez96]
38
+ - Remove `awrence` dependency. [#436](https://github.com/cedarcode/webauthn-ruby/pull/436) [@npezza](https://github.com/npezza93)
39
+ - Run tests with Ruby 3.3. [#416](https://github.com/cedarcode/webauthn-ruby/pull/416) [@santiagorodriguez96]
40
+ - Run tests with Ruby 3.4.0-preview2. [#436](https://github.com/cedarcode/webauthn-ruby/pull/436) [@npezza](https://github.com/npezza93)
41
+
42
+ ### Changed
43
+
44
+ - Remove unused class `AttestationTrustworthinessVerificationError`. [#412](https://github.com/cedarcode/webauthn-ruby/pull/412) [@soartec-lab]
45
+
46
+ ## [v3.1.0] - 2023-12-26
47
+
48
+ ### Added
49
+
50
+ - Add support for optional `authenticator_attachment` in `PublicKeyCredential`. #370 [@8ma10s]
51
+
52
+ ### Fixed
53
+
54
+ - Fix circular require warning between `webauthn/relying_party` and `webauthn/credential`. #389 [@bdewater]
55
+ - Correctly verify attestation that contains just a batch certificate that is present in the attestation root certificates. #406 [@santiagorodriguez96]
56
+
57
+ ### Changed
58
+
59
+ - Inlined `base64` implementation. #402 [@olleolleolle]
60
+ - Raise a more descriptive error if input `challenge` is `nil` when verifying the `PublicKeyCredential`. #413 [@soartec-lab]
61
+
62
+ ## [v3.0.0] - 2023-02-15
63
+
64
+ ### Added
65
+
66
+ - Add the capability of handling appid extension #319 [@santiagorodriguez96]
67
+ - Add support for credential backup flags #378 [@santiagorodriguez96]
68
+ - Update dependencies to make gem compatible with OpenSSL 3.1 ([@bdewater],[@santiagorodriguez96])
69
+
70
+ ## [v3.0.0.alpha2] - 2022-09-12
71
+
72
+ ### Added
73
+
74
+ - Rebased support for multiple relying parties from v3.0.0.alpha1 on top of v2.5.2, the previous alpha version was based on v2.3.0 ([@bdewater])
75
+
76
+ ### BREAKING CHANGES
77
+
78
+ - Bumped minimum required Ruby version to 2.5 ([@bdewater])
79
+
80
+ ## [v3.0.0.alpha1] - 2020-06-27
81
+
82
+ ### Added
83
+
84
+ - Ability to define multiple relying parties with the introduction of the `WebAuthn::RelyingParty` class ([@padulafacundo], [@brauliomartinezlm])
85
+
86
+ ## [v2.5.2] - 2022-07-13
87
+
88
+ ### Added
89
+
90
+ - Updated dependencies to make the gem compatible with openssl-3 [@ClearlyClaire]
91
+
92
+ ## [v2.5.1] - 2022-03-20
93
+
94
+ ### Added
95
+
96
+ - Updated openssl support to be ~>2.2 [@bdewater]
97
+
98
+ ### Removed
99
+
100
+ - Removed dependency [secure_compare dependency] (https://rubygems.org/gems/secure_compare/versions/0.0.1) and use OpenSSL#secure_compare instead [@bdewater]
101
+
102
+ ## [v2.5.0] - 2021-03-14
103
+
104
+ ### Added
105
+
106
+ - Support 'apple' attestation statement format ([#343](https://github.com/cedarcode/webauthn-ruby/pull/343) / [@juanarias93], [@santiagorodriguez96])
107
+ - Allow specifying an array of ids as `allow_credentials:` for `FakeClient#get` method ([#335](https://github.com/cedarcode/webauthn-ruby/pull/335) / [@kingjan1999])
108
+
109
+ ### Removed
110
+
111
+ - No longer accept "removed from the WebAuthn spec" options `rp: { icon: }` and `user: { icon: }` for `WebAuthn::Credential.options_for_create` method ([#326](https://github.com/cedarcode/webauthn-ruby/pull/326) / [@santiagorodriguez96])
112
+
113
+ ## [v2.4.1] - 2021-02-15
114
+
115
+ ### Fixed
116
+
117
+ - Fix verification of new credential if no attestation provided and 'None' type is not among configured `acceptable_attestation_types`. I.e. reject it instead of letting it go through.
118
+
119
+ ## [v2.4.0] - 2020-09-03
120
+
121
+ ### Added
122
+
123
+ - Support for ES256K credentials
124
+ - `FakeClient#get` accepts `user_handle:` keyword argument ([@lgarron])
125
+
126
+ ## [v2.3.0] - 2020-06-27
127
+
128
+ ### Added
129
+
130
+ - Ability to access extension outputs with `PublicKeyCredential#client_extension_outputs` and `PublicKeyCredential#authenticator_extension_outputs` ([@santiagorodriguez96])
131
+
132
+ ## [v2.2.1] - 2020-06-06
133
+
134
+ ### Fixed
135
+
136
+ - Fixed compatibility with OpenSSL-C (libssl) v1.0.2 ([@santiagorodriguez96])
137
+
138
+ ## [v2.2.0] - 2020-03-14
139
+
140
+ ### Added
141
+
142
+ - Verification step that checks the received credential public key algorithm during registration matches one of the configured algorithms
143
+ - [EXPERIMENTAL] Attestation trustworthiness verification default steps for "tpm", "android-key" and "android-safetynet" ([@bdewater], [@padulafacundo]). Still manual configuration needed for "packed" and "fido-u2f".
144
+
145
+ Note: Expect possible breaking changes for "EXPERIMENTAL" features.
146
+
3
147
  ## [v2.1.0] - 2019-12-30
4
148
 
5
149
  ### Added
@@ -273,6 +417,23 @@ Note: Both additions should help making it compatible with Chrome for Android 70
273
417
  - `WebAuthn::AuthenticatorAttestationResponse.valid?` can be used to validate fido-u2f attestations returned by the browser
274
418
  - Works with ruby 2.5
275
419
 
420
+ [v3.4.0]: https://github.com/cedarcode/webauthn-ruby/compare/v3.3.0...v3.4.0/
421
+ [v3.3.0]: https://github.com/cedarcode/webauthn-ruby/compare/v3.2.2...v3.3.0/
422
+ [v3.2.2]: https://github.com/cedarcode/webauthn-ruby/compare/v3.2.1...v3.2.2/
423
+ [v3.2.1]: https://github.com/cedarcode/webauthn-ruby/compare/v3.2.0...v3.2.1/
424
+ [v3.2.0]: https://github.com/cedarcode/webauthn-ruby/compare/v3.1.0...v3.2.0/
425
+ [v3.1.0]: https://github.com/cedarcode/webauthn-ruby/compare/v3.0.0...v3.1.0/
426
+ [v3.0.0]: https://github.com/cedarcode/webauthn-ruby/compare/2-stable...v3.0.0/
427
+ [v3.0.0.alpha2]: https://github.com/cedarcode/webauthn-ruby/compare/2-stable...v3.0.0.alpha2/
428
+ [v3.0.0.alpha1]: https://github.com/cedarcode/webauthn-ruby/compare/v2.3.0...v3.0.0.alpha1
429
+ [v2.5.2]: https://github.com/cedarcode/webauthn-ruby/compare/v2.5.1...v2.5.2/
430
+ [v2.5.1]: https://github.com/cedarcode/webauthn-ruby/compare/v2.5.0...v2.5.1/
431
+ [v2.5.0]: https://github.com/cedarcode/webauthn-ruby/compare/v2.4.1...v2.5.0/
432
+ [v2.4.1]: https://github.com/cedarcode/webauthn-ruby/compare/v2.4.0...v2.4.1/
433
+ [v2.4.0]: https://github.com/cedarcode/webauthn-ruby/compare/v2.3.0...v2.4.0/
434
+ [v2.3.0]: https://github.com/cedarcode/webauthn-ruby/compare/v2.2.1...v2.3.0/
435
+ [v2.2.1]: https://github.com/cedarcode/webauthn-ruby/compare/v2.2.0...v2.2.1/
436
+ [v2.2.0]: https://github.com/cedarcode/webauthn-ruby/compare/v2.1.0...v2.2.0/
276
437
  [v2.1.0]: https://github.com/cedarcode/webauthn-ruby/compare/v2.0.0...v2.1.0/
277
438
  [v2.0.0]: https://github.com/cedarcode/webauthn-ruby/compare/v1.18.0...v2.0.0/
278
439
  [v1.18.0]: https://github.com/cedarcode/webauthn-ruby/compare/v1.17.0...v1.18.0/
@@ -297,6 +458,7 @@ Note: Both additions should help making it compatible with Chrome for Android 70
297
458
  [v0.2.0]: https://github.com/cedarcode/webauthn-ruby/compare/v0.1.0...v0.2.0/
298
459
  [v0.1.0]: https://github.com/cedarcode/webauthn-ruby/compare/v0.0.0...v0.1.0/
299
460
 
461
+ [@brauliomartinezlm]: https://github.com/brauliomartinezlm
300
462
  [@bdewater]: https://github.com/bdewater
301
463
  [@jdongelmans]: https://github.com/jdongelmans
302
464
  [@kalebtesfay]: https://github.com/kalebtesfay
@@ -304,3 +466,10 @@ Note: Both additions should help making it compatible with Chrome for Android 70
304
466
  [@sorah]: https://github.com/sorah
305
467
  [@ssuttner]: https://github.com/ssuttner
306
468
  [@padulafacundo]: https://github.com/padulafacundo
469
+ [@santiagorodriguez96]: https://github.com/santiagorodriguez96
470
+ [@lgarron]: https://github.com/lgarron
471
+ [@juanarias93]: https://github.com/juanarias93
472
+ [@kingjan1999]: https://github.com/@kingjan1999
473
+ [@jdongelmans]: https://github.com/jdongelmans
474
+ [@petergoldstein]: https://github.com/petergoldstein
475
+ [@ClearlyClaire]: https://github.com/ClearlyClaire
data/CONTRIBUTING.md CHANGED
@@ -14,11 +14,6 @@
14
14
 
15
15
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake` to run the tests and code-style checks. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
16
16
 
17
- Some tests require stubbing time with [libfaketime](https://github.com/wolfcw/libfaketime) in order to pass, otherwise they're skipped. You can install this library with your package manager. Follow libfaketime's instructions for your OS to preload the library before running the tests, and use the `FAKETIME_NO_CACHE=1` option. E.g. when installed via homebrew on macOS:
18
- ```shell
19
- DYLD_INSERT_LIBRARIES=/usr/local/Cellar/libfaketime/2.9.7_1/lib/faketime/libfaketime.1.dylib DYLD_FORCE_FLAT_NAMESPACE=1 FAKETIME_NO_CACHE=1 bundle exec rspec
20
- ```
21
-
22
17
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
23
18
 
24
19
  ### Styleguide
data/README.md CHANGED
@@ -6,7 +6,7 @@ For the current release version see https://github.com/cedarcode/webauthn-ruby/b
6
6
  ![banner](assets/webauthn-ruby.png)
7
7
 
8
8
  [![Gem](https://img.shields.io/gem/v/webauthn.svg?style=flat-square)](https://rubygems.org/gems/webauthn)
9
- [![Travis](https://img.shields.io/travis/cedarcode/webauthn-ruby/master.svg?style=flat-square)](https://travis-ci.org/cedarcode/webauthn-ruby)
9
+ [![Build](https://github.com/cedarcode/webauthn-ruby/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/cedarcode/webauthn-ruby/actions/workflows/build.yml)
10
10
  [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-informational.svg?style=flat-square)](https://conventionalcommits.org)
11
11
  [![Join the chat at https://gitter.im/cedarcode/webauthn-ruby](https://badges.gitter.im/cedarcode/webauthn-ruby.svg)](https://gitter.im/cedarcode/webauthn-ruby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
12
12
 
@@ -16,7 +16,7 @@ Makes your Ruby/Rails web server become a functional [WebAuthn Relying Party](ht
16
16
 
17
17
  Takes care of the [server-side operations](https://www.w3.org/TR/webauthn/#rp-operations) needed to
18
18
  [register](https://www.w3.org/TR/webauthn/#registration) or [authenticate](https://www.w3.org/TR/webauthn/#authentication)
19
- a user [credential](https://www.w3.org/TR/webauthn/#public-key-credential), including the necessary cryptographic checks.
19
+ a user's [public key credential](https://www.w3.org/TR/webauthn/#public-key-credential) (also called a "passkey"), including the necessary cryptographic checks.
20
20
 
21
21
  ## Table of Contents
22
22
 
@@ -52,7 +52,7 @@ WebAuthn (Web Authentication) is a W3C standard for secure public-key authentica
52
52
 
53
53
  - WebAuthn [W3C Recommendation](https://www.w3.org/TR/webauthn/) (i.e. "The Standard")
54
54
  - [Web Authentication API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API) in MDN
55
- - How to use [WebAuthn in Android apps](https://developers.google.com/identity/fido/android/native-apps)
55
+ - How to use WebAuthn in native [Android](https://developers.google.com/identity/fido/android/native-apps) or [macOS/iOS/iPadOS](https://developer.apple.com/documentation/authenticationservices/public-private_key_authentication) apps.
56
56
  - [Security Benefits for WebAuthn Servers (a.k.a Relying Parties)](https://www.w3.org/TR/webauthn/#sctn-rp-benefits)
57
57
 
58
58
  ## Prerequisites
@@ -64,12 +64,12 @@ Known conformant pairs are, for example:
64
64
  - Google Chrome for Android 70+ and Android's Fingerprint-based platform authenticator
65
65
  - Microsoft Edge and Windows 10 platform authenticator
66
66
  - Mozilla Firefox for Desktop and Yubico's Security Key roaming authenticator via USB
67
+ - Safari in iOS 13.3+ and YubiKey 5 NFC via NFC
67
68
 
68
- For a detailed picture about what is conformant and what not, you can refer to:
69
-
70
- - [apowers313/fido2-webauthn-status](https://github.com/apowers313/fido2-webauthn-status)
71
- - [FIDO certified products](https://fidoalliance.org/certification/fido-certified-products)
69
+ For a complete list:
72
70
 
71
+ - User Agents (Clients): [Can I Use: Web Authentication API](https://caniuse.com/#search=webauthn)
72
+ - Authenticators: [FIDO certified products](https://fidoalliance.org/certification/fido-certified-products) (search for Type=Authenticator and Specification=FIDO2)
73
73
 
74
74
  ## Install
75
75
 
@@ -89,20 +89,23 @@ Or install it yourself as:
89
89
 
90
90
  ## Usage
91
91
 
92
- 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).
92
+ You can find a working example on how to use this gem in a pasword-less login in a __Rails__ app in [webauthn-rails-demo-app](https://github.com/cedarcode/webauthn-rails-demo-app). If you want to see an example on how to use this gem as a second factor authenticator in a __Rails__ application instead, you can check it in [webauthn-2fa-rails-demo](https://github.com/cedarcode/webauthn-2fa-rails-demo).
93
93
 
94
94
  If you are migrating an existing application from the legacy FIDO U2F JavaScript API to WebAuthn, also refer to
95
95
  [`docs/u2f_migration.md`](docs/u2f_migration.md).
96
96
 
97
97
  ### Configuration
98
98
 
99
+ If you have a multi-tenant application or just need to configure WebAuthn differently for separate parts of your application (e.g. if your users authenticate to different subdomains in the same application), we strongly recommend you look at this [Advanced Configuration](docs/advanced_configuration.md) section instead of this.
100
+
99
101
  For a Rails application this would go in `config/initializers/webauthn.rb`.
100
102
 
101
103
  ```ruby
102
104
  WebAuthn.configure do |config|
103
105
  # This value needs to match `window.location.origin` evaluated by
104
106
  # the User Agent during registration and authentication ceremonies.
105
- config.origin = "https://auth.example.com"
107
+ # Multiple origins can be used when needed. Using more than one will imply you MUST configure rp_id explicitely. If you need your credentials to be bound to a single origin but you have more than one tenant, please see [our Advanced Configuration section](https://github.com/cedarcode/webauthn-ruby/blob/master/docs/advanced_configuration.md) instead of adding multiple origins.
108
+ config.allowed_origins = ["https://auth.example.com"]
106
109
 
107
110
  # Relying Party name for display purposes
108
111
  config.rp_name = "Example Inc."
@@ -150,7 +153,7 @@ if !user.webauthn_id
150
153
  end
151
154
 
152
155
  options = WebAuthn::Credential.options_for_create(
153
- user: { id: user.webauthn_id, name: user.name }
156
+ user: { id: user.webauthn_id, name: user.name },
154
157
  exclude: user.credentials.map { |c| c.webauthn_id }
155
158
  )
156
159
 
@@ -252,6 +255,54 @@ rescue WebAuthn::Error => e
252
255
  end
253
256
  ```
254
257
 
258
+ ### Extensions
259
+
260
+ > The mechanism for generating public key credentials, as well as requesting and generating Authentication assertions, as defined in Web Authentication API, can be extended to suit particular use cases. Each case is addressed by defining a registration extension and/or an authentication extension.
261
+
262
+ > When creating a public key credential or requesting an authentication assertion, a WebAuthn Relying Party can request the use of a set of extensions. These extensions will be invoked during the requested ceremony if they are supported by the WebAuthn Client and/or the WebAuthn Authenticator. The Relying Party sends the client extension input for each extension in the get() call (for authentication extensions) or create() call (for registration extensions) to the WebAuthn client. [[source](https://www.w3.org/TR/webauthn-2/#sctn-extensions)]
263
+
264
+ Extensions can be requested in the initiation phase in both Credential Registration and Authentication ceremonies by adding the extension parameter when generating the options for create/get:
265
+
266
+ ```ruby
267
+ # Credential Registration
268
+ creation_options = WebAuthn::Credential.options_for_create(
269
+ user: { id: user.webauthn_id, name: user.name },
270
+ exclude: user.credentials.map { |c| c.webauthn_id },
271
+ extensions: { appidExclude: domain.to_s }
272
+ )
273
+
274
+ # OR
275
+
276
+ # Credential Authentication
277
+ options = WebAuthn::Credential.options_for_get(
278
+ allow: user.credentials.map { |c| c.webauthn_id },
279
+ extensions: { appid: domain.to_s }
280
+ )
281
+ ```
282
+
283
+ Consequently, after these `options` are sent to the WebAuthn client:
284
+
285
+ > The WebAuthn client performs client extension processing for each extension that the client supports, and augments the client data as specified by each extension, by including the extension identifier and client extension output values.
286
+
287
+ > For authenticator extensions, as part of the client extension processing, the client also creates the CBOR authenticator extension input value for each extension (often based on the corresponding client extension input value), and passes them to the authenticator in the create() call (for registration extensions) or the get() call (for authentication extensions).
288
+
289
+ > The authenticator, in turn, performs additional processing for the extensions that it supports, and returns the CBOR authenticator extension output for each as specified by the extension. Part of the client extension processing for authenticator extensions is to use the authenticator extension output as an input to creating the client extension output. [[source](https://www.w3.org/TR/webauthn-2/#sctn-extensions)]
290
+
291
+ Finally, you can check the values returned for each extension by calling `client_extension_outputs` and `authenticator_extension_outputs` respectively.
292
+ For example, following the initialization phase for the Credential Authentication ceremony specified in the above example:
293
+
294
+ ```ruby
295
+ webauthn_credential = WebAuthn::Credential.from_get(credential_get_result_hash)
296
+
297
+ webauthn_credential.client_extension_outputs #=> { "appid" => true }
298
+ webauthn_credential.authenticator_extension_outputs #=> nil
299
+ ```
300
+
301
+ A list of all currently defined extensions:
302
+
303
+ - [Last published version](https://www.w3.org/TR/webauthn-2/#sctn-defined-extensions)
304
+ - [Next version (in draft)](https://w3c.github.io/webauthn/#sctn-defined-extensions)
305
+
255
306
  ## API
256
307
 
257
308
  #### `WebAuthn.generate_user_id`
@@ -342,25 +393,40 @@ credential_with_assertion.verify(
342
393
  )
343
394
  ```
344
395
 
396
+ #### `PublicKeyCredential#client_extension_outputs`
397
+
398
+ ```ruby
399
+ credential = WebAuthn::Credential.from_create(params[:publicKeyCredential])
400
+
401
+ credential.client_extension_outputs
402
+ ```
403
+
404
+ #### `PublicKeyCredential#authenticator_extension_outputs`
405
+
406
+ ```ruby
407
+ credential = WebAuthn::Credential.from_create(params[:publicKeyCredential])
408
+
409
+ credential.authenticator_extension_outputs
410
+ ```
411
+
345
412
  ## Attestation
346
413
 
347
- ### Attestation Statement Format
414
+ ### Attestation Statement Formats
348
415
 
349
416
  | Attestation Statement Format | Supported? |
350
417
  | -------- | :--------: |
351
418
  | packed (self attestation) | Yes |
352
419
  | packed (x5c attestation) | Yes |
353
- | packed (ECDAA attestation) | No |
354
420
  | tpm (x5c attestation) | Yes |
355
- | tpm (ECDAA attestation) | No |
356
421
  | android-key | Yes |
357
422
  | android-safetynet | Yes |
423
+ | apple | Yes |
358
424
  | fido-u2f | Yes |
359
425
  | none | Yes |
360
426
 
361
427
  ### Attestation Types
362
428
 
363
- You can define what trust policy to enforce by setting `acceptable_attestation_types` config to a subset of `['None', 'Self', 'Basic', 'AttCA', 'Basic_or_AttCA']` and `attestation_root_certificates_finders` to an object that responds to `#find` and returns the corresponding root certificate for each registration. The `#find` method will be called passing keyword arguments `attesation_format`, `aaguid` and `attestation_certificate_key_id`.
429
+ You can define what trust policy to enforce by setting `acceptable_attestation_types` config to a subset of `['None', 'Self', 'Basic', 'AttCA', 'Basic_or_AttCA']` and `attestation_root_certificates_finders` to an object that responds to `#find` and returns the corresponding root certificate for each registration. The `#find` method will be called passing keyword arguments `attestation_format`, `aaguid` and `attestation_certificate_key_id`.
364
430
 
365
431
  ## Testing Your Integration
366
432
 
data/SECURITY.md CHANGED
@@ -4,11 +4,14 @@
4
4
 
5
5
  | Version | Supported |
6
6
  | ------- | ------------------ |
7
- | 2.1.z | :white_check_mark: |
8
- | 2.0.z | :white_check_mark: |
7
+ | 2.5.z | :white_check_mark: |
8
+ | 2.4.z | :white_check_mark: |
9
+ | 2.3.z | :white_check_mark: |
10
+ | 2.2.z | :x: |
11
+ | 2.1.z | :x: |
12
+ | 2.0.z | :x: |
9
13
  | 1.18.z | :white_check_mark: |
10
- | 1.17.z | :white_check_mark: |
11
- | < 1.17 | :x: |
14
+ | < 1.18 | :x: |
12
15
 
13
16
  ## Reporting a Vulnerability
14
17