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

[release/5.0] Fix NegotiateStream handling of EOF #43741

Merged
merged 2 commits into from
Nov 14, 2020

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Oct 23, 2020

Backport of #43739 to release/5.0

/cc @stephentoub

Customer Impact

Due to a refactoring during 5.0, reaching EOF in a NegotiateStream would throw rather than return 0 or -1 as it should. This is a regression from previous releases.

To my knowledge (and http://index, http://source.dot.net, http://grep.app, and https://apisof.net/catalog/System.Net.Security.NegotiateStream), there are very few consumers of NegotiateStream… except for WCF, which has a strong dependency. However, WCF explicitly avoids this pattern, never reading via the NegotiateStream to its end, and as such, it avoids this bug. So, while this would be quickly hit on .NET 5 for anyone using NegotiateStream with typical consumption patterns, it’s probable it’ll impact few to no codebases immediately.

Testing

This was found while writing a new test suite for stream conformance in general and applying it to NegotiateStream. With the fix, all existing and new tests pass.

Risk

Low. The fix is isolated and easily reviewed for correctness.

In my refactoring of NegotiateStream to use async/await, I broke its handling of EOF, with it throwing an exception instead of returning 0.  This fixes it to correctly handle EOF.
@geoffkizer
Copy link
Contributor

The last commit is 5.0-only, correct?

@stephentoub
Copy link
Member

Yes

@danmoseley danmoseley added the Servicing-consider Issue for next servicing release review label Oct 23, 2020
@danmoseley danmoseley added this to the 5.0.x milestone Oct 23, 2020
@danmoseley
Copy link
Member

Waiting for 5.0.1

@leecow leecow added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Oct 27, 2020
@leecow leecow modified the milestones: 5.0.x, 5.0.1 Oct 27, 2020
@danmoseley
Copy link
Member

Approved, waiting for branch to open mid Nov

@danmoseley
Copy link
Member

Tactics comments: OK for 5.0.1, for later servicing we might want to wait for customer evidence of impact.

@Anipik Anipik merged commit ecb0360 into release/5.0 Nov 14, 2020
@stephentoub stephentoub deleted the backport/pr-43739-to-release/5.0 branch November 17, 2020 22:51
@ghost ghost locked as resolved and limited conversation to collaborators Dec 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Meta Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants