Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Mention the breaking change on reading CryptoStream in .NET 6. #7379

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

Merged
merged 6 commits into from
Nov 12, 2021

Conversation

PatrickHofman
Copy link
Contributor

Summary

As mentioned in dotnet/core#6895, a breaking change was implemented on reading CryptoStream on .NET 6. This edit adds some pointers to that in the CryptoStream documentation.

@PatrickHofman PatrickHofman requested a review from a team as a code owner November 11, 2021 10:15
@ghost ghost added the area-System.Security Issues related to security practices for .NET developers. label Nov 11, 2021
@ghost
Copy link

ghost commented Nov 11, 2021

Tagging subscribers to this area: @bartonjs, @vcsjones, @krwq, @GrabYourPitchforks
See info in area-owners.md if you want to be subscribed.

Issue Details

Summary

As mentioned in dotnet/core#6895, a breaking change was implemented on reading CryptoStream on .NET 6. This edit adds some pointers to that in the CryptoStream documentation.

Author: PatrickHofman
Assignees: -
Labels:

area-System.Security

Milestone: -

@opbld32
Copy link

opbld32 commented Nov 11, 2021

Docs Build status updates of commit db6c6b8:

✅ Validation status: passed

File Status Preview URL Details
xml/System.Security.Cryptography/CryptoStream.xml ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

@danmoseley
Copy link
Member

I suggested this note here as so far we've had two or three reports of it breaking folks.

@danmoseley danmoseley requested a review from gewarren November 11, 2021 13:04
xml/System.Security.Cryptography/CryptoStream.xml Outdated Show resolved Hide resolved
@bartonjs
Copy link
Member

The technical content LGTM, withholding a checkmark to make sure that voice and style get the OK.

It feels a little redundant to me, since that's what the general contract for streams is (though the zero length buffer thing is an inconsistent edge case)... but I agree that it has come up enough that people were clearly depending on CryptoStream behaving this way and might not realize that it was in the minority for having done so.

@danmoseley
Copy link
Member

danmoseley commented Nov 11, 2021

I wonder whether we might want to word this instead as just documentation behavior eg

### Remarks 
...
When `Stream.Read` or `Stream.ReadAsync` is called with a buffer of length `N`, the operation completes when:

> - At least one byte has been read from the stream, or
> - The underlying stream they wrap returns 0 from a call to read, indicating no more data is available.
> Also, when `Stream.Read` or `Stream.ReadAsync` is called with a buffer of length 0, the operation succeeds once a call with a non-zero buffer would succeed.

This follows the standard contract for streams. 

Previous to .NET 6.0, `Stream.Read` and `Stream.ReadAsync` would not return until `N` bytes had been read from the stream, or the underlying stream returned 0 from a call to read. Code that assumed they would not return until all `N` bytes were read could fail to read all the content. See (this document)[https://docs.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/6.0/partial-byte-reads-in-streams] for more information.

or something like that. Basically, favor the future rather than the past!

@danmoseley
Copy link
Member

How's this? We should add to DeflateStream and GZipStream as well

@opbld32
Copy link

opbld32 commented Nov 12, 2021

Docs Build status updates of commit a67645f:

✅ Validation status: passed

File Status Preview URL Details
xml/System.Security.Cryptography/CryptoStream.xml ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

Copy link
Contributor

@gewarren gewarren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some formatting suggestions.

xml/System.Security.Cryptography/CryptoStream.xml Outdated Show resolved Hide resolved
xml/System.Security.Cryptography/CryptoStream.xml Outdated Show resolved Hide resolved
xml/System.Security.Cryptography/CryptoStream.xml Outdated Show resolved Hide resolved
xml/System.Security.Cryptography/CryptoStream.xml Outdated Show resolved Hide resolved
danmoseley and others added 2 commits November 11, 2021 23:36
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
@danmoseley
Copy link
Member

Thanks. Good to merge?

@opbld32
Copy link

opbld32 commented Nov 12, 2021

Docs Build status updates of commit 22fb7b5:

✅ Validation status: passed

File Status Preview URL Details
xml/System.Security.Cryptography/CryptoStream.xml ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

@opbld32
Copy link

opbld32 commented Nov 12, 2021

Docs Build status updates of commit 0411e2d:

✅ Validation status: passed

File Status Preview URL Details
xml/System.Security.Cryptography/CryptoStream.xml ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

@dnfadmin
Copy link

dnfadmin commented Nov 12, 2021

CLA assistant check
All CLA requirements met.

@opbld33
Copy link

opbld33 commented Nov 12, 2021

Docs Build status updates of commit f6adf51:

✅ Validation status: passed

File Status Preview URL Details
xml/System.Security.Cryptography/CryptoStream.xml ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

@opbld34
Copy link

opbld34 commented Nov 12, 2021

Docs Build status updates of commit f6adf51:

✅ Validation status: passed

File Status Preview URL Details
xml/System.Security.Cryptography/CryptoStream.xml ✅Succeeded View

For more details, please refer to the build report.

Note: Broken links written as relative paths are included in the above build report. For broken links written as absolute paths or external URLs, see the broken link report.

For any questions, please:

@gewarren gewarren merged commit 284ebb7 into dotnet:main Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Security Issues related to security practices for .NET developers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.