Update dependency net-imap to v0.5.7 [SECURITY] #1449
Merged
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 PR contains the following updates:
0.5.6->0.5.7GitHub Vulnerability Alerts
CVE-2025-43857
Summary
There is a possibility for denial of service by memory exhaustion when
net-imapreads server responses. At any time while the client is connected, a malicious server can send can send a "literal" byte count, which is automatically read by the client's receiver thread. The response reader immediately allocates memory for the number of bytes indicated by the server response.This should not be an issue when securely connecting to trusted IMAP servers that are well-behaved. It can affect insecure connections and buggy, untrusted, or compromised servers (for example, connecting to a user supplied hostname).
Details
The IMAP protocol allows "literal" strings to be sent in responses, prefixed with their size in curly braces (e.g.
{1234567890}\r\n). WhenNet::IMAPreceives a response containing a literal string, it callsIO#readwith that size. When called with a size,IO#readimmediately allocates memory to buffer the entire string before processing continues. The server does not need to send any more data. There is no limit on the size of literals that will be accepted.Fix
Upgrade
Users should upgrade to
net-imap0.5.7 or later. A configurablemax_response_sizelimit has been added toNet::IMAP's response reader. Themax_response_sizelimit has also been backported tonet-imap0.2.5, 0.3.9, and 0.4.20.To set a global value for
max_response_size, users must upgrade tonet-imap~> 0.4.20, or > 0.5.7.Configuration
To avoid backward compatibility issues for secure connections to trusted well-behaved servers, the default
max_response_sizefornet-imap0.5.7 is very high (512MiB), and the defaultmax_response_sizefornet-imap~> 0.4.20, ~> 0.3.9, and 0.2.5 isnil(unlimited).When connecting to untrusted servers or using insecure connections, a much lower
max_response_sizeshould be used.Please Note:
max_response_sizeonly limits the size per response. It does not prevent a flood of individual responses and it does not limit how many unhandled responses may be stored on the responses hash. Users are responsible for adding response handlers to prune excessive unhandled responses.Compatibility with lower
max_response_sizeA lower
max_response_sizemay cause a few commands which legitimately return very large responses to raise an exception and close the connection. Themax_response_sizecould be temporarily set to a higher value, but paginated or limited versions of commands should be used whenever possible. For example, to fetch message bodies:References
Release Notes
ruby/net-imap (net-imap)
v0.5.7Compare Source
What's Changed
🔒 Security
This release adds two features to prevent unbounded memory use: the
response_handlerskeyword argument toNet::IMAP.new(https://github.com/ruby/net-imap/pull/419) so response handlers can be added before the server can send any responses, and themax_response_sizeconfig attribute (https://github.com/ruby/net-imap/pull/444, GHSA-j3g3-5qv5-52mj, CVE-2025-43857, reported by @Masamuneee).Added
response_handlerskwarg toNet::IMAP.newby @nevans in https://github.com/ruby/net-imap/pull/419max_response_sizeby @nevans in https://github.com/ruby/net-imap/pull/444Documentation
Other Changes
Config.version_defaultscreation by @nevans in https://github.com/ruby/net-imap/pull/412Net::IMAP#get_response(internal) by @nevans in https://github.com/ruby/net-imap/pull/422get_responseby @nevans in https://github.com/ruby/net-imap/pull/433Miscellaneous
Full Changelog: ruby/net-imap@v0.5.6...v0.5.7
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.