Skip to content

Commit e082a67

Browse files
aseiglerdgorbach
andauthored
change origin verify to use fully qualified origin (#213)
see also duo-labs/webauthn#60 Co-authored-by: dgorbach <[email protected]>
1 parent 086a0f8 commit e082a67

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Src/Fido2/AuthenticatorResponse.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected void BaseVerify(string expectedOrigin, byte[] originalChallenge, byte[
6868
throw new Fido2VerificationException("Challenge not equal to original challenge");
6969

7070
// 5. Verify that the value of C.origin matches the Relying Party's origin.
71-
if (Origin != expectedOrigin)
71+
if (!string.Equals(FullyQualifiedOrigin(this.Origin), expectedOrigin, StringComparison.OrdinalIgnoreCase))
7272
throw new Fido2VerificationException($"Origin {Origin} not equal to original origin {expectedOrigin}");
7373

7474
// 6. Verify that the value of C.tokenBinding.status matches the state of Token Binding for the TLS connection over which the assertion was obtained.
@@ -78,5 +78,12 @@ protected void BaseVerify(string expectedOrigin, byte[] originalChallenge, byte[
7878
TokenBinding.Verify(requestTokenBindingId);
7979
}
8080
}
81+
82+
private string FullyQualifiedOrigin(string origin)
83+
{
84+
var uri = new Uri(origin);
85+
86+
return $"{uri.Scheme}://{uri.Host}";
87+
}
8188
}
8289
}

0 commit comments

Comments
 (0)