🥅 Validate ID values contain only valid bytes#698
Merged
Conversation
Also update internal RawText docs.
This shares most of the validation implementation with RawText, via an extracted shared superclass. Please note: in currently released `net-imap`, QuotedString is _not_ used to quote regular string arguments. It's currently only used by `Net::IMAP#id` (the `ID` extension). Without this patch, `Net::IMAP#id` is vulnerable to the same CRLF injection issues in GHSA-75xq-5h9v-w6px and GHSA-hm49-wcqc-g2xg. The string will be quoted, which may limit the ability to inject some commands. Presumably, `Net::IMAP#id` is unlikely to be called with user-provided input, making this less likely to be exploitable. Nevertheless, CRLF injection should be prevented!
This removes the duplicated string quoting implementation. It also introduces stricter enforcement of `quoted` string validation..
This was referenced Jun 9, 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.
This shares most of the validation implementation with
RawText, via an extracted shared superclass.In currently released versions of
net-imap,QuotedStringis not used to quote regular string arguments. It's currently only used byNet::IMAP#id(theIDextension). This PR reverses the dependency, so thatsend_string_datacallsQuotedString, rather than vice versa.Without this patch,
Net::IMAP#idis vulnerable to the same type of CRLF injection issues as in CVE-2026-42258 (GHSA-75xq-5h9v-w6px) and CVE-2026-42257 (GHSA-hm49-wcqc-g2xg). The string will be quoted, which imposes some limits on what command arguments can be injected, but many destructive commands will work fine without any quoted specials.Presumably,
Net::IMAP#idshould be very unlikely to be called with untrusted input, making this less likely to be exploitable. Nevertheless, CRLF injection should be prevented!