fido_metadata 0.3.0 → 0.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/.travis.yml +13 -2
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/lib/fido_metadata.rb +6 -1
- data/lib/fido_metadata/client.rb +1 -1
- data/lib/fido_metadata/store.rb +15 -4
- data/lib/fido_metadata/table_of_contents.rb +4 -0
- data/lib/fido_metadata/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0c6e9096d99e10cec5ea15b15be0d472ef3ec60e58378505af0bae9851b6292a
|
|
4
|
+
data.tar.gz: 8d2221965bf30f01241fad4753a76cf7889ac61262a1af9b2e68bb93837afc48
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fb89e5eec3d127872bfd90663f5a25e14554aff9bed9cdc058fed1b394d148f6a6057a7148aa40271360f217b2efb150c1f8525ee041ae19f7acaa3ad0eadc86
|
|
7
|
+
data.tar.gz: 8a708a7fa370ad71a29bb42517061d95d2608b20ce92514e58004216e6b826d5d8fdc3ffb45e433197c5699f05b9a6746363f64e476b7ad936380aae0dea753c
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
---
|
|
2
|
-
sudo: false
|
|
3
2
|
language: ruby
|
|
4
3
|
cache: bundler
|
|
5
4
|
rvm:
|
|
6
5
|
- 2.6.5
|
|
7
|
-
|
|
6
|
+
- 2.5.7
|
|
7
|
+
- 2.4.9
|
|
8
|
+
- 2.3.8
|
|
9
|
+
script:
|
|
10
|
+
- bin/rspec
|
|
11
|
+
jobs:
|
|
12
|
+
fast_finish: true
|
|
13
|
+
include:
|
|
14
|
+
- rvm: 2.6.5
|
|
15
|
+
name: Rubocop
|
|
16
|
+
script:
|
|
17
|
+
- bundle info rubocop
|
|
18
|
+
- bin/rubocop
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.4.0] - 2019-12-28
|
|
10
|
+
### Added
|
|
11
|
+
- Set `expires_in` and `race_condition_ttl` options during caching.
|
|
12
|
+
|
|
9
13
|
## [0.3.0] - 2019-11-24
|
|
10
14
|
### Changed
|
|
11
15
|
- Made `FidoMetada::TestCacheStore` available for gem users. It is not required by default.
|
|
@@ -26,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
26
30
|
- Extracted from [webauthn-ruby PR 208](https://github.com/cedarcode/webauthn-ruby/pull/208) after discussion with the maintainers. Thanks for the feedback @grzuy and @brauliomartinezlm!
|
|
27
31
|
|
|
28
32
|
[Unreleased]: https://github.com/bdewater/fido_metadata/compare/v0.2.0...HEAD
|
|
33
|
+
[0.4.0]: https://github.com/bdewater/fido_metadata/compare/v0.3.0...v0.4.0
|
|
29
34
|
[0.3.0]: https://github.com/bdewater/fido_metadata/compare/v0.2.0...v0.3.0
|
|
30
35
|
[0.2.0]: https://github.com/bdewater/fido_metadata/compare/v0.1.0...v0.2.0
|
|
31
36
|
[0.1.0]: https://github.com/bdewater/fido_metadata/releases/tag/v0.1.0
|
data/Gemfile.lock
CHANGED
data/lib/fido_metadata.rb
CHANGED
|
@@ -5,7 +5,11 @@ require "fido_metadata/version"
|
|
|
5
5
|
|
|
6
6
|
module FidoMetadata
|
|
7
7
|
def self.configuration
|
|
8
|
-
@configuration ||=
|
|
8
|
+
@configuration ||= begin
|
|
9
|
+
c = Configuration.new
|
|
10
|
+
c.race_condition_ttl = 1
|
|
11
|
+
c
|
|
12
|
+
end
|
|
9
13
|
end
|
|
10
14
|
|
|
11
15
|
def self.configure
|
|
@@ -15,5 +19,6 @@ module FidoMetadata
|
|
|
15
19
|
class Configuration
|
|
16
20
|
attr_accessor :metadata_token
|
|
17
21
|
attr_accessor :cache_backend
|
|
22
|
+
attr_accessor :race_condition_ttl
|
|
18
23
|
end
|
|
19
24
|
end
|
data/lib/fido_metadata/client.rb
CHANGED
|
@@ -89,7 +89,7 @@ module FidoMetadata
|
|
|
89
89
|
crls = uris.compact.uniq.map do |uri|
|
|
90
90
|
begin
|
|
91
91
|
get(uri)
|
|
92
|
-
rescue Net::
|
|
92
|
+
rescue Net::ProtocolError
|
|
93
93
|
# TODO: figure out why test endpoint specifies a missing and unused CRL in the cert chain, and see if this
|
|
94
94
|
# rescue can be removed. If the CRL is used, OpenSSL error 3 (unable to get certificate CRL) will raise.
|
|
95
95
|
nil
|
data/lib/fido_metadata/store.rb
CHANGED
|
@@ -7,16 +7,18 @@ require "fido_metadata/statement"
|
|
|
7
7
|
module FidoMetadata
|
|
8
8
|
class Store
|
|
9
9
|
METADATA_ENDPOINT = URI("https://mds2.fidoalliance.org/")
|
|
10
|
+
TOC_CACHE_KEY = "metadata_toc"
|
|
11
|
+
STATEMENT_CACHE_KEY = "statement_%s"
|
|
10
12
|
|
|
11
13
|
def table_of_contents
|
|
12
14
|
@table_of_contents ||= begin
|
|
13
|
-
key =
|
|
15
|
+
key = TOC_CACHE_KEY
|
|
14
16
|
toc = cache_backend.read(key)
|
|
15
17
|
return toc if toc
|
|
16
18
|
|
|
17
19
|
json = client.download_toc(METADATA_ENDPOINT)
|
|
18
20
|
toc = FidoMetadata::TableOfContents.from_json(json)
|
|
19
|
-
cache_backend.write(key, toc)
|
|
21
|
+
cache_backend.write(key, toc, expires_in: toc.expires_in, race_condition_ttl: race_condition_ttl)
|
|
20
22
|
toc
|
|
21
23
|
end
|
|
22
24
|
end
|
|
@@ -38,7 +40,7 @@ module FidoMetadata
|
|
|
38
40
|
def fetch_statement(aaguid: nil, attestation_certificate_key_id: nil)
|
|
39
41
|
verify_arguments(aaguid: aaguid, attestation_certificate_key_id: attestation_certificate_key_id)
|
|
40
42
|
|
|
41
|
-
key =
|
|
43
|
+
key = STATEMENT_CACHE_KEY % (aaguid || attestation_certificate_key_id)
|
|
42
44
|
statement = cache_backend.read(key)
|
|
43
45
|
return statement if statement
|
|
44
46
|
|
|
@@ -51,7 +53,12 @@ module FidoMetadata
|
|
|
51
53
|
|
|
52
54
|
json = client.download_entry(entry.url, expected_hash: entry.hash)
|
|
53
55
|
statement = FidoMetadata::Statement.from_json(json)
|
|
54
|
-
cache_backend.write(
|
|
56
|
+
cache_backend.write(
|
|
57
|
+
key,
|
|
58
|
+
statement,
|
|
59
|
+
expires_in: table_of_contents.expires_in,
|
|
60
|
+
race_condition_ttl: race_condition_ttl
|
|
61
|
+
)
|
|
55
62
|
statement
|
|
56
63
|
end
|
|
57
64
|
|
|
@@ -75,6 +82,10 @@ module FidoMetadata
|
|
|
75
82
|
FidoMetadata.configuration.metadata_token || raise("no metadata_token configured")
|
|
76
83
|
end
|
|
77
84
|
|
|
85
|
+
def race_condition_ttl
|
|
86
|
+
FidoMetadata.configuration.race_condition_ttl
|
|
87
|
+
end
|
|
88
|
+
|
|
78
89
|
def client
|
|
79
90
|
@client ||= FidoMetadata::Client.new(metadata_token)
|
|
80
91
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fido_metadata
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bart de Water
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-12-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: jwt
|
|
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
179
179
|
- !ruby/object:Gem::Version
|
|
180
180
|
version: '0'
|
|
181
181
|
requirements: []
|
|
182
|
-
rubygems_version: 3.
|
|
182
|
+
rubygems_version: 3.1.2
|
|
183
183
|
signing_key:
|
|
184
184
|
specification_version: 4
|
|
185
185
|
summary: FIDO Alliance Metadata Service client
|