Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conformance 1.7.20 4 #531

Merged
merged 20 commits into from
Oct 18, 2024
Merged

conformance 1.7.20 4 #531

merged 20 commits into from
Oct 18, 2024

Conversation

abergs
Copy link
Collaborator

@abergs abergs commented Jul 16, 2024

This is based on #456 and results in a 100% pass on the v1.7.20-4 tool.

image

  • FIDO Conformance Tools v1.7.15 fixes
  • Json serialization fix
  • Unit test fix
  • tokenbindig, AppId, UVP
  • unit test fix (tokenbinding dto parsing)
  • fix azure pipeline
  • Improve trustanchor test coverage
  • TestPackedttestationAsyncFailTrustAnchorOnRootCertInTrustPath only works on Windows
  • Do not make this private
  • Keep Tokenbinding around
  • Update AuthenticatorAssertionResponse.cs
  • Added XML comments to requestTokenBinding

@codecov-commenter
Copy link

codecov-commenter commented Jul 16, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 67.39130% with 15 lines in your changes missing coverage. Please review.

Project coverage is 74.79%. Comparing base (cb71a15) to head (97762f6).
Report is 20 commits behind head on master.

Files with missing lines Patch % Lines
Src/Fido2/TokenBindingDto.cs 20.00% 6 Missing and 2 partials ⚠️
...ls/Objects/AuthenticationExtensionsClientInputs.cs 0.00% 2 Missing ⚠️
Src/Fido2/AuthenticatorAttestationResponse.cs 50.00% 1 Missing and 1 partial ⚠️
Src/Fido2.Models/CredentialCreateOptions.cs 50.00% 1 Missing ⚠️
Src/Fido2/AuthenticatorAssertionResponse.cs 66.66% 0 Missing and 1 partial ⚠️
Src/Fido2/TrustAnchor.cs 94.11% 0 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #531      +/-   ##
==========================================
+ Coverage   73.95%   74.79%   +0.84%     
==========================================
  Files          98      102       +4     
  Lines        2638     2742     +104     
  Branches      446      464      +18     
==========================================
+ Hits         1951     2051     +100     
+ Misses        586      582       -4     
- Partials      101      109       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

if (trustPath.Length > 1 && attestationRootCertificates.Any(c => string.Equals(c.Thumbprint, trustPath[^1].Thumbprint, StringComparison.Ordinal)))
{
throw new Fido2VerificationException(Fido2ErrorMessages.InvalidCertificateChain);
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aseigler Would appreciate your eyes here too, but to me it just looks like we have the addition of above if-block that is more strict than without it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abergs Are we able to reference the rule in https://datatracker.ietf.org/doc/html/rfc5280 that this new condition enforces?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps @googyi could help us here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#456

TrustAnchor.cs : 32
This exact testcase was fixed with this (conformance tests v1.7.15):

Server-ServerAuthenticatorAttestationResponse-Resp-5 Test server processing "packed" FULL attestation F-10 Send ServerAuthenticatorAttestationResponse with FULL "packed" attestation, with attStmt.x5c containing full chain, and check that server returns an error https://datatracker.ietf.org/doc/html/rfc5280#section-6.1

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@googyi Thanks for chiming in. What part of the datatracker.ietf.org/doc/html/rfc5280#section-6.1 is deciding checking the last entry of the trustpath to root certs?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this 6.1 section was referenced in that testcase, I don't know which part describes this exactly.
This looks almost like that:

"When the trust anchor is provided in the form of a self-signed
certificate, this self-signed certificate is not included as part of
the prospective certification path."

But I am not sure that this is a self-signed cert.

Copy link
Collaborator Author

@abergs abergs Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6.1 also mentions " A certificate MUST NOT appear more than once in a prospective
certification path." which may be fixed by this? (although in a non-conclusive way)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible. My goal was not to understand the whole RFC or become an expert in cert validation.
I wanted to reach a state where conformance tests are passed.
So it may be buggy.

Test/CryptoUtilsTests.cs Outdated Show resolved Hide resolved
@abergs
Copy link
Collaborator Author

abergs commented Jul 16, 2024

@aseigler See mentions. If you don't have time too look at them at the moment I might move those changes to a secondary PR wand wait for your review, while still landing some of these fixes.

@abergs abergs requested a review from aseigler July 16, 2024 09:36
@abergs abergs force-pushed the conformance-1.7.20-4 branch from 1de524b to 745bcdb Compare July 16, 2024 10:05
Gabor Mihaly and others added 15 commits July 16, 2024 19:34
TrustAnchor.cs : 32
Server-ServerAuthenticatorAttestationResponse-Resp-5 Test server processing "packed" FULL attestation
F-10 Send ServerAuthenticatorAttestationResponse with FULL "packed" attestation, with attStmt.x5c containing full chain, and check that server returns an error
https://datatracker.ietf.org/doc/html/rfc5280#section-6.1

AuthenticatorAttestationRawResponse.cs : 18
Server-ServerAuthenticatorAttestationResponse-Resp-1 Test server processing ServerAuthenticatorAttestationResponse structure
F-4 Send ServerAuthenticatorAttestationResponse that is missing "type" field and check that server returns an error

CredentialCreateOptions.cs : 96
Server-ServerAuthenticatorAttestationResponse-Resp-4 Test server support of the authentication algorithms
P-8 Send a valid ServerAuthenticatorAttestationResponse with SELF "packed" attestation, for "ALG_SIGN_RSASSA_PKCSV15_SHA1_RAW" aka "RS1" algorithm, and check that server succeeds
Server-ServerAuthenticatorAttestationResponse-Resp-9 Test server processing "tpm" attestation
P-2 Send a valid ServerAuthenticatorAttestationResponse with "tpm" attestation for SHA-1, and check that server succeeds

CredentialCreateOptions.cs  : 210
Server-ServerPublicKeyCredentialCreationOptions-Req-1 Test server generating ServerPublicKeyCredentialCreationOptionsRequest
P-1 Get ServerPublicKeyCredentialCreationOptionsResponse, and check that: (a) response MUST contain ...

AuthenticationExtensionsClientInputs.cs : 23 public string AppID { private get; set; }
Server-ServerPublicKeyCredentialGetOptionsResponse-Req-1 Test server generating ServerPublicKeyCredentialGetOptionsResponse
P-1 Get ServerPublicKeyCredentialGetOptionsResponse, and check that: (a) response MUST contain ...

AuthenticationExtensionsClientInputs.cs :  44 public bool? UserVerificationMethod { private get; set; }
Server-ServerPublicKeyCredentialGetOptionsResponse-Req-1 Test server generating ServerPublicKeyCredentialGetOptionsResponse
P-1 Get ServerPublicKeyCredentialGetOptionsResponse, and check that: (a) response MUST contain ...

AuthenticatorAssertionResponse.cs : 128
Server-ServerAuthenticatorAssertionResponse-Resp-3
P4,P6,P7

CryptoUtils.cs 64 (trustpath length 1 with exact match in attestation root certs)
Server-ServerAuthenticatorAttestationResponse-Resp-5 Test server processing "packed" FULL attestation
P-3 Send a valid ServerAuthenticatorAttestationResponse with FULL "packed" attestation that contains batch certificate, that is simply self referenced in the metadata, and check that server succeeds

CryptoUtils.cs 105 - X509RevocationMode.Online makes conformance sad
Server-ServerAuthenticatorAttestationResponse-Resp-9 Test server processing "tpm" attestation
P-1 Send a valid ServerAuthenticatorAttestationResponse with "tpm" attestation for SHA-256, and check that server succeeds‣
P-2 Send a valid ServerAuthenticatorAttestationResponse with "tpm" attestation for SHA-1, and check that server succeeds‣
P-3 Send a valid ServerAuthenticatorAttestationResponse with "tpm" attestation pubArea.nameAlg is not matching algorithm used for generate attested.name, and check that server succeeds

TestController.cs tojson -> serialize
serialization error
Json serialization fix. (Object type vs ToJson())
Back to 100% conformance.
TokenBinding logic readded.
AppId: prevent serialization in a nicer way.
UV flags are verified differently for conformance testing, otherwise as described in the RFC.
fix azure pipeline's whitespace error + removing unused using
Improve trustanchor test coverage based on codecov report
@abergs abergs force-pushed the conformance-1.7.20-4 branch from 745bcdb to 11121e6 Compare July 16, 2024 17:35
Src/Fido2/TokenBindingDto.cs Outdated Show resolved Hide resolved
Src/Fido2/Extensions/CryptoUtils.cs Outdated Show resolved Hide resolved
Src/Fido2/Fido2.cs Show resolved Hide resolved
Src/Fido2/Fido2.cs Show resolved Hide resolved
Src/Fido2/IFido2.cs Show resolved Hide resolved
Src/Fido2/TrustAnchor.cs Outdated Show resolved Hide resolved
I'm keeping these around until we've understood if we really can drop them
@abergs abergs force-pushed the conformance-1.7.20-4 branch from f64fc63 to dfa6f72 Compare October 18, 2024 11:26
@abergs abergs merged commit 0f9f0cb into master Oct 18, 2024
11 checks passed
@abergs abergs deleted the conformance-1.7.20-4 branch October 18, 2024 11:51
@abergs abergs added this to the Version 4 milestone Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants