Skip to content

Merging internal commits for release/9.0 - #130722

Merged
mrek-msft merged 16 commits into
release/9.0from
internal-merge-9.0-2026-07-14-2017
Jul 16, 2026
Merged

Merging internal commits for release/9.0#130722
mrek-msft merged 16 commits into
release/9.0from
internal-merge-9.0-2026-07-14-2017

Conversation

@dotnet-bot

Copy link
Copy Markdown
Collaborator

No description provided.

rzikm and others added 16 commits April 14, 2026 13:29
Fix CRLF encoding in EightBitStream

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix to correctly handle CRLF encoding across write boundaries in `EightBitStream`.

#### PR Summary
Fixes delayed CR handling so CRLF detection and dot-stuffing remain correct when a write ends with `\r`.  
- `src/libraries/System.Net.Mail/src/System/Net/Mime/EightBitStream.cs`: Refactored `EncodeLines` to process a `ReadOnlySpan<byte>` and added `_lastWriteEndedWithCr` state to defer writing `\r` until confirming a following `\n`.  
- `src/libraries/System.Net.Mail/src/System/Net/Mime/EightBitStream.cs`: Added `Dispose` override to flush a pending trailing `\r` to the underlying stream.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->


----
#### AI description  (iteration 1)
#### PR Classification
Bug fix addressing incorrect CRLF (carriage return line feed) encoding handling in the EightBitStream class.

#### PR Summary
Fixes a bug in CRLF encoding by deferring the writing of CR characters until determining if they're part of a CRLF sequence, preventing incorrect line ending handling when CR and LF bytes are split across buffer boundaries.

- `EightBitStream.cs`: Added `_lastWriteEndedWithCr` flag to track when a write operation ends with a CR byte, enabling proper CRLF detection across buffer boundaries
- `EightBitStream.cs`: Modified `EncodeLines()` method to defer writing CR bytes until the next byte is examined to confirm CRLF sequence
- `EightBitStream.cs`: Implemented `Dispose()` method override to write any deferred CR byte during stream disposal
- `EightBitStream.cs`: Changed `EncodeLines()` signature to accept `ReadOnlySpan<byte>` instead of separate buffer, offset, and count parameters
…S packets

Fix SslStream handshake with malformed TLS packets

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix for handling malformed TLS packets during SSL/TLS handshake to prevent potential security issues.

#### PR Summary
This pull request fixes a security vulnerability where malformed TLS packets during handshake could cause improper error handling. The fix ensures that invalid TLS frame headers are properly detected and throw appropriate exceptions instead of silently failing.

- `TlsFrameHelper.cs`: Added explicit `return false` for unknown TLS frame formats instead of continuing with invalid data
- `SslStream.IO.cs`: Enhanced frame validation in `ProcessTlsFrame` to throw `AuthenticationException` when `TryGetFrameHeader` fails, and consolidated error handling in `ReadFrameAsync` to use consistent exception types
- `SslStreamStreamToStreamTest.cs`: Added test `MalformedPacketsDuringHandshake_ThrowsIOException` to verify that malformed TLS packets during handshake properly throw `AuthenticationException`
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
…ed on unsupported platforms.

Throw PNSE when Extended Protection is used on unsupported platforms.

----
#### AI description  (iteration 1)
#### PR Classification
Bug fix to throw PlatformNotSupportedException when Extended Protection is used on platforms that don't support it.

#### PR Summary
This PR adds platform validation to prevent the use of Extended Protection on unsupported platforms (non-Windows) by throwing a PlatformNotSupportedException when PolicyEnforcement.Always is configured.

- `NegotiateAuthentication.cs`: Added validation check to throw PlatformNotSupportedException when Extended Protection policy enforcement is set to Always on platforms that don't support it
- `NegotiateAuthenticationTests.cs`: Added unit test to verify PlatformNotSupportedException is thrown on Unix platforms when Extended Protection is enabled
- `Strings.resx`: Added error message resource string for Extended Protection not supported scenario
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
…2 PING ACKs

Add metrics for outstanding PING and SETTING ACK packet count.

----
#### AI description  (iteration 1)
#### PR Classification
This is a new feature that adds metrics and safeguards to track and limit the count of pending PING and SETTINGS ACKs in HTTP/2 connections.

#### PR Summary
Implements tracking of in-flight PING and SETTINGS ACKs with a configurable maximum limit to prevent resource exhaustion in HTTP/2 connections. When the limit is exceeded, the connection is aborted with an error.

- `Http2Connection.cs`: Added `_pendingReplies` counter with a maximum limit of 10,000 untransmitted ACKs
- `Http2Connection.cs`: Modified `SendSettingsAckAsync()` and `SendPingAsync()` methods to increment the counter before writing and decrement after successful write
- `Http2Connection.cs`: Implemented `IncrementAcksInFlight()` and `DecrementAcksInFlight()` helper methods with overflow protection that aborts the connection when the limit is exceeded
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
Resolves https://dev.azure.com/devdiv/DevDiv/_workitems/edit/3004352

----
#### AI description  (iteration 2)
#### PR Classification
Security fix to prevent potential cross-site scripting (XSS) vulnerabilities by HTML-encoding user-controlled parameters before rendering them in debug error pages.

#### PR Summary
This pull request adds HTML encoding to incoming URL parameters before they are displayed in the debug proxy error pages to prevent XSS attacks. The changes ensure that `targetApplicationUrl` and `debuggerTabsListUrl` are properly sanitized before being rendered in HTML responses.

- `WebAssemblyNetDebugProxyAppBuilderExtensions.cs`: Added HTML encoding for `targetApplicationUrl` and `debuggerTabsListUrl` variables at the beginning of error handling logic
- `WebAssemblyNetDebugProxyAppBuilderExtensions.cs`: Replaced inline `WebUtility.HtmlEncode()` calls with pre-encoded variables throughout the error page HTML responses
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
…plicate check

Port of https://dev.azure.com/dnceng/internal/_git/dotnet-runtime/pullrequest/59533
(limits in the tests are relaxed comparing to originally reviewed version due to CI and 6.0 begin slower and wanting to keep the code consistent - original PR will be adjusted shortly)

----
#### AI description  (iteration 1)
#### PR Classification
Performance optimization to fix a quadratic-time algorithm in XML attribute duplicate checking logic.

#### PR Summary
This PR addresses a performance bottleneck in the XML attribute duplicate checking mechanism by replacing a quadratic O(n²) sorting-based approach with a linear O(n) HashSet-based approach, and adds comprehensive performance tests to validate the improvement.

- `XmlTextReaderImpl.cs`: Replaced `_attrDuplSortingArray` with `_attrDuplSet` (HashSet) for duplicate attribute detection, and reduced `MaxAttrDuplWalkCount` from 250 to 64 to trigger optimized path earlier
- `XmlTextReaderImplHelpers.cs`: Added `AtomizedNameEqualityComparer` inner class to enable HashSet-based duplicate checking using reference equality for atomized strings
- `XPathNodeInfoAtom.cs`: Improved `GetHashCode()` implementation to include all fields checked by `Equals()` using `RuntimeHelpers.GetHashCode()` for consistent hashing of reference types
- `AttributeReadingPerformanceTests.cs`: Added new test file with multiple test cases validating linear scaling behavior across different scenarios (various attribute counts, URI lengths, and reader types)
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
…ity fixes for 7B

#### AI description  (iteration 1)
#### PR Classification
Security fixes to address vulnerabilities related to processing large transform types and excessive encrypted elements in XML digital signatures.

#### PR Summary
This PR adds security mitigations to prevent denial-of-service attacks in `System.Security.Cryptography.Xml` by implementing limits on transform type sizes and the number of decrypted data elements, along with comprehensive test coverage for these new protections.

- `SignedXml_SignatureMethodAlgorithm.cs`: Added test `SignedXml_LargeTransformType_ThrowsCryptographicException` to verify that excessively large transform type names (100k nested types) now throw `CryptographicException` instead of potentially causing process crashes.
- `SignedXml_SignatureMethodAlgorithm.cs`: Added tests to validate default limit of 100 encrypted elements and verify `CryptographicException` is thrown when exceeded.
- `SignedXml_SignatureMethodAlgorithm.cs`: Added tests to verify configurable AppContext switch `MaxDecryptedDataElementsAppContextSwitch` allows customizing the encrypted element limit, including disabling it entirely with value 0.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @bartonjs, @vcsjones, @dotnet/area-system-security
See info in area-owners.md if you want to be subscribed.

@mrek-msft

Copy link
Copy Markdown
Member

/ba-g Created tracking WI for newly introduced test timeout. Rest of them looks like ios failures common these days which do not releate to any change.

@mrek-msft mrek-msft added the Servicing-approved Approved for servicing release label Jul 16, 2026
@mrek-msft
mrek-msft merged commit 28e517d into release/9.0 Jul 16, 2026
97 of 109 checks passed
@mrek-msft
mrek-msft deleted the internal-merge-9.0-2026-07-14-2017 branch July 16, 2026 21:52
This was referenced Aug 13, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Security Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants