Repository navigation
System.Net.Mail Validation improvements - #128981
Conversation
|
Tagging subscribers to this area: @karelz, @dotnet/ncl |
|
@copilot, I do not see any files changed. Can you proceed with it? |
Co-authored-by: mrek-msft <188900745+mrek-msft@users.noreply.github.com>
Sorry about that — my previous session ended after only committing the plan. The actual fix is now pushed: Note This comment was generated by an AI agent (GitHub Copilot). |
|
@copilot please address review comments |
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
MihaZupan
left a comment
There was a problem hiding this comment.
Can we also handle other similar properties like the ones called out in #128637 (comment)
Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>
…github.com/dotnet/runtime into copilot/better-contenttype-name-validation
|
/ba-g Unrelated timeout |
Co-authored-by: Miha Zupan <mihazupan.zupan1@gmail.com>

ContentType.Name(andContentDisposition.FileName) only checked the prefix of the value viaMimeBasePart.DecodeEncoding. A value that starts with a valid RFC 2047 encoded-word but contains trailing junk — including unescaped"— was passed through unquoted, allowing injection of additional MIME parameters into the serialized header.Changes
MimeBasePart.DecodeEncoding: tightened the recognizer so it only returns a non-null encoding when the input is a well-formed RFC 2047 encoded-word (or a sequence of them joined by folding whitespace). Values containing characters that could break out of a quoted parameter (e.g.",;) no longer take the pass-through path.ContentType.EncodeToBuffer/ContentDisposition.EncodeToBuffer: the "manually encoded, pass through" branch is now reached only for genuinely valid encoded-words, so the raw-append-inside-quotes is safe. Anything else falls through toGetTokenOrQuotedString, which properly escapes embedded quotes.ContentTypeTest(and equivalent forContentDisposition.FileName) for the injection payloads and for legitimate encoded-word round-tripping to ensure no regression.