| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
MultipartPart wrote dispositionType, contentType, contentTransferEncoding, contentId, and custom part-header names and values straight into the header without validation, while name and filename were already escaped. A CR or LF in any of these injects extra part headers or splits the body. Reject CR/LF in these raw fields and fail closed; a legitimate value never contains them.
| Back | FazBrowse Home | New Git URL |
Motivation
MultipartPart writes several part-header fields (dispositionType, contentType, contentTransferEncoding, contentId, and custom header names/values) directly into the multipart header without validating CR/LF characters. This allows header injection or multipart body splitting. While name and filename were hardened in #2203, these fields remained unprotected.
Modification
Add asciiHeaderBytes(String) to reject CR/LF characters before encoding to US-ASCII, and use it for all raw part-header fields. name and filename continue using their existing quoted-string escaping.
Result
Raw part-header fields now fail fast on CR/LF input, preventing header injection while leaving valid values unaffected.