ruby / net-imap

Ruby client api for Internet Message Access Protocol
https://ruby.github.io/net-imap
Other
62 stars 29 forks source link

✨ Enable parenthesized lists in search criteria #345

Closed nevans closed 1 week ago

nevans commented 2 weeks ago

This affects #search, #uid_search, #sort, #uid_sort, #thread, and #uid_thread#.

Prior to this, sending a parenthesized list in the search criteria for any of these commands required the use of strings, which are converted to RawData, which has security implications with untrusted inputs.

With this change, arrays will only be converted into SequenceSet when every element in the array is a valid SequenceSet input. Otherwise, the array will be left alone, which allows us to send parenthesized lists without using strings and RawData.

For example, some searches this change enables:

This should be backward compatible: previously these inputs would simply raise an exception.