Skip to content

Commit f738501

Browse files
authored
Merge pull request #51 from aseigler/master
New conformance tool requirements for UP/UV and some metadata defense
2 parents e56a6b4 + 66845f5 commit f738501

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

fido2-net-lib/AuthenticatorAssertionResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public async Task<AssertionVerificationResult> VerifyAsync(AssertionOptions opti
113113
// See Server-ServerAuthenticatorAssertionResponse-Resp3 Test server processing authenticatorData
114114
// P-5 Send a valid ServerAuthenticatorAssertionResponse both authenticatorData.flags.UV and authenticatorData.flags.UP are not set, for userVerification set to "preferred", and check that server succeeds
115115
// P-8 Send a valid ServerAuthenticatorAssertionResponse both authenticatorData.flags.UV and authenticatorData.flags.UP are not set, for userVerification set to "discouraged", and check that server succeeds
116-
if ((false == authData.UserPresent) && (options.UserVerification != UserVerificationRequirement.Discouraged && options.UserVerification != UserVerificationRequirement.Preferred)) throw new Fido2VerificationException("User Present flag not set in authenticator data");
116+
//if ((false == authData.UserPresent) && (options.UserVerification != UserVerificationRequirement.Discouraged && options.UserVerification != UserVerificationRequirement.Preferred)) throw new Fido2VerificationException("User Present flag not set in authenticator data");
117117

118118
// 13 If user verification is required for this assertion, verify that the User Verified bit of the flags in aData is set.
119119
// UNLESS...userPresent is true?

fido2-net-lib/MetadataService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ private MDSMetadata(string accessToken, string cachedirPath)
345345
// If we have both, we can read from either and update cache as necessary
346346
_accessToken = accessToken;
347347
_cacheDir = cachedirPath;
348-
if (0x30 != _accessToken.Length && 3 > _cacheDir.Length) throw new Fido2VerificationException("Either MDSAccessToken or CacheDir is required to instantiate Metadata instance");
348+
if (null != _accessToken && 0x30 != _accessToken.Length && null != _cacheDir && 3 > _cacheDir.Length) throw new Fido2VerificationException("Either MDSAccessToken or CacheDir is required to instantiate Metadata instance");
349349

350350
payload = new System.Collections.Generic.Dictionary<System.Guid, MetadataTOCPayloadEntry>();
351351
// If we have a cache directory, let's try that first
@@ -363,7 +363,7 @@ private MDSMetadata(string accessToken, string cachedirPath)
363363
}
364364
}
365365
// If the payload count is still zero and we have what looks like a good access token, load from MDS
366-
if (0 == payload.Count && 0x30 == _accessToken.Length)
366+
if (0 == payload.Count && null != _accessToken && 0x30 == _accessToken.Length)
367367
{
368368
GetTOCPayload(false);
369369
}
@@ -486,7 +486,7 @@ private MetadataStatement GetMetadataStatement(MetadataTOCPayloadEntry entry, bo
486486
var client = new System.Net.WebClient();
487487
rawStatement = client.DownloadString(entry.Url + tokenParamName + _accessToken);
488488
}
489-
if (3 < _cacheDir.Length)
489+
if (null != _cacheDir && 3 < _cacheDir.Length)
490490
{
491491
if (false == System.IO.Directory.Exists(_cacheDir)) System.IO.Directory.CreateDirectory(_cacheDir);
492492
var filename = _cacheDir + @"\" + entry.AaGuid + @".jwt";
@@ -508,7 +508,7 @@ public void GetTOCPayload(bool fromCache)
508508
{
509509
mdsToc = client.DownloadString(mds2url + tokenParamName + _accessToken);
510510

511-
if (3 < _cacheDir.Length)
511+
if (null != _cacheDir && 3 < _cacheDir.Length)
512512
{
513513
if (false == System.IO.Directory.Exists(_cacheDir)) System.IO.Directory.CreateDirectory(_cacheDir);
514514
System.IO.File.WriteAllText(_cacheDir + @"\" + "mdstoc.jwt", mdsToc, System.Text.Encoding.UTF8);

0 commit comments

Comments
 (0)