Skip to content

Digest challenge - realm fails with empty string #56369

Closed

Description

@camillo-toselli

The issue is similar to #50283 but this time about realm key. For example:

	WWW-Authenticate : Digest realm="", nonce="NjBGRkMxNjUgY2FiN2YxZDM1MWM4ZDAyOTRiMmY2ZGVjOGMxMDY2Zjg=", algorithm="MD5", qop="auth"

will fail with error Nonce missing

RFC7616 says realm SHOULD contain al least the name of the server, but not MUST contain, so it doesn't exclude an empty realm

	This string should contain at least the name of the host performing the authentication
	and might additionally indicate the collection of users who might have access.

This lines of method Parse in class System.Net.Http.AuthenticationHelper.DigestResponse

	// Ensure value is valid.
	// Opaque and Domain can have empty string
	if (value == string.Empty &&
	   (!key.Equals(Opaque, StringComparison.OrdinalIgnoreCase) && !key.Equals(Domain, StringComparison.OrdinalIgnoreCase)))
	    break;

should be modified to allow empty Realm value

Activity

  1. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Jul 27, 2021
  2. added and removed
    untriagedNew issue has not been triaged by the area owner
    on Jul 27, 2021
  3. added this to the 7.0.0 milestone on Jul 27, 2021
  4. karelz commented on Jul 27, 2021

    @karelz
    Member

    Triage: Seems legit. Are you interested in submitting PR for it?
    Otherwise, moving to 7.0. Should be fairly straightforward to fix.

  5. added
    help wanted[up-for-grabs] Good issue for external contributors
    on Jul 27, 2021
  6. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Jul 28, 2021
  7. 23 remaining items

  8. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Nov 4, 2021
  9. karelz commented on Nov 4, 2021

    @karelz
    Member

    @bompani will you be able to validate on private (unsigned) binaries that the fix addresses your problem?

  10. bompani commented on Nov 5, 2021

    @bompani

    Yes I'm able to validate on private binaries. Can I download the PR buld or have I to build it myself?

  11. karelz commented on Nov 5, 2021

    @karelz
    Member

    Great!
    Building it yourself is of course an option.

    The PR has build artifacts - libraries_bin_* e.g.:

    Grab System.Net.Http.dll (in directory bin\runtime\net5.0-Windows_NT-Debug-x64 of the zip) and replace it in your local installation (tip: make a copy of the original file first). The debug build should work with locally-installed release build, but I am not 100% sure -- if you hit any problems, let me know (I would build binaries you need locally - I would need the OS/bitness info you need), or you can compile it yourself if you are set up to do that.
    Run the repro before replacing the binary to make sure it repros and then after you replace the binary to make sure it works correctly with the new bits.

  12. bompani commented on Nov 5, 2021

    @bompani

    I can confirm that the PR build resolves our problem.
    Thanks.

  13. karelz commented on Nov 5, 2021

    @karelz
    Member

    Thanks for validation @bompani!
    Which OS / architecture did you validate? Did you use the build artifacts, or your local build?

  14. bompani commented on Nov 5, 2021

    @bompani

    I validated my local build of branch backport/pr-56455-to-release/5.0 on Windows10/x64

  15. karelz commented on Nov 5, 2021

    @karelz
    Member

    Thanks for confirmation @bompani!

  16. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Nov 8, 2021
  17. karelz commented on Nov 9, 2021

    @karelz
    Member

    The bug is fixed:

  18. modified the milestones: 6.0.0, 5.0.x on Nov 9, 2021
  19. ghost locked as resolved and limited conversation to collaborators on Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions