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

Digest challenge - domain fails with empty string #50283

Closed
gao-artur opened this issue Mar 26, 2021 · 11 comments · Fixed by #50348
Closed

Digest challenge - domain fails with empty string #50283

gao-artur opened this issue Mar 26, 2021 · 11 comments · Fixed by #50348
Milestone

Comments

@gao-artur
Copy link

The issue is similar to #32943 but this time about domain key. For example:

www-authenticate: Digest realm="MMS Public API", domain="", nonce="NA42+vpOFQd1GwCyVRZuhhy+jDn4BMRl", algorithm=MD5, qop="auth", stale=false

will fail with error Nonce missing

RFC7616 explicitly says domain can be empty

If this parameter is
omitted or its value is empty, the client SHOULD assume that the
protection space consists of all URIs on the web-origin.

@dotnet-issue-labeler dotnet-issue-labeler bot added area-System.Net untriaged New issue has not been triaged by the area owner labels Mar 26, 2021
@ghost
Copy link

ghost commented Mar 26, 2021

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

The issue is similar to #32943 but this time about domain key. For example:

www-authenticate: Digest realm="MMS Public API", domain="", nonce="NA42+vpOFQd1GwCyVRZuhhy+jDn4BMRl", algorithm=MD5, qop="auth", stale=false

will fail with error Nonce missing

RFC7616 explicitly says domain can be empty

If this parameter is
omitted or its value is empty, the client SHOULD assume that the
protection space consists of all URIs on the web-origin.

Author: gao-artur
Assignees: -
Labels:

area-System.Net, untriaged

Milestone: -

@wfurt
Copy link
Member

wfurt commented Mar 28, 2021

yes, the empty domain does seems like the culprit. I think it make sense to treat empty domain as missing.

@wfurt wfurt removed the untriaged New issue has not been triaged by the area owner label Mar 28, 2021
@wfurt wfurt added this to the 6.0.0 milestone Mar 28, 2021
@gao-artur
Copy link
Author

@wfurt thanks for confirming!
Just want to add that this issue is critical for users of .Net 5 and Atlas MongoDB. In .Net Core 3.1 it was possible to workaround this with AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false); but it doesn't work anymore in .Net 5.

@wfurt
Copy link
Member

wfurt commented Mar 29, 2021

Yah, old handler is gone. I wish it was brought up when found broken with 3.1 instead of using the workaround.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Mar 29, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Mar 30, 2021
@wfurt wfurt reopened this Mar 30, 2021
@wfurt wfurt modified the milestones: 6.0.0, 5.0.x Mar 30, 2021
@wfurt
Copy link
Member

wfurt commented Mar 30, 2021

Could you verify the fix with 6.0 @gao-artur when the build gets out? (https://github.com/dotnet/installer)

@gao-artur
Copy link
Author

@wfurt which version should I use? I have installed 6.0.100-preview.4.21179.16, but the issue still persist:

>dotnet --list-sdks
1.0.4 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.508 [C:\Program Files\dotnet\sdk]
2.1.509 [C:\Program Files\dotnet\sdk]
2.1.513 [C:\Program Files\dotnet\sdk]
2.2.109 [C:\Program Files\dotnet\sdk]
2.2.207 [C:\Program Files\dotnet\sdk]
2.2.402 [C:\Program Files\dotnet\sdk]
3.1.100 [C:\Program Files\dotnet\sdk]
3.1.401 [C:\Program Files\dotnet\sdk]
5.0.201 [C:\Program Files\dotnet\sdk]
6.0.100-preview.4.21179.16 [C:\Program Files\dotnet\sdk]

Private.InternalDiagnostics.System.Net.Http logs:

AuthenticationInfo : https://cloud.mongodb.com/api/atlas/v1.0/groups/***REDUCTED***/databaseUsers,Server authentication requested with WWW-Authenticate header value 'Digest realm="MMS Public API", domain="", nonce="gHS0Q1hxlp8+DhEGB28pfLDxC2rMRL7Z", algorithm=MD5, qop="auth", stale=false'
AuthenticationInfo : https://cloud.mongodb.com/api/atlas/v1.0/groups/***REDUCTED***/databaseUsers,Authentication scheme 'Digest' selected. Client username=***REDUCTED***
ErrorMessage : DigestResponse#3129430,GetDigestTokenForCredential,Nonce missing
AuthenticationError : https://cloud.mongodb.com/api/atlas/v1.0/groups/***REDUCTED***/databaseUsers,Unable to find 'Digest' authentication token when authenticating with server
AuthenticationError : https://cloud.mongodb.com/api/atlas/v1.0/groups/***REDUCTED***/databaseUsers,Server authentication failed.

Loaded asseblies:
image

@wfurt
Copy link
Member

wfurt commented Mar 30, 2021

Looking at shared/Microsoft.NETCore.App/6.0.0-preview.4.21178.6/.version it seems like lates included change is 102d1e8
So the fix did not roll in yet. Unfortunately I don't know when exactly this will happen. It seems like the current build is ~ 2days behind runtime changes.

@gao-artur
Copy link
Author

Verified with 6.0.100-preview.4.21181.20 and it works. Thanks!

@wfurt
Copy link
Member

wfurt commented Apr 1, 2021

Thanks for confirmation @gao-artur. I'll open PR for 5.0 and check if servicing is willing take the fix.

@karelz
Copy link
Member

karelz commented Jul 27, 2021

@wfurt did we ever initiate the backport check? It seems like we didn't ... is it still interesting?

@gao-artur have you heard about more users of Atlas MongoDB hitting the issue?

@wfurt
Copy link
Member

wfurt commented Jul 27, 2021

#50598 in 5.0.6.
Seems like It was referencing the PR, not this issue.

@wfurt wfurt closed this as completed Jul 27, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Aug 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants