fido_metadata 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/.rubocop.yml +196 -0
  4. data/.travis.yml +7 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +8 -0
  7. data/Gemfile.lock +77 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +90 -0
  10. data/Rakefile +12 -0
  11. data/bin/console +24 -0
  12. data/bin/rspec +29 -0
  13. data/bin/rubocop +29 -0
  14. data/bin/setup +8 -0
  15. data/fido_metadata.gemspec +42 -0
  16. data/lib/Root.cer +15 -0
  17. data/lib/fido_metadata.rb +19 -0
  18. data/lib/fido_metadata/attributes.rb +37 -0
  19. data/lib/fido_metadata/biometric_accuracy_descriptor.rb +15 -0
  20. data/lib/fido_metadata/biometric_status_report.rb +18 -0
  21. data/lib/fido_metadata/client.rb +120 -0
  22. data/lib/fido_metadata/code_accuracy_descriptor.rb +14 -0
  23. data/lib/fido_metadata/coercer/assumed_value.rb +19 -0
  24. data/lib/fido_metadata/coercer/bit_field.rb +22 -0
  25. data/lib/fido_metadata/coercer/certificates.rb +16 -0
  26. data/lib/fido_metadata/coercer/date.rb +15 -0
  27. data/lib/fido_metadata/coercer/escaped_uri.rb +17 -0
  28. data/lib/fido_metadata/coercer/magic_number.rb +24 -0
  29. data/lib/fido_metadata/coercer/objects.rb +18 -0
  30. data/lib/fido_metadata/coercer/user_verification_details.rb +36 -0
  31. data/lib/fido_metadata/constants.rb +91 -0
  32. data/lib/fido_metadata/entry.rb +25 -0
  33. data/lib/fido_metadata/pattern_accuracy_descriptor.rb +13 -0
  34. data/lib/fido_metadata/statement.rb +57 -0
  35. data/lib/fido_metadata/status_report.rb +20 -0
  36. data/lib/fido_metadata/store.rb +82 -0
  37. data/lib/fido_metadata/table_of_contents.rb +17 -0
  38. data/lib/fido_metadata/verification_method_descriptor.rb +20 -0
  39. data/lib/fido_metadata/version.rb +5 -0
  40. metadata +196 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7feb05dd5eac0b351f74073c80c16f1c7c7f6701a88be33eac7d6877af2a0478
4
+ data.tar.gz: bfd36220edd79a54cccea8a1b4ebbfa303a067d86e75cc6c3942a64b090009f4
5
+ SHA512:
6
+ metadata.gz: 7774a0c247e959267e946d09aeda636690ddf446f2120335133b76ad4c77bed62718ce83182f5cbf161577b2596fda2c31bdb34ca5d5b40aa888c2af61eae3f1
7
+ data.tar.gz: 365630d2b485aebbb372e47b4d9bcbc8c804e275ecf436af56b3b91de1876bfa5085a7c803881183c1f0704a7c8b1d70e0f0330f45a6d052699f7144533873cc
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/.rubocop.yml ADDED
@@ -0,0 +1,196 @@
1
+ inherit_mode:
2
+ merge:
3
+ - AllowedNames
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 2.3
7
+ DisabledByDefault: true
8
+ Exclude:
9
+ - "gemfiles/**/*"
10
+
11
+ Bundler:
12
+ Enabled: true
13
+
14
+ Gemspec:
15
+ Enabled: true
16
+
17
+ Layout:
18
+ Enabled: true
19
+
20
+ Lint:
21
+ Enabled: true
22
+
23
+ Metrics/LineLength:
24
+ Max: 120
25
+
26
+ Naming:
27
+ Enabled: true
28
+
29
+ Security:
30
+ Enabled: true
31
+
32
+ Style/BlockComments:
33
+ Enabled: true
34
+
35
+ Style/BracesAroundHashParameters:
36
+ Enabled: true
37
+
38
+ Style/CaseEquality:
39
+ Enabled: true
40
+
41
+ Style/ClassAndModuleChildren:
42
+ Enabled: true
43
+
44
+ Style/ClassMethods:
45
+ Enabled: true
46
+
47
+ Style/ClassVars:
48
+ Enabled: true
49
+
50
+ Style/CommentAnnotation:
51
+ Enabled: true
52
+
53
+ Style/ConditionalAssignment:
54
+ Enabled: true
55
+
56
+ Style/DefWithParentheses:
57
+ Enabled: true
58
+
59
+ Style/Dir:
60
+ Enabled: true
61
+
62
+ Style/EachForSimpleLoop:
63
+ Enabled: true
64
+
65
+ Style/EachWithObject:
66
+ Enabled: true
67
+
68
+ Style/EmptyBlockParameter:
69
+ Enabled: true
70
+
71
+ Style/EmptyCaseCondition:
72
+ Enabled: true
73
+
74
+ Style/EmptyElse:
75
+ Enabled: true
76
+
77
+ Style/EmptyLambdaParameter:
78
+ Enabled: true
79
+
80
+ Style/EmptyLiteral:
81
+ Enabled: true
82
+
83
+ Style/EvenOdd:
84
+ Enabled: true
85
+
86
+ Style/ExpandPathArguments:
87
+ Enabled: true
88
+
89
+ Style/For:
90
+ Enabled: true
91
+
92
+ Style/FrozenStringLiteralComment:
93
+ Enabled: true
94
+
95
+ Style/GlobalVars:
96
+ Enabled: true
97
+
98
+ Style/HashSyntax:
99
+ Enabled: true
100
+
101
+ Style/IdenticalConditionalBranches:
102
+ Enabled: true
103
+
104
+ Style/IfInsideElse:
105
+ Enabled: true
106
+
107
+ Style/InverseMethods:
108
+ Enabled: true
109
+
110
+ Style/MethodCallWithoutArgsParentheses:
111
+ Enabled: true
112
+
113
+ Style/MethodDefParentheses:
114
+ Enabled: true
115
+
116
+ Style/MultilineMemoization:
117
+ Enabled: true
118
+
119
+ Style/MutableConstant:
120
+ Enabled: true
121
+
122
+ Style/NestedParenthesizedCalls:
123
+ Enabled: true
124
+
125
+ Style/OptionalArguments:
126
+ Enabled: true
127
+
128
+ Style/ParenthesesAroundCondition:
129
+ Enabled: true
130
+
131
+ Style/RedundantBegin:
132
+ Enabled: true
133
+
134
+ Style/RedundantConditional:
135
+ Enabled: true
136
+
137
+ Style/RedundantException:
138
+ Enabled: true
139
+
140
+ Style/RedundantFreeze:
141
+ Enabled: true
142
+
143
+ Style/RedundantParentheses:
144
+ Enabled: true
145
+
146
+ Style/RedundantReturn:
147
+ Enabled: true
148
+
149
+ Style/RedundantSelf:
150
+ Enabled: true
151
+
152
+ Style/Semicolon:
153
+ Enabled: true
154
+
155
+ Style/SingleLineMethods:
156
+ Enabled: true
157
+
158
+ Style/SpecialGlobalVars:
159
+ Enabled: true
160
+
161
+ Style/SymbolLiteral:
162
+ Enabled: true
163
+
164
+ Style/StringLiterals:
165
+ Enabled: true
166
+ EnforcedStyle: double_quotes
167
+
168
+ Style/TrailingBodyOnClass:
169
+ Enabled: true
170
+
171
+ Style/TrailingBodyOnMethodDefinition:
172
+ Enabled: true
173
+
174
+ Style/TrailingBodyOnModule:
175
+ Enabled: true
176
+
177
+ Style/TrailingMethodEndStatement:
178
+ Enabled: true
179
+
180
+ Style/TrivialAccessors:
181
+ Enabled: true
182
+
183
+ Style/UnneededInterpolation:
184
+ Enabled: true
185
+
186
+ Style/UnneededPercentQ:
187
+ Enabled: true
188
+
189
+ Style/UnpackFirst:
190
+ Enabled: true
191
+
192
+ Style/YodaCondition:
193
+ Enabled: true
194
+
195
+ Style/ZeroLengthPredicate:
196
+ Enabled: true
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.5
7
+ before_install: gem install bundler -v 1.17.3
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at bartdewater@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in fido_metadata.gemspec
8
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,77 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fido_metadata (0.1.0)
5
+ jwt (~> 2.0)
6
+ securecompare (~> 1.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.7.0)
12
+ public_suffix (>= 2.0.2, < 5.0)
13
+ ast (2.4.0)
14
+ byebug (11.0.1)
15
+ coderay (1.1.2)
16
+ crack (0.4.3)
17
+ safe_yaml (~> 1.0.0)
18
+ diff-lcs (1.3)
19
+ hashdiff (1.0.0)
20
+ jaro_winkler (1.5.4)
21
+ jwt (2.2.1)
22
+ method_source (0.9.2)
23
+ parallel (1.18.0)
24
+ parser (2.6.5.0)
25
+ ast (~> 2.4.0)
26
+ pry (0.12.2)
27
+ coderay (~> 1.1.0)
28
+ method_source (~> 0.9.0)
29
+ pry-byebug (3.7.0)
30
+ byebug (~> 11.0)
31
+ pry (~> 0.10)
32
+ public_suffix (4.0.1)
33
+ rainbow (3.0.0)
34
+ rake (10.5.0)
35
+ rspec (3.9.0)
36
+ rspec-core (~> 3.9.0)
37
+ rspec-expectations (~> 3.9.0)
38
+ rspec-mocks (~> 3.9.0)
39
+ rspec-core (3.9.0)
40
+ rspec-support (~> 3.9.0)
41
+ rspec-expectations (3.9.0)
42
+ diff-lcs (>= 1.2.0, < 2.0)
43
+ rspec-support (~> 3.9.0)
44
+ rspec-mocks (3.9.0)
45
+ diff-lcs (>= 1.2.0, < 2.0)
46
+ rspec-support (~> 3.9.0)
47
+ rspec-support (3.9.0)
48
+ rubocop (0.75.0)
49
+ jaro_winkler (~> 1.5.1)
50
+ parallel (~> 1.10)
51
+ parser (>= 2.6)
52
+ rainbow (>= 2.2.2, < 4.0)
53
+ ruby-progressbar (~> 1.7)
54
+ unicode-display_width (>= 1.4.0, < 1.7)
55
+ ruby-progressbar (1.10.1)
56
+ safe_yaml (1.0.5)
57
+ securecompare (1.0.0)
58
+ unicode-display_width (1.6.0)
59
+ webmock (3.7.6)
60
+ addressable (>= 2.3.6)
61
+ crack (>= 0.3.2)
62
+ hashdiff (>= 0.4.0, < 2.0.0)
63
+
64
+ PLATFORMS
65
+ ruby
66
+
67
+ DEPENDENCIES
68
+ bundler (~> 1.17)
69
+ fido_metadata!
70
+ pry-byebug
71
+ rake (~> 10.0)
72
+ rspec (~> 3.8)
73
+ rubocop (= 0.75.0)
74
+ webmock (~> 3.6)
75
+
76
+ BUNDLED WITH
77
+ 1.17.3
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Bart de Water
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # FidoMetadata
2
+
3
+ A Ruby gem for the [FIDO Alliance Metadata Service (MDS)](https://fidoalliance.org/metadata/). The MDS is a way to retrieve data about FIDO2 and U2F authenticators such as make, model, biometric capabilities, security status and the manufacturer root certificate(s). See [FIDO TechNotes: The Truth about Attestation](https://fidoalliance.org/fido-technotes-the-truth-about-attestation/) for a generic overview.
4
+
5
+ This gem provides a HTTP client for the MDS that performs the necessary security checks, parses the data into objects, and caches the results for speed and resiliency. It is intended to be used by WebAuthn relying parties wishing to verify attestation statement during registration.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'fido_metadata'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install fido_metadata
22
+
23
+ ## Usage
24
+
25
+ First, you need to [register for an access token](https://mds2.fidoalliance.org/tokens/). You can configure the gem as follows:
26
+ ```ruby
27
+ FidoMetadata.configure do |config|
28
+ config.metadata_token = "your token"
29
+ end
30
+ ```
31
+
32
+ Then you can query the table of contents (TOC):
33
+ ```ruby
34
+ store = FidoMetadata::Store.new
35
+ toc = store.table_of_contents
36
+ # `toc.entries` returns an array of FidoMetadata::Entry objects, see
37
+ # https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-metadata-service-v2.0-ps-20170927.html#metadata-toc-payload-entry-dictionary
38
+
39
+ ```
40
+
41
+ Retrieve metadata statement via the authenticator `aaguid` (FIDO2) or `attestation_certificate_key_id` (U2F):
42
+ ```ruby
43
+ store.fetch_statement(aaguid: "0132d110-bf4e-4208-a403-ab4f5f12efe5")
44
+ # returns a FidoMetadata::Statement object, see
45
+ # https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-metadata-statement-v2.0-ps-20170927.html#types
46
+ ```
47
+
48
+ ### Integrating the cache backend
49
+
50
+ The cache interface is compatible with Rails' [`ActiveSupport::Cache::Store`](https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html), which means you can configure the gem to use your existing cache or a separate one:
51
+
52
+ ```ruby
53
+ FidoMetadata.configure do |config|
54
+ config.cache_backend = Rails.cache # or something like `ActiveSupport::Cache::FileStore.new(...)`
55
+ end
56
+ ```
57
+
58
+ It is also possible to implement your own backend for using any datastore you'd like, such as your database. The interface you need to implement is as follows:
59
+
60
+ ```ruby
61
+ class CustomMetadataCacheStore
62
+ def read(name, _options = nil)
63
+ # deserialize and return `value`
64
+ end
65
+ def write(name, value, _options = nil)
66
+ # serialize and store `value` so it can be looked up using `name`
67
+ end
68
+ end
69
+
70
+ # and configure the gem to use it:
71
+ FidoMetadata.configure do |config|
72
+ config.cache_backend = CustomMetadataCacheStore.new
73
+ end
74
+ ```
75
+
76
+ ## Development
77
+
78
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
79
+
80
+ 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).
81
+
82
+ ## Contributing
83
+
84
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bdewater/fido_metadata. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
85
+
86
+ ## License
87
+
88
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
89
+
90
+ The gem and its authors are unaffiliated with the FIDO Alliance. The FIDO and FIDO ALLIANCE trademarks and logos are trademarks of FIDO Alliance, Inc.