Skip to content

Commit

Permalink
feature(conformanceTests): use MDS v3
Browse files Browse the repository at this point in the history
  • Loading branch information
santiagorodriguez96 committed Feb 19, 2024
1 parent 981dc49 commit f133ae1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 35 deletions.
32 changes: 19 additions & 13 deletions spec/conformance/MDSROOT.crt
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
-----BEGIN CERTIFICATE-----
MIICZzCCAe6gAwIBAgIPBF0rd3WL/GExWV/szYNVMAoGCCqGSM49BAMDMGcxCzAJ
BgNVBAYTAlVTMRYwFAYDVQQKDA1GSURPIEFsbGlhbmNlMScwJQYDVQQLDB5GQUtF
IE1ldGFkYXRhIFRPQyBTaWduaW5nIEZBS0UxFzAVBgNVBAMMDkZBS0UgUm9vdCBG
QUtFMB4XDTE3MDIwMTAwMDAwMFoXDTQ1MDEzMTIzNTk1OVowZzELMAkGA1UEBhMC
VVMxFjAUBgNVBAoMDUZJRE8gQWxsaWFuY2UxJzAlBgNVBAsMHkZBS0UgTWV0YWRh
dGEgVE9DIFNpZ25pbmcgRkFLRTEXMBUGA1UEAwwORkFLRSBSb290IEZBS0UwdjAQ
BgcqhkjOPQIBBgUrgQQAIgNiAARcVLd6r4fnNHzs5K2zfbg//4X9/oBqmsdRVtZ9
iXhlgM9vFYaKviYtqmwkq0D3Lihg3qefeZgXXYi4dFgvzU7ZLBapSNM3CT8RDBe/
MBJqsPwaRQbIsGmmItmt/ESNQD6jYDBeMAsGA1UdDwQEAwIBBjAPBgNVHRMBAf8E
BTADAQH/MB0GA1UdDgQWBBTd95rIHO/hX9Oh69szXzD0ahmZWTAfBgNVHSMEGDAW
gBTd95rIHO/hX9Oh69szXzD0ahmZWTAKBggqhkjOPQQDAwNnADBkAjBkP3L99KEX
QzviJVGytDMWBmITMBYv1LgNXXiSilWixTyQqHrYrFpLvNFyPZQvS6sCMFMAOUCw
Ach/515XH0XlDbMgdIe2N4zzdY77TVwiHmsxTFWRT0FtS7fUk85c/Lz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X4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecs
Mx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH
WD9f
-----END CERTIFICATE-----
23 changes: 4 additions & 19 deletions spec/conformance/conformance_cache_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

class ConformanceCacheStore < FidoMetadata::TestCacheStore
FILENAME = "metadata.zip"
METADATA_ENDPOINT = URI("https://mds.fidoalliance.org/")

def setup_authenticators
puts("#{FILENAME} not found, this will affect Metadata Service Test results.") unless File.exist?(FILENAME)
Expand All @@ -18,27 +19,11 @@ def setup_authenticators
end
end

def setup_metadata_store(endpoint)
def setup_metadata_store
puts("Setting up metadata store TOC")

response = Net::HTTP.post(
URI("https://mds.certinfra.fidoalliance.org/getEndpoints"),
{ endpoint: endpoint }.to_json,
FidoMetadata::Client::DEFAULT_HEADERS
)

response.value
possible_endpoints = JSON.parse(response.body)["result"]

client = FidoMetadata::Client.new(nil)

json =
possible_endpoints.each_with_index do |uri, index|
puts("Trying endpoint #{index}: #{uri}")
break client.download_toc(URI(uri), trusted_certs: conformance_certificates)
rescue FidoMetadata::Client::DataIntegrityError, JWT::VerificationError, Net::HTTPFatalError
nil
end
client = FidoMetadata::Client.new
json = client.download_toc(METADATA_ENDPOINT, trusted_certs: conformance_certificates)

if json.is_a?(Hash) && json.keys == ["legalHeader", "no", "nextUpdate", "entries"]
puts("TOC setup done!")
Expand Down
5 changes: 2 additions & 3 deletions spec/conformance/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,15 @@ def self.registered_for(username)

mds_finder =
MDSFinder.new.tap do |mds|
mds.token = ""
mds.cache_backend = ConformanceCacheStore.new
mds.cache_backend.setup_authenticators
mds.cache_backend.setup_metadata_store("http://#{host}:#{settings.port}")
mds.cache_backend.setup_metadata_store
end

relying_party = WebAuthn::RelyingParty.new(
origin: "http://#{host}:#{settings.port}",
name: RP_NAME,
algorithms: %w(ES256 ES384 ES512 PS256 PS384 PS512 RS256 RS384 RS512 RS1),
algorithms: %w(ES256 ES384 ES512 PS256 PS384 PS512 RS256 RS384 RS512 RS1 EdDSA),
silent_authentication: true,
attestation_root_certificates_finders: mds_finder
)
Expand Down

0 comments on commit f133ae1

Please sign in to comment.