-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[release/9.0] AppContext for HttpSys CBT hardening #64297
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
base: release/9.0
Are you sure you want to change the base?
Conversation
|
Hi @@BrennanConroy. If this is not a tell-mode PR, please make sure to follow the instructions laid out in the servicing process document. |
There was a problem hiding this comment.
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 adds an opt-in AppContext switch (Microsoft.AspNetCore.Server.HttpSys.EnableCBTHardening) that enables hardened Channel Binding Token (CBT) security for HTTP.Sys applications. This change was requested by a partner team to support enhanced security configurations.
Key changes:
- Added support for HTTP_CHANNEL_BIND_INFO native structure
- Implemented CBT hardening configuration in UrlGroup constructor with medium hardening level
- Made the feature opt-in via AppContext switch to ensure no impact to existing applications
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Servers/HttpSys/src/NativeMethods.txt | Added HTTP_CHANNEL_BIND_INFO to the list of native types for P/Invoke generation |
| src/Servers/HttpSys/src/NativeInterop/UrlGroup.cs | Implemented CBT hardening logic in UrlGroup constructor, checking AppContext switch and calling SetProperty with channel binding settings |
| ServiceNames = (HTTP_SERVICE_BINDING_BASE**)IntPtr.Zero, | ||
| NumberOfServiceNames = 0, | ||
| }; | ||
| SetProperty(HTTP_SERVER_PROPERTY.HttpServerChannelBindProperty, new(&channelBindingSettings), (uint)ChannelBindInfoSize); |
Copilot
AI
Nov 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SetProperty call in the constructor should handle potential errors. If this call fails, the UrlGroup is still constructed but without CBT hardening, which could lead to a silent security configuration failure. Consider adding error handling or logging similar to other property setters in this class, or document that failures are intentionally ignored during construction.
| SetProperty(HTTP_SERVER_PROPERTY.HttpServerChannelBindProperty, new(&channelBindingSettings), (uint)ChannelBindInfoSize); | |
| try | |
| { | |
| SetProperty(HTTP_SERVER_PROPERTY.HttpServerChannelBindProperty, new(&channelBindingSettings), (uint)ChannelBindInfoSize); | |
| } | |
| catch (Exception ex) | |
| { | |
| _logger.LogError(ex, "Failed to set CBT hardening on UrlGroup during construction. Security configuration may be incomplete."); | |
| // Optionally, rethrow or handle as needed for your application's security requirements. | |
| } |
AppContext for HttpSys CBT hardening
Description
Request from a partner team to allow setting hardened security for their HTTP.Sys applications.
Customer Impact
By default there is no impact, this change is opt-in. If the change is enabled then it sets hardened security for the endpoints exposed by the HTTP.Sys application.
Regression?
Risk
Purely opt-in change. We've also verified the change with the partner team.
Verification
Packaging changes reviewed?