Highlights
Command Injection: 7 prior fixes. Scrutinize any change in this area.
lib/net/imap/command_data.rb: most-fixed (5 issues). Treat as high-risk during review.
3 high-severity fixes in this history; regressions here are high-impact.
Recurring patterns
The bug types that recur here, drawn from past fixes, not open vulnerabilities.
Command Injection: The library constructs outbound protocol commands using custom validators that have repeatedly failed to capture injection payloads. Unescaped CRLF sequences, NULL bytes, or invalid literal markers allow attackers to perform IMAP command injection or protocol desynchronization.
STARTTLS Stripping: A malicious or compromised IMAP server can bypass TLS negotiation by either sending premature tagged success responses or bypassing the STARTTLS response handler entirely. Failure to assert that the TLS negotiation handler completed successfully leaves the client exposed to cleartext communication.
Denial of Service: The response parser lacks rigorous boundaries when processing server-supplied structures. An attacker-controlled server can send highly compressed or excessively large response payloads (such as malformed literals or uid-set structures), leading to severe memory exhaustion or CPU-bound resource depletion during parsing.