Skip to content

Throw PNSE for Extended Protection on unsupported platforms#131144

Merged
rzikm merged 1 commit into
dotnet:mainfrom
rzikm:extended-protection-pnse
Jul 22, 2026
Merged

Throw PNSE for Extended Protection on unsupported platforms#131144
rzikm merged 1 commit into
dotnet:mainfrom
rzikm:extended-protection-pnse

Conversation

@rzikm

@rzikm rzikm commented Jul 21, 2026

Copy link
Copy Markdown
Member

Implement a check that throws a PlatformNotSupportedException when Extended Protection is enforced on platforms that do not support it. Add a corresponding error message for clarity. Include a test to verify this behavior on non-Windows platforms.

Copilot AI review requested due to automatic review settings July 21, 2026 12:33
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
12 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: @dotnet/ncl, @bartonjs, @vcsjones
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR changes System.Net.Security’s NegotiateAuthentication server-side constructor to proactively throw PlatformNotSupportedException when Extended Protection is explicitly enforced (PolicyEnforcement.Always) on platforms that don’t support Extended Protection, and adds a unit test covering non-Windows behavior.

Changes:

  • Add a server-side constructor guard that throws PlatformNotSupportedException when PolicyEnforcement.Always is requested but ExtendedProtectionPolicy.OSSupportsExtendedProtection is false.
  • Add a new localized resource string for the exception message.
  • Add a non-Windows unit test asserting the constructor throws when Extended Protection is enforced.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/libraries/System.Net.Security/src/System/Net/Security/NegotiateAuthentication.cs Adds the PolicyEnforcement.Always + OSSupportsExtendedProtection PNSE guard in the server constructor.
src/libraries/System.Net.Security/src/Resources/Strings.resx Adds a new SR string used by the PNSE thrown from NegotiateAuthentication.
src/libraries/System.Net.Security/tests/UnitTests/NegotiateAuthenticationTests.cs Adds a non-Windows test verifying PNSE when Extended Protection is enforced.

@rzikm
rzikm enabled auto-merge (squash) July 21, 2026 12:40
@rzikm

rzikm commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

/ba-g test failure is unrelated

@rzikm
rzikm merged commit 97e5cfb into dotnet:main Jul 22, 2026
83 of 85 checks passed
@rzikm

rzikm commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

/backport to release/11.0-preview7

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0-preview7 (link to workflow run)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants