Repository navigation
v4.3.9
Security release. Released together with 5.2.4, 5.1.6, 5.0.12, 4.3.9 and 3.2.15: a connection shared by several threads or fibers could get out of step during a quiet block or after a get_multi that stopped early, so that reads returned another key's value (GHSA-5xvx-r8rg-5qm2). Upgrading is strongly recommended. It also includes backported bug fixes, listed below.
Security:
- Keep a connection shared by several threads or fibers in step during a
quietblock (GHSA-5xvx-r8rg-5qm2)- A
quiet(ormulti) block is quiet only for the thread or fiber that runs it. memcached still replies to a quiet request that fails (for example anaddof a key that exists), and another thread or fiber using the same client while the block was open read that reply as its own, so its later requests could return another key's value. A non-quiet request now reads any pending quiet replies first
- A
- Don't let a
get_multithat stopped early leave replies for a later request (GHSA-5xvx-r8rg-5qm2)- A pipelined
get_multistopped by a non-network exception (its block raising or breaking,Timeout.timeout, or a value that can't be deserialized) left its unread replies in the response buffer, and a laterget_multilarge enough to use the interleaved path returned them as its own. The buffer is now cleared when a connection closes or a pipelined get starts, and unfinished pipelines are aborted - Affects every supported line (the
get_multiissue, 4.3 and later), with both protocols; with the binary protocol the connection stayed out of step after the block ended. Fixed in 5.2.4, 5.1.6, 5.0.12, 4.3.9 and 3.2.15
- A pipelined
Bug fixes:
- A per-request
raw: truewrite no longer compresses the value (backport of #1213)- Values at or above the compression threshold (4 KB by default) were compressed and flagged even with
raw: true. Raw reads ignore flags, so reading them back withraw: truereturned the compressed bytes - Raw values are now stored exactly as given. Callers that pass
raw: truewithoutcompress: falsestore large values uncompressed; Rails'MemCacheStorepassescompress: falseand isn't affected
- Values at or above the compression threshold (4 KB by default) were compressed and flagged even with
- Handle failed TLS handshakes like other connection failures, and warn when TLS verification is off (backport of #1215)
- A failed or timed-out handshake left the TCP socket open until GC and raised
OpenSSL::SSL::SSLErrordirectly, so the server was never marked down. The socket is now closed, and the error goes through the usual retry andsocket_max_failureshandling, raisingDalli::NetworkError(orDalli::RingErroronce no server is available) - Certificate and hostname checks come only from the
ssl_contextyou pass, and a bareOpenSSL::SSL::SSLContext.newchecks neither. Dalli now logs a warning once per process whenverify_modedoesn't includeVERIFY_PEERorverify_hostnameis false; see the new TLS section in the README
- A failed or timed-out handshake left the TCP socket open until GC and raised
- A reply line longer than 8 KiB without a CRLF, or one cut short by the connection closing, is now a network error that closes the connection. Before, the line had no length limit (backport of #1216)
- One value that can't be stored no longer discards other buffered writes (backport of #1218)
- A value that raised
Dalli::MarshalErrororDalli::ValueOverMaxSizeclosed the connection, which dropped writes still buffered from the samequietblock orset_multi, andset_multidid this without raising set_multinow stores every other key, skips the bad one, and then raises
- A value that raised