‹ Back to Blog

Ruby Security Week: What To Patch In Rails And Puma Now

Engineering Ruby Rails

Two of the most load-bearing gems in a Ruby web stack, Rails and Puma, each shipped a coordinated security release within the same few days. If you run Ruby in production, this is a patch-this-week pair rather than a routine bump. Scout Monitoring instruments both Rails and your Puma workers out of the box, so the clean way to confirm an upgrade changed nothing you care about is to watch your endpoints before and after. Set that up with Scout for free while you plan the rollout.

The releases are Rails 8.1.4.1 (with 8.0.5.2 backporting the same fixes to the 8.0 line) and Puma 8.0.3 followed a day later by Puma 8.1.0. Here’s the part that actually helps: what each one touches, and which changes you’ll feel after deploying.

Rails Patched A Cluster Of Escaping And Session Bugs

Rails 8.1.4.1 is a security release, and most of its fixes sit in code an ordinary app runs without thinking about it.

The headline is an escaping group in Action View. strip_tags now encodes all five HTML-significant characters, so quotation marks come out as &quot; and &#39; instead of passing through (GHSA-rq8q-p985-fjq7). highlight now escapes each matched phrase before substituting it into the highlighter, closing a path where a match containing a quote could end a quoted attribute and inject attributes of its own (GHSA-v6rj-xm57-3p59). Rails now also requires rails-html-sanitizer 1.7.2, which pulls in a Nokogiri that no longer leaves < and > unescaped in attribute values (GHSA-2p2f-4rq4-gjwc).

There’s more beyond Action View. ActiveSupport::Inflector#safe_constantize now matches a constant name as a literal string rather than compiling it into a regexp, so input that reaches it, such as an Action Cable channel identifier, can no longer steer the pattern (GHSA-8474-xrp6-wh69). ActiveSupport::MessagePack stops deserializing an unsafe SafeBuffer as html_safe (GHSA-2w9f-fxwj-w2qf). And Action Pack got three session and caching fixes: SameSite protection now applies to every session store rather than only CookieStore (GHSA-gmj8-hvj3-49mw), a CacheStore session deleted by a concurrent request is no longer written back to life (GHSA-r9jg-fmfx-2gv6 and related), and ActionController::Live streams no longer block when a full buffer is closed or aborted (GHSA-rwvh-fw6r-pwvp).

Two Rails Changes That Can Surprise You After Deploy

Most of the above is invisible once patched. Two changes are not, and they’re worth knowing before they show up as a graph you didn’t expect.

First, the strip_tags fix changes output. Anywhere you run sanitized text outside of HTML, in a JSON response or a text template, strings that used to contain " and ' now contain &quot; and &#39;. If a downstream consumer compares that text exactly or renders it in a non-HTML context, that’s a behavior change, not just a security fix. CGI.unescapeHTML decodes it where you need the raw characters back.

Second, the Vary header fix adds Accept and X-Requested-With to more responses so a shared cache can’t serve the wrong representation. That’s correct, but a stricter Vary means a shared or CDN cache fragments its entries more finely, which can lower your hit rate and quietly push more traffic to origin. If your response times tick up after this upgrade, a colder cache is the first thing to rule out.

Both are exactly the kind of post-upgrade surprise that reads as a response-time or error-rate change in monitoring rather than an obvious failure.

Puma Shipped Two Security Releases In Two Days

Puma’s half of the week is about connection handling, and most of it is slow-client and connection-exhaustion hardening, the DoS-adjacent category where a well-behaved server keeps a misbehaving client from tying up a worker.

Puma 8.0.3 carried the formal advisories. It now closes connections whose reactor timeout has passed even while another client keeps sending data, and stops a client that stalls from blocking the reactor as Puma writes a 100 Continue or 408. The write timeout now applies to TLS responses and to file responses larger than 64 KB, so a TLS client that stops reading can’t hold a connection open by trickling TLS records with no request data. A new shutdown_body_timeout (default 25 seconds) bounds how long a graceful shutdown keeps reading an incomplete request, and pumactl now verifies the TLS certificate and hostname of ssl:// control servers.

Puma 8.1.0 followed with a second round of request-parsing hardening: it limits the size of a chunked request trailer section, rejects empty chunk sizes, rejects unescaped { } ` \ in the request path, returns a 400 to HTTP/1.1 requests with a missing or empty Host, and rejects Content_Length and Transfer_Encoding framing headers regardless of the allow_underscore_headers setting, which is the kind of underscore-vs-dash framing ambiguity behind request-smuggling tricks. Alongside the hardening, 8.1.0 adds an experimental mold_worker cluster mode that forks new workers from a retired worker no longer serving traffic, plus on_worker_boot hooks and a hook_error_handler.

What To Actually Do

The short version is a two-line upgrade and a look at your dashboards.

  • Rails: move to 8.1.4.1 on the current line, or 8.0.5.2 if you’re on 8.0. Let the release bump rails-html-sanitizer to 1.7.2 rather than pinning an older one.
  • Puma: move to 8.1.0, or 8.0.3 if you want the advisory fixes without the new minor’s parsing changes. The stricter path and framing rules are a feature, but they will reject a few malformed requests that previously slipped through, so a short look at your error rate after deploy is worth it.

Then confirm, don’t assume. A security upgrade that changes escaping output, cache behavior, and request parsing is precisely the sort that looks fine in CI and shows up in production as a shifted curve.

Watch These Once You’ve Deployed

This is where monitoring earns its place in the rollout. After you ship, three things are worth a glance in Scout: endpoint response times, in case the tighter Vary cooled a shared cache; your error rate, in case Puma’s stricter parsing is now rejecting requests a client depends on; and any endpoint that renders sanitized text, in case the strip_tags output change rippled into a downstream consumer. Scout instruments Rails and Puma automatically and keeps the before-and-after side by side, so a regression introduced by the upgrade is a visible step change rather than a mystery.

Patching the same week the advisories drop is the right call. Watching what the patch did is how you ship it with confidence. Get started with Scout for free and keep an eye on your Ruby stack through the upgrade and after.