Document TryAddWithoutValidation security implications and validation behavior#12226
Open
Document TryAddWithoutValidation security implications and validation behavior#12226
Conversation
Co-authored-by: MihaZupan <25307628+MihaZupan@users.noreply.github.com>
Co-authored-by: MihaZupan <25307628+MihaZupan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Improve documentation for TryAddWithoutValidation methods
Document TryAddWithoutValidation security implications and validation behavior
Jan 13, 2026
MihaZupan
reviewed
Jan 13, 2026
MihaZupan
reviewed
Jan 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enhances the documentation for TryAddWithoutValidation methods in HttpHeaders to clarify security implications and validation behavior that were previously undocumented.
Changes:
- Clarified that header name validation is performed (returns
falsefor invalid names) but header value validation is skipped - Added security warning about the risks of using untrusted values and the need for proper validation
- Provided minimum validation guidance to prevent protocol-level attacks like request smuggling
MihaZupan
approved these changes
Jan 13, 2026
gewarren
approved these changes
Jan 13, 2026
Contributor
gewarren
left a comment
There was a problem hiding this comment.
Left a couple minor suggestions.
Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com>
Member
|
Thank you |
Contributor
|
Tagging subscribers to this area: @dotnet/ncl |
vcsjones
reviewed
Jan 15, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
TryAddWithoutValidationmethods perform header name validation but skip header value validation, creating security risks when used with untrusted input. This was undocumented.Changes
falsefor invalid names), but header values are not\r,\n,\0) to prevent request smuggling:NonValidatedviewBoth
TryAddWithoutValidationoverloads now have identical, comprehensive remarks sections explaining these behaviors.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.