-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Customizable security descriptors for HTTP.sys #35595
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
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
af67af3
original text
tdykstra 9a09803
acrolinx and xref links
tdykstra b8ce428
minor corrections
tdykstra ba7da31
minor corrections
tdykstra 7c53d7d
minor corrections
tdykstra 150a0d9
minor corrections
tdykstra 1cf4c42
tweak wording
tdykstra 970fb2c
fix link
tdykstra ef05df4
fix casing
tdykstra 9f74798
move code to file
tdykstra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
aspnetcore/release-notes/aspnetcore-10/includes/httpsys.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| ### Customizable security descriptors for HTTP.sys | ||
| <!--PR: https://github.com/dotnet/aspnetcore/pull/61325--> | ||
|
|
||
| You can now specify a custom security descriptor for HTTP.sys request queues. The new [RequestQueueSecurityDescriptor](https://source.dot.net/#Microsoft.AspNetCore.Server.HttpSys/HttpSysOptions.cs,a556950881fd2d87) property on <xref:Microsoft.AspNetCore.Server.HttpSys.HttpSysOptions> enables more granular control over access rights for the request queue. This granular control lets you tailor security to your application's needs. | ||
|
|
||
| #### Why use the new property? | ||
|
|
||
| A *request queue* in HTTP.sys is a kernel-level structure that temporarily stores incoming HTTP requests until your application is ready to process them. By customizing the security descriptor, you can allow or deny specific users or groups access to the request queue. This is useful in scenarios where you want to restrict or delegate HTTP.sys request handling at the operating system level. | ||
|
|
||
| #### How to use the new property | ||
|
|
||
| The `RequestQueueSecurityDescriptor` property applies only when creating a new request queue. The property doesn't affect existing request queues. To use this property, set it to a <xref:System.Security.AccessControl.GenericSecurityDescriptor> instance when configuring your HTTP.sys server. | ||
|
|
||
| For example, The following code allows all authenticated users but denies guests: | ||
|
|
||
| ```csharp | ||
| using System.Security.AccessControl; | ||
| using System.Security.Principal; | ||
| using Microsoft.AspNetCore.Server.HttpSys; | ||
|
|
||
| // Create a new security descriptor | ||
| var securityDescriptor = new CommonSecurityDescriptor(isContainer: false, isDS: false, sddlForm: string.Empty); | ||
|
|
||
| // Create a discretionary access control list (DACL) | ||
| var dacl = new DiscretionaryAcl(isContainer: false, isDS: false, capacity: 2); | ||
| dacl.AddAccess( | ||
| AccessControlType.Allow, | ||
| new SecurityIdentifier(WellKnownSidType.BuiltinUsersSid, null), | ||
| -1, | ||
| InheritanceFlags.None, | ||
| PropagationFlags.None | ||
| ); | ||
| dacl.AddAccess( | ||
| AccessControlType.Deny, | ||
| new SecurityIdentifier(WellKnownSidType.BuiltinGuestsSid, null), | ||
| -1, | ||
| InheritanceFlags.None, | ||
| PropagationFlags.None | ||
| ); | ||
|
|
||
| // Assign the DACL to the security descriptor | ||
| securityDescriptor.DiscretionaryAcl = dacl; | ||
|
|
||
| // Configure HTTP.sys options | ||
| var builder = WebApplication.CreateBuilder(); | ||
| builder.WebHost.UseHttpSys(options => | ||
| { | ||
| options.RequestQueueSecurityDescriptor = securityDescriptor; | ||
| }); | ||
| ``` | ||
|
|
||
| For more information, see <xref:fundamentals/servers/httpsys>. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.