Hello, A quick follow-up on rails 2:6.1.7.10+dfsg-1~deb12u4 for bookworm-security.
While doing another review pass, I found that the test I backported for CVE-2026-126073 doesn't work on 6.1. The upstream test wraps its requests in ActionDispatch::Request.with(ignore_accept_header: true), but Object#with only arrived in Active Support 7.1. On a Bookworm system with deb12u4 installed, ActionDispatch::Request.respond_to?(:with) returns false. Running the patched actionpack integration test from the 6.1 tree confirmed it: cd actionpack ruby -Ilib -Itest test/controller/integration_test.rb -n '/vary|accept/i' -v test_not_setting_accept_in_vary_header_when_ignore_accept_header_is_set errored with NoMethodError (undefined method `with' for ActionDispatch::Request:Class). The other nine tests in that filter, which exercise the actual Vary changes in rendering.rb and mime_negotiation.rb, passed. The fix itself was fine; only the test was broken. My earlier build didn't catch this because the package's build-time tests only run Active Job, and the autopkgtest runs a generated app, so this test file never ran. The Trixie and Sid versions are fine, since 7.2 has Request.with. I've rewritten the test the way 6.1 tests already do it: save ActionDispatch::Request.ignore_accept_header, set it, and restore it in an ensure block, with the two requests from the upstream test inside. With that change, the same ten tests pass (10 runs, 23 assertions, 0 failures, 0 errors). A normal request comes back as text/html and an XHR as text/javascript, both with Vary: X-Requested-With. The code hunks are unchanged from the previous debdiff. It's on Salsa here: https://salsa.debian.org/ruby-team/rails/-/tree/debian/bookworm This was the initial Debusine work request: https://debusine.debian.net/debian/developers/work-request/1639581/ Here is the followup Debusine work request with this fix: https://debusine.debian.net/debian/developers/work-request/1642776/ Feedback is still welcome. If nothing showstopping comes up, I'll continue to upload this and issue the DLA on Tuesday evening (November 24th, 2026). Best regards, Simon Quigley [email protected]
diff -Nru rails-6.1.7.10+dfsg/debian/changelog rails-6.1.7.10+dfsg/debian/changelog --- rails-6.1.7.10+dfsg/debian/changelog 2026-10-04 20:40:34.000000000 -0500 +++ rails-6.1.7.10+dfsg/debian/changelog 2026-11-20 18:54:44.000000000 -0600 @@ -1,3 +1,27 @@ +rails (2:6.1.7.10+dfsg-1~deb12u4) bookworm-security; urgency=high + + * Team upload. + * Backport fixes for 15 CVEs from Rails 8.0.5.2 (Closes: #1154301): + - CVE-2026-126188: Restrict the formats ffprobe and ffmpeg may open. + - CVE-2026-126186: Keep an extension only when it matches the media type. + - CVE-2026-126085: Bind the declared byte size on a GCS direct upload. + - CVE-2026-126081: Return the parameters object from each_key. + - CVE-2026-126080: Match safe_constantize load errors as a literal string. + - CVE-2026-126078: Escape each match substituted into highlight's + :highlighter. + - CVE-2026-126077: Keep a proxy from resending an upgraded session cookie. + - CVE-2026-126076: Do not write back a cache session deleted mid-request. + - CVE-2026-126074: Take a filename base and extension from the sanitized + name. + - CVE-2026-126073: Vary on every header that content negotiation reads. + - CVE-2026-126072: Close a live stream when its buffer is already closed. + - CVE-2026-126069: Skip a tag attribute name that is blank as a string. + - CVE-2026-126068: Reject a Mailgun timestamp more than two minutes ahead. + - CVE-2026-126067: Apply the SameSite policy on every session store. + - CVE-2026-122006: Apply an ImageMagick policy to every MiniMagick process. + + -- Simon Quigley <[email protected]> Fri, 20 Nov 2026 18:55:11 -0600 + rails (2:6.1.7.10+dfsg-1~deb12u3) bookworm-security; urgency=medium * Team upload. diff -Nru rails-6.1.7.10+dfsg/debian/patches/CVE-2026-122006.patch rails-6.1.7.10+dfsg/debian/patches/CVE-2026-122006.patch --- rails-6.1.7.10+dfsg/debian/patches/CVE-2026-122006.patch 1969-12-31 18:00:00.000000000 -0600 +++ rails-6.1.7.10+dfsg/debian/patches/CVE-2026-122006.patch 2026-11-20 18:45:31.000000000 -0600 @@ -0,0 +1,147 @@ +Origin: backport, https://github.com/rails/rails/commit/ea8c40121ce53a3d0255cd4eb6d13bfe3bc01776 +Reviewed-by: Simon Quigley <[email protected]> +Last-Update: 2026-11-20 + +Backported to 6.1.7.10. mini_magick 4.11 has no cli_env. The policy +directory is prepended to MAGICK_CONFIGURE_PATH, which Open3 +inherits. The policy denies MSL, the Ghostscript coders and the gs +delegate, and @filename indirection. Active Storage does not raise +on that gem. + +From ea8c40121ce53a3d0255cd4eb6d13bfe3bc01776 Mon Sep 17 00:00:00 2001 +From: Mike Dalessio <[email protected]> +Date: Fri, 31 Oct 2026 16:59:38 -0400 +Subject: [PATCH] Ship an ImageMagick security policy for every MiniMagick process + +--- +--- a/activestorage/lib/active_storage/engine.rb ++++ b/activestorage/lib/active_storage/engine.rb +@@ -124,6 +124,14 @@ module ActiveStorage + end + end + ++ initializer "active_storage.image_magick_policy" do ++ require "active_storage/image_magick" ++ ++ config.after_initialize do ++ ActiveStorage::ImageMagick.apply_policy if ActiveStorage::MINIMAGICK_AVAILABLE ++ end ++ end ++ + initializer "active_storage.verifier" do + config.after_initialize do |app| + ActiveStorage.verifier = app.message_verifier("ActiveStorage") +--- /dev/null ++++ b/activestorage/lib/active_storage/image_magick.rb +@@ -0,0 +1,40 @@ ++# frozen_string_literal: true ++ ++require "active_storage" ++require "active_support/core_ext/object/blank" ++ ++begin ++ gem "mini_magick" ++ require "mini_magick" ++ ActiveStorage::MINIMAGICK_AVAILABLE = true # :nodoc: ++rescue LoadError => error ++ ActiveStorage::MINIMAGICK_AVAILABLE = false # :nodoc: ++ raise error unless error.message.include?("mini_magick") ++end ++ ++module ActiveStorage ++ # Adds Active Storage's ImageMagick security policy to every ImageMagick ++ # process MiniMagick spawns. ++ # ++ # ImageMagick reads every policy.xml on its configuration search path and ++ # applies all of them, so the shipped policy adds to the operator's policy. ++ # MAGICK_CONFIGURE_PATH prepends to that search path. ++ # ++ # mini_magick 4.11, the version packaged for Bookworm, has no cli_env. ++ # Open3.popen3 inherits the process environment, so the policy directory is ++ # prepended to MAGICK_CONFIGURE_PATH. ++ module ImageMagick ++ POLICY_DIRECTORY = File.expand_path("image_magick", __dir__) ++ ++ def self.apply_policy # :nodoc: ++ return unless MINIMAGICK_AVAILABLE ++ ++ current = ENV["MAGICK_CONFIGURE_PATH"].to_s.split(File::PATH_SEPARATOR) ++ current.delete(POLICY_DIRECTORY) ++ current.reject!(&:empty?) ++ ENV["MAGICK_CONFIGURE_PATH"] = [POLICY_DIRECTORY, *current].join(File::PATH_SEPARATOR) ++ end ++ end ++end ++ ++ActiveStorage::ImageMagick.apply_policy if ActiveStorage::MINIMAGICK_AVAILABLE +--- /dev/null ++++ b/activestorage/lib/active_storage/image_magick/policy.xml +@@ -0,0 +1,68 @@ ++<!-- ++ Active Storage's ImageMagick security policy. Applied in addition to the host's policy.xml, ++ through MAGICK_CONFIGURE_PATH, to every ImageMagick process MiniMagick spawns. ++ ++ This file must work under both ImageMagick 6 and ImageMagick 7. Use the "coder", "delegate" ++ and "path" domains, which every release of both honors. A domain one release does not know, ++ such as "module" on older ImageMagick 6 releases, is ignored rather than rejected. ++ ++ ImageMagick picks a coder from the file's content, and several coders name the same underlying ++ reader through different tokens (PS, EPS, EPI, EPSF, EPSI, EPT; PDF, AI, EPDF, PDFA, POCKETMOD). A ++ coder rule matches one token, so every token is denied by coder. ++ ++ Do not put a backtick anywhere in this file. ImageMagick's tokenizer treats a backtick as an ++ opening quote and silently drops every rule up to the next apostrophe. ++--> ++<policymap> ++ <!-- Scripting coder that reads and writes files named inside the image. --> ++ <policy domain="coder" rights="none" pattern="MSL"/> ++ ++ <!-- Coders that read a file, or delete one, other than the image being processed. --> ++ <policy domain="coder" rights="none" pattern="EPHEMERAL"/> ++ <policy domain="coder" rights="none" pattern="TEXT"/> ++ ++ <!-- Coder that reads back a pixel cache from a file the image header names. --> ++ <policy domain="coder" rights="none" pattern="MPC"/> ++ ++ <!-- Coders that display to a screen. --> ++ <policy domain="coder" rights="none" pattern="SHOW"/> ++ <policy domain="coder" rights="none" pattern="WIN"/> ++ <policy domain="coder" rights="none" pattern="PLT"/> ++ ++ <!-- Coders that read a reference from outside the image, remote or local. FILE reads file://. --> ++ <policy domain="coder" rights="none" pattern="URL"/> ++ <policy domain="coder" rights="none" pattern="HTTP"/> ++ <policy domain="coder" rights="none" pattern="HTTPS"/> ++ <policy domain="coder" rights="none" pattern="FTP"/> ++ <policy domain="coder" rights="none" pattern="FILE"/> ++ ++ <!-- Interpreters that read and write files of their own. Ghostscript backs the PS and PDF ++ coders and their token aliases; GhostXPS and GhostPCL back XPS and PCL. The "gs" delegate ++ covers ImageMagick builds that run Ghostscript as an external command, and the coder rules ++ cover builds that link it in-process, where the delegate rule never applies. An ++ application that transforms PostScript or PDF through ImageMagick must allow the "gs" ++ delegate, and the coders it uses, again in the host's policy.xml. --> ++ <policy domain="delegate" rights="none" pattern="gs"/> ++ <policy domain="coder" rights="none" pattern="PS"/> ++ <policy domain="coder" rights="none" pattern="PS2"/> ++ <policy domain="coder" rights="none" pattern="PS3"/> ++ <policy domain="coder" rights="none" pattern="EPS"/> ++ <policy domain="coder" rights="none" pattern="EPS2"/> ++ <policy domain="coder" rights="none" pattern="EPS3"/> ++ <policy domain="coder" rights="none" pattern="EPI"/> ++ <policy domain="coder" rights="none" pattern="EPSF"/> ++ <policy domain="coder" rights="none" pattern="EPSI"/> ++ <policy domain="coder" rights="none" pattern="EPT"/> ++ <policy domain="coder" rights="none" pattern="EPT2"/> ++ <policy domain="coder" rights="none" pattern="EPT3"/> ++ <policy domain="coder" rights="none" pattern="PDF"/> ++ <policy domain="coder" rights="none" pattern="AI"/> ++ <policy domain="coder" rights="none" pattern="EPDF"/> ++ <policy domain="coder" rights="none" pattern="PDFA"/> ++ <policy domain="coder" rights="none" pattern="POCKETMOD"/> ++ <policy domain="coder" rights="none" pattern="XPS"/> ++ <policy domain="coder" rights="none" pattern="PCL"/> ++ ++ <!-- Indirect reads such as text:@/etc/passwd, which substitute a file for an argument. --> ++ <policy domain="path" rights="none" pattern="@*"/> ++</policymap> diff -Nru rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126067.patch rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126067.patch --- rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126067.patch 1969-12-31 18:00:00.000000000 -0600 +++ rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126067.patch 2026-11-20 18:21:17.000000000 -0600 @@ -0,0 +1,82 @@ +Origin: backport, https://github.com/rails/rails/commit/f2392996be723708271a8d30bfcf0edc221e53ef +Reviewed-by: Simon Quigley <[email protected]> +Last-Update: 2026-11-20 + +Backported to 6.1.7.10. Session cookies written by Rack itself, +including CacheStore and MemCacheStore, were missing SameSite. The +proc calls the cookie-jar proc and returns its symbol, which Rack +can write. The cache store and mem cache store tests check a strict +policy and a nil policy. + +From f2392996be723708271a8d30bfcf0edc221e53ef Mon Sep 17 00:00:00 2001 +From: Jean Boussier <[email protected]> +Date: Wed, 4 Sep 2024 08:57:59 +0200 +Subject: [PATCH] Apply `cookies_same_site_protection` to every session store + +--- +--- a/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb ++++ b/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb +@@ -18,8 +18,17 @@ module ActionDispatch + end + + module Compatibility ++ # Rack calls this with the request and the response. cookies_same_site_protection ++ # is the proc stored for the cookie jar, so call it to get :lax, :strict, or :none. ++ DEFAULT_SAME_SITE = proc { |request, _response = nil| ++ request.cookies_same_site_protection.call(request) ++ } ++ + def initialize(app, options = {}) + options[:key] ||= "_session_id" ++ unless options.key?(:same_site) || self.class::DEFAULT_OPTIONS.key?(:same_site) ++ options = options.merge(same_site: DEFAULT_SAME_SITE) ++ end + super + end + +--- a/actionpack/test/dispatch/session/cache_store_test.rb ++++ b/actionpack/test/dispatch/session/cache_store_test.rb +@@ -203,6 +203,20 @@ class CacheStoreTest < ActionDispatch::I + end + end + ++ def test_session_cookie_same_site_follows_the_configured_policy ++ with_test_route_set do ++ get "/set_session_value", env: { "action_dispatch.cookies_same_site_protection" => proc { :strict } } ++ assert_match(/SameSite=Strict/, Array(headers["Set-Cookie"]).join("\n")) ++ end ++ end ++ ++ def test_session_cookie_omits_same_site_when_the_policy_returns_nil ++ with_test_route_set do ++ get "/set_session_value", env: { "action_dispatch.cookies_same_site_protection" => proc { nil } } ++ assert_no_match(/SameSite/, Array(headers["Set-Cookie"]).join("\n")) ++ end ++ end ++ + private + def with_test_route_set + with_routing do |set| +--- a/actionpack/test/dispatch/session/mem_cache_store_test.rb ++++ b/actionpack/test/dispatch/session/mem_cache_store_test.rb +@@ -182,6 +182,20 @@ class MemCacheStoreTest < ActionDispatch + rescue Dalli::RingError => ex + skip ex.message, ex.backtrace + end ++ def test_session_cookie_same_site_follows_the_configured_policy ++ with_test_route_set do ++ get "/set_session_value", env: { "action_dispatch.cookies_same_site_protection" => proc { :strict } } ++ assert_match(/SameSite=Strict/, Array(headers["Set-Cookie"]).join("\n")) ++ end ++ end ++ ++ def test_session_cookie_omits_same_site_when_the_policy_returns_nil ++ with_test_route_set do ++ get "/set_session_value", env: { "action_dispatch.cookies_same_site_protection" => proc { nil } } ++ assert_no_match(/SameSite/, Array(headers["Set-Cookie"]).join("\n")) ++ end ++ end ++ + rescue LoadError, RuntimeError, Dalli::DalliError + $stderr.puts "Skipping MemCacheStoreTest tests. Start memcached and try again." + end diff -Nru rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126068.patch rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126068.patch --- rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126068.patch 1969-12-31 18:00:00.000000000 -0600 +++ rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126068.patch 2026-11-20 18:01:00.000000000 -0600 @@ -0,0 +1,69 @@ +Origin: backport, https://github.com/rails/rails/commit/4aa2ec66822bc4eb8b341a0608f1c90a3e371a34 +Reviewed-by: Simon Quigley <[email protected]> +Last-Update: 2026-11-20 + +Backported to 6.1.7.10. recent? rejects a timestamp more than two +minutes ahead as well as more than two minutes behind. + +From 4aa2ec66822bc4eb8b341a0608f1c90a3e371a34 Mon Sep 17 00:00:00 2001 +From: Mike Dalessio <[email protected]> +Date: Sat, 31 Oct 2026 14:44:08 -0400 +Subject: [PATCH] Reject Mailgun timestamps from the future + +--- +--- a/actionmailbox/app/controllers/action_mailbox/ingresses/mailgun/inbound_emails_controller.rb ++++ b/actionmailbox/app/controllers/action_mailbox/ingresses/mailgun/inbound_emails_controller.rb +@@ -112,7 +112,7 @@ module ActionMailbox + + # Allow for 2 minutes of drift between Mailgun time and local server time. + def recent? +- Time.at(timestamp) >= 2.minutes.ago ++ Time.at(timestamp).between?(2.minutes.ago, 2.minutes.from_now) + end + + def expected_signature +--- a/actionmailbox/test/controllers/ingresses/mailgun/inbound_emails_controller_test.rb ++++ b/actionmailbox/test/controllers/ingresses/mailgun/inbound_emails_controller_test.rb +@@ -58,6 +58,42 @@ class ActionMailbox::Ingresses::Mailgun: + assert_response :unauthorized + end + ++ test "receiving an inbound email from Mailgun with a timestamp slightly ahead of local time" do ++ assert_difference -> { ActionMailbox::InboundEmail.count }, +1 do ++ travel_to "2018-10-09 15:14:00 EDT" ++ post rails_mailgun_inbound_emails_url, params: { ++ timestamp: 1539112500, ++ token: "7VwW7k6Ak7zcTwoSoNm7aTtbk1g67MKAnsYLfUB7PdszbgR5Xi", ++ signature: "ef24c5225322217bb065b80bb54eb4f9206d764e3e16abab07f0a64d1cf477cc", ++ "body-mime" => file_fixture("../files/welcome.eml").read ++ } ++ end ++ ++ assert_response :no_content ++ end ++ ++ test "rejecting an inbound email from Mailgun with a timestamp from the future" do ++ original_timestamp = "1539112500" ++ original_token = "7VwW7k6Ak7zcTwoSoNm7aTtbk1g67MKAnsYLfUB7PdszbgR5Xi" ++ future_timestamp = original_timestamp + original_token[0] ++ shortened_token = original_token[1..] ++ ++ # The signature covers the timestamp and token joined into one string, so it holds for any split of that string. ++ assert_equal original_timestamp + original_token, future_timestamp + shortened_token ++ ++ assert_no_difference -> { ActionMailbox::InboundEmail.count } do ++ travel_to "2018-10-09 15:26:00 EDT" ++ post rails_mailgun_inbound_emails_url, params: { ++ timestamp: future_timestamp, ++ token: shortened_token, ++ signature: "ef24c5225322217bb065b80bb54eb4f9206d764e3e16abab07f0a64d1cf477cc", ++ "body-mime" => file_fixture("../files/welcome.eml").read ++ } ++ end ++ ++ assert_response :unauthorized ++ end ++ + test "rejecting a forged inbound email from Mailgun" do + assert_no_difference -> { ActionMailbox::InboundEmail.count } do + travel_to "2018-10-09 15:15:00 EDT" diff -Nru rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126069.patch rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126069.patch --- rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126069.patch 1969-12-31 18:00:00.000000000 -0600 +++ rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126069.patch 2026-11-20 17:56:25.000000000 -0600 @@ -0,0 +1,66 @@ +Origin: backport, https://github.com/rails/rails/commit/f47452533e1f28d847c63181b9d5f8b7243ef9a4 +Reviewed-by: Simon Quigley <[email protected]> +Last-Update: 2026-11-20 + +Backported to 6.1.7.10. Attribute names are skipped when they are +blank after conversion to a string, including nested data and aria +names. + +From f47452533e1f28d847c63181b9d5f8b7243ef9a4 Mon Sep 17 00:00:00 2001 +From: Mike Dalessio <[email protected]> +Date: Mon, 2 Nov 2026 19:22:33 -0500 +Subject: [PATCH] Skip tag attribute names that are blank once converted to a + +--- +diff --git a/actionview/lib/action_view/helpers/tag_helper.rb b/actionview/lib/action_view/helpers/tag_helper.rb +--- a/actionview/lib/action_view/helpers/tag_helper.rb ++++ b/actionview/lib/action_view/helpers/tag_helper.rb +@@ -82,18 +82,27 @@ + options.each_pair do |key, value| + next if key.blank? + ++ name = Symbol === key ? key.name : key.to_s ++ next if name.blank? ++ + type = TAG_TYPES[key] + if type == :data && value.is_a?(Hash) + value.each_pair do |k, v| + next if k.blank? || v.nil? + ++ nested_name = Symbol === k ? k.name : k.to_s ++ next if nested_name.blank? ++ + output << sep +- output << prefix_tag_option(key, k, v, escape) ++ output << prefix_tag_option(name, nested_name, v, escape) + end + elsif type == :aria && value.is_a?(Hash) + value.each_pair do |k, v| + next if k.blank? || v.nil? + ++ nested_name = Symbol === k ? k.name : k.to_s ++ next if nested_name.blank? ++ + case v + when Array, Hash + tokens = TagHelper.build_tag_values(v) +@@ -105,16 +114,16 @@ + end + + output << sep +- output << prefix_tag_option(key, k, v, escape) ++ output << prefix_tag_option(name, nested_name, v, escape) + end + elsif type == :boolean + if value + output << sep +- output << boolean_tag_option(key) ++ output << boolean_tag_option(name) + end + elsif !value.nil? + output << sep +- output << tag_option(key, value, escape) ++ output << tag_option(name, value, escape) + end + end + output unless output.empty? diff -Nru rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126072.patch rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126072.patch --- rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126072.patch 1969-12-31 18:00:00.000000000 -0600 +++ rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126072.patch 2026-11-20 17:42:09.000000000 -0600 @@ -0,0 +1,48 @@ +Origin: backport, https://github.com/rails/rails/commit/27ad18ed5900dee28ba20e9c6fc718ff751fa215 +Reviewed-by: Simon Quigley <[email protected]> +Last-Update: 2026-11-20 + +Backported to 6.1.7.10. close and abort close the queue instead of +pushing a marker while the monitor is held. + +From 27ad18ed5900dee28ba20e9c6fc718ff751fa215 Mon Sep 17 00:00:00 2001 +From: Jeremy Daer <[email protected]> +Date: Sat, 24 Oct 2026 16:18:22 -0700 +Subject: [PATCH] Avoid blocking Live buffer termination + +--- +diff --git a/actionpack/lib/action_controller/metal/live.rb b/actionpack/lib/action_controller/metal/live.rb +--- a/actionpack/lib/action_controller/metal/live.rb ++++ b/actionpack/lib/action_controller/metal/live.rb +@@ -154,7 +154,11 @@ + @response.delete_header "Content-Length" + end + +- super ++ begin ++ super ++ rescue ClosedQueueError ++ raise IOError, "closed stream" if connected? ++ end + + unless connected? + @buf.clear +@@ -175,7 +179,7 @@ + def close + synchronize do + super +- @buf.push nil ++ @buf.close + @cv.broadcast + end + end +@@ -188,7 +192,9 @@ + def abort + synchronize do + @aborted = true ++ @buf.close + @buf.clear ++ @cv.broadcast + end + end + diff -Nru rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126073.patch rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126073.patch --- rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126073.patch 1969-12-31 18:00:00.000000000 -0600 +++ rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126073.patch 2026-11-20 17:27:52.000000000 -0600 @@ -0,0 +1,159 @@ +Origin: backport, https://github.com/rails/rails/commit/b58c107abe9c1f10c1d6a4941402c60e4dc4742c +Reviewed-by: Simon Quigley <[email protected]> +Last-Update: 2026-11-21 + +Backported to 6.1.7.10. The 8.0 commit applies once the changelog +and the guides are left out. The ignore_accept_header test keeps +the 6.1 save and restore. Object#with arrived in Active Support 7.1. + +From b58c107abe9c1f10c1d6a4941402c60e4dc4742c Mon Sep 17 00:00:00 2001 +From: Jeremy Daer <[email protected]> +Date: Sat, 24 Oct 2026 17:54:29 -0700 +Subject: [PATCH] Vary rendered responses by negotiation headers + +--- +--- a/actionpack/lib/action_controller/metal/rendering.rb ++++ b/actionpack/lib/action_controller/metal/rendering.rb +@@ -78,8 +78,15 @@ module ActionController + end + + def _set_vary_header +- if response.headers["Vary"].blank? && request.should_apply_vary_header? +- response.headers["Vary"] = "Accept" ++ if request.should_apply_vary_header? ++ vary_headers = response.headers["Vary"].to_s.split(",").map(&:strip).reject(&:blank?) ++ ++ unless vary_headers.include?("*") ++ request.vary_headers.each do |header| ++ vary_headers << header unless vary_headers.any? { |existing| existing.casecmp?(header) } ++ end ++ response.headers["Vary"] = vary_headers.join(", ") ++ end + end + end + +--- a/actionpack/lib/action_dispatch/http/mime_negotiation.rb ++++ b/actionpack/lib/action_dispatch/http/mime_negotiation.rb +@@ -154,7 +154,17 @@ module ActionDispatch + end + + def should_apply_vary_header? +- !params_readable? && use_accept_header && valid_accept_header ++ !params_readable? ++ end ++ ++ def vary_headers # :nodoc: ++ if use_accept_header ++ headers = ["Accept", "X-Requested-With"] ++ headers.insert(1, "Content-Type") if xhr? && accept.blank? ++ headers ++ else ++ ["X-Requested-With"] ++ end + end + + private +--- a/actionpack/test/controller/integration_test.rb ++++ b/actionpack/test/controller/integration_test.rb +@@ -191,13 +191,9 @@ class IntegrationProcessTest < ActionDis + end + end + +- def get_with_vary_set_x_requested_with +- respond_to do |format| +- format.json do +- response.headers["Vary"] = "X-Requested-With" +- render json: "JSON OK", status: 200 +- end +- end ++ def get_with_vary ++ response.headers["Vary"] = params[:vary] ++ get + end + + def get_with_params +@@ -577,7 +573,35 @@ class IntegrationProcessTest < ActionDis + def test_setting_vary_header_when_request_is_xhr_with_accept_header + with_test_route_set do + get "/get", headers: { "Accept" => "application/json" }, xhr: true +- assert_equal "Accept", response.headers["Vary"] ++ assert_equal "Accept, X-Requested-With", response.headers["Vary"] ++ end ++ end ++ ++ def test_setting_vary_header_when_request_has_no_accept_header ++ with_test_route_set do ++ get "/get", headers: { "Accept" => nil } ++ assert_equal "text/html", response.media_type ++ assert_equal "Accept, X-Requested-With", response.headers["Vary"] ++ ++ get "/get", headers: { "Accept" => nil, "X-Requested-With" => "XMLHttpRequest" } ++ assert_equal "text/javascript", response.media_type ++ assert_equal "Accept, Content-Type, X-Requested-With", response.headers["Vary"] ++ end ++ end ++ ++ def test_setting_vary_header_when_xhr_format_depends_on_content_type ++ with_test_route_set do ++ get "/get", headers: { "Accept" => nil, "Content-Type" => "application/xml", "X-Requested-With" => "XMLHttpRequest" } ++ assert_equal "application/xml", response.media_type ++ assert_equal "Accept, Content-Type, X-Requested-With", response.headers["Vary"] ++ end ++ end ++ ++ def test_setting_vary_header_when_request_has_a_browser_like_accept_header ++ with_test_route_set do ++ get "/get", headers: { "Accept" => "application/json, */*" } ++ assert_equal "text/html", response.media_type ++ assert_equal "Accept, X-Requested-With", response.headers["Vary"] + end + end + +@@ -588,20 +612,42 @@ class IntegrationProcessTest < ActionDis + end + end + +- def test_not_setting_vary_header_when_it_has_already_been_set ++ def test_appending_to_vary_header_when_it_has_already_been_set + with_test_route_set do +- get "/get_with_vary_set_x_requested_with", headers: { "Accept" => "application/json" }, xhr: true +- assert_equal "X-Requested-With", response.headers["Vary"] ++ get "/get_with_vary", params: { vary: "Accept-Language" }, headers: { "Accept" => "application/json" } ++ assert_equal "Accept-Language, Accept, X-Requested-With", response.headers["Vary"] + end + end + +- def test_not_setting_vary_header_when_ignore_accept_header_is_set ++ def test_not_appending_fields_already_in_vary_header_case_insensitively ++ with_test_route_set do ++ existing = "accept, CONTENT-type, x-requested-with" ++ get "/get_with_vary", params: { vary: existing }, headers: { "Accept" => nil, "Content-Type" => "application/xml", "X-Requested-With" => "XMLHttpRequest" } ++ assert_equal "application/xml", response.media_type ++ assert_equal existing, response.headers["Vary"] ++ end ++ end ++ ++ def test_not_appending_to_wildcard_vary_header ++ with_test_route_set do ++ get "/get_with_vary", params: { vary: "*" }, headers: { "Accept" => nil, "Content-Type" => "application/xml", "X-Requested-With" => "XMLHttpRequest" } ++ assert_equal "application/xml", response.media_type ++ assert_equal "*", response.headers["Vary"] ++ end ++ end ++ ++ def test_not_setting_accept_in_vary_header_when_ignore_accept_header_is_set + original_ignore_accept_header = ActionDispatch::Request.ignore_accept_header + ActionDispatch::Request.ignore_accept_header = true + + with_test_route_set do ++ get "/get", headers: { "Accept" => "application/json" } ++ assert_equal "text/html", response.media_type ++ assert_equal "X-Requested-With", response.headers["Vary"] ++ + get "/get", headers: { "Accept" => "application/json" }, xhr: true +- assert_nil response.headers["Vary"] ++ assert_equal "text/javascript", response.media_type ++ assert_equal "X-Requested-With", response.headers["Vary"] + end + ensure + ActionDispatch::Request.ignore_accept_header = original_ignore_accept_header diff -Nru rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126074.patch rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126074.patch --- rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126074.patch 1969-12-31 18:00:00.000000000 -0600 +++ rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126074.patch 2026-11-20 17:23:14.000000000 -0600 @@ -0,0 +1,43 @@ +Origin: backport, https://github.com/rails/rails/commit/9b0d4bef2211a2c08cab2e0ea17fa1d0efd5d47a +Reviewed-by: Simon Quigley <[email protected]> +Last-Update: 2026-11-20 + +Backported to 6.1.7.10. The 6.1 unsafe-character set gains NUL. +base and extension_with_delimiter read the sanitized name. + +From 9b0d4bef2211a2c08cab2e0ea17fa1d0efd5d47a Mon Sep 17 00:00:00 2001 +From: Jeremy Daer <[email protected]> +Date: Sun, 25 Oct 2026 10:14:25 -0700 +Subject: [PATCH] Sanitize Active Storage filename parts + +--- +diff --git a/activestorage/app/models/active_storage/filename.rb b/activestorage/app/models/active_storage/filename.rb +--- a/activestorage/app/models/active_storage/filename.rb ++++ b/activestorage/app/models/active_storage/filename.rb +@@ -23,7 +23,7 @@ + # ActiveStorage::Filename.new("racecar").base # => "racecar" + # ActiveStorage::Filename.new(".gitignore").base # => ".gitignore" + def base +- File.basename @filename, extension_with_delimiter ++ File.basename sanitized, extension_with_delimiter + end + + # Returns the extension of the filename (i.e. the substring following the last dot, excluding a dot at the +@@ -33,7 +33,7 @@ + # ActiveStorage::Filename.new("racecar").extension_with_delimiter # => "" + # ActiveStorage::Filename.new(".gitignore").extension_with_delimiter # => "" + def extension_with_delimiter +- File.extname @filename ++ File.extname sanitized + end + + # Returns the extension of the filename (i.e. the substring following the last dot, excluding a dot at +@@ -55,7 +55,7 @@ + # + # Characters considered unsafe for storage (e.g. \, $, and the RTL override character) are replaced with a dash. + def sanitized +- @filename.encode(Encoding::UTF_8, invalid: :replace, undef: :replace, replace: "�").strip.tr("\u{202E}%$|:;/\t\r\n\\", "-") ++ @filename.encode(Encoding::UTF_8, invalid: :replace, undef: :replace, replace: "�").strip.tr("\u{202E}%$|:;/\t\r\n\\\u{0000}", "-") + end + + # Returns the sanitized version of the filename. diff -Nru rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126076.patch rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126076.patch --- rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126076.patch 1969-12-31 18:00:00.000000000 -0600 +++ rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126076.patch 2026-11-20 17:14:01.000000000 -0600 @@ -0,0 +1,75 @@ +Origin: backport, https://github.com/rails/rails/commit/5bb5ec66ed8faaf590ffe1222d7a5eb6e9d050f5 +Reviewed-by: Simon Quigley <[email protected]> +Last-Update: 2026-11-20 + +Backported to 6.1.7.10. find_session already receives the request +object Rack 2.2 passes. The write is skipped when that loaded +session was deleted. + +From 5bb5ec66ed8faaf590ffe1222d7a5eb6e9d050f5 Mon Sep 17 00:00:00 2001 +From: Mike Dalessio <[email protected]> +Date: Thu, 29 Oct 2026 16:45:13 -0400 +Subject: [PATCH] Skip writing a CacheStore session deleted mid-request + +--- +diff --git a/actionpack/lib/action_dispatch/middleware/session/cache_store.rb b/actionpack/lib/action_dispatch/middleware/session/cache_store.rb +--- a/actionpack/lib/action_dispatch/middleware/session/cache_store.rb ++++ b/actionpack/lib/action_dispatch/middleware/session/cache_store.rb +@@ -13,6 +13,8 @@ + # * <tt>expire_after</tt> - The length of time a session will be stored before automatically expiring. + # By default, the <tt>:expires_in</tt> option of the cache is used. + class CacheStore < AbstractSecureStore ++ LOADED_SESSION_ID = "action_dispatch.session.cache_store.loaded_session_id" # :nodoc: ++ + def initialize(app, options = {}) + @cache = options[:cache] || Rails.cache + options[:expire_after] ||= @cache.options[:expires_in] +@@ -20,17 +22,20 @@ + end + + # Get a session from the cache. +- def find_session(env, sid) +- unless sid && (session = get_session_with_fallback(sid)) ++ def find_session(req, sid) ++ if sid && (session = get_session_with_fallback(sid)) ++ req.set_header(LOADED_SESSION_ID, sid.private_id) ++ else + sid, session = generate_sid, {} + end + [sid, session] + end + + # Set a session in the cache. +- def write_session(env, sid, session, options) ++ def write_session(req, sid, session, options) + key = cache_key(sid.private_id) + if session ++ return false if destroyed_since_loaded?(req, sid) + @cache.write(key, session, expires_in: options[:expire_after]) + else + @cache.delete(key) +@@ -54,6 +59,24 @@ + def get_session_with_fallback(sid) + @cache.read(cache_key(sid.private_id)) || @cache.read(cache_key(sid.public_id)) + end ++ ++ # Writing back a session that another request deleted, such as on logout, ++ # would restore it. ++ def destroyed_since_loaded?(req, sid) ++ req.get_header(LOADED_SESSION_ID) == sid.private_id && ++ !exist_in_backend?(cache_key(sid.private_id)) && ++ !exist_in_backend?(cache_key(sid.public_id)) ++ end ++ ++ # The request-local cache still holds the entry this request loaded, so ++ # a lookup through it cannot see a delete made by another request. ++ def exist_in_backend?(key) ++ if @cache.respond_to?(:with_local_cache) ++ @cache.with_local_cache { @cache.exist?(key) } ++ else ++ @cache.exist?(key) ++ end ++ end + end + end + end diff -Nru rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126077.patch rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126077.patch --- rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126077.patch 1969-12-31 18:00:00.000000000 -0600 +++ rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126077.patch 2026-11-20 17:02:46.000000000 -0600 @@ -0,0 +1,87 @@ +Origin: backport, https://github.com/rails/rails/commit/0e6cf8faa89caf4c64311d35ca2bc88c1458d4e3 +Reviewed-by: Simon Quigley <[email protected]> +Last-Update: 2026-11-20 + +Backported to 6.1.7.10. A rotated or migrated cookie is recorded +as upgraded, and the Set-Cookie header omits it when the session +is skipped. + +From 0e6cf8faa89caf4c64311d35ca2bc88c1458d4e3 Mon Sep 17 00:00:00 2001 +From: Mike Dalessio <[email protected]> +Date: Sat, 31 Oct 2026 17:00:42 -0400 +Subject: [PATCH] Don't write upgraded cookies to a response that skips the + +--- +diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb +--- a/actionpack/lib/action_dispatch/middleware/cookies.rb ++++ b/actionpack/lib/action_dispatch/middleware/cookies.rb +@@ -5,6 +5,7 @@ + require "active_support/message_verifier" + require "active_support/json" + require "rack/utils" ++require "set" + + module ActionDispatch + class Request +@@ -294,6 +295,7 @@ + def initialize(request) + @set_cookies = {} + @delete_cookies = {} ++ @upgraded_cookies = Set.new + @request = request + @cookies = {} + @committed = false +@@ -356,6 +358,7 @@ + end + + handle_options(options) ++ @upgraded_cookies.delete(name.to_s) + + if @cookies[name.to_s] != value || options[:expires] + @cookies[name.to_s] = value +@@ -394,6 +397,10 @@ + @cookies.each_key { |k| delete(k, options) } + end + ++ def upgraded(name) ++ @upgraded_cookies << name.to_s ++ end ++ + def write(headers) + if header = make_set_cookie_header(headers[HTTP_HEADER]) + headers[HTTP_HEADER] = header +@@ -409,7 +416,9 @@ + + def make_set_cookie_header(header) + header = @set_cookies.inject(header) { |m, (k, v)| +- if write_cookie?(v) ++ if @upgraded_cookies.include?(k) && request.session_options[:skip] ++ m ++ elsif write_cookie?(v) + ::Rack::Utils.add_cookie_to_header(m, k, v) + else + m +@@ -505,6 +514,10 @@ + @parent_jar[name] = options + end + ++ def upgraded(name) ++ @parent_jar.upgraded(name) ++ end ++ + protected + def request; @parent_jar.request; end + +@@ -578,10 +591,12 @@ + when needs_migration?(value) + Marshal.load(value).tap do |v| + self[name] = { value: v } ++ upgraded(name) + end + when rotate + serializer.load(value).tap do |v| + self[name] = { value: v } ++ upgraded(name) + end + else + serializer.load(value) diff -Nru rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126078.patch rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126078.patch --- rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126078.patch 1969-12-31 18:00:00.000000000 -0600 +++ rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126078.patch 2026-11-20 16:44:20.000000000 -0600 @@ -0,0 +1,55 @@ +Origin: backport, https://github.com/rails/rails/commit/c796f6198837479ada13290eb8fa767b5219a58a +Reviewed-by: Simon Quigley <[email protected]> +Last-Update: 2026-11-20 + +Backported to 6.1.7.10. highlight walks tag and text segments, +keeps a match off the closing angle bracket, and HTML-escapes +numbered placeholders. + +From c796f6198837479ada13290eb8fa767b5219a58a Mon Sep 17 00:00:00 2001 +From: Mike Dalessio <[email protected]> +Date: Sat, 31 Oct 2026 16:07:52 -0400 +Subject: [PATCH] Escape the phrase substituted into highlight's :highlighter + +--- +diff --git a/actionview/lib/action_view/helpers/text_helper.rb b/actionview/lib/action_view/helpers/text_helper.rb +--- a/actionview/lib/action_view/helpers/text_helper.rb ++++ b/actionview/lib/action_view/helpers/text_helper.rb +@@ -135,16 +135,28 @@ + if text.blank? || phrases.blank? + text || "" + else +- match = Array(phrases).map do |p| +- Regexp === p ? p.to_s : Regexp.escape(p) +- end.join("|") ++ patterns = Array(phrases).map { |phrase| Regexp === phrase ? phrase : Regexp.escape(phrase) } ++ pattern = /(#{patterns.join("|")})/i ++ # The text after a tag begins with the ">" that closes it. Leave it ++ # in the segment so phrases can see it as context, but keep it out ++ # of the match so the highlighter can't take the place of the ">". ++ pattern_after_tag = /(?!\A)#{pattern}/ ++ highlighter = options.fetch(:highlighter, '<mark>\1</mark>') unless block_given? + +- if block_given? +- text.gsub(/(#{match})(?![^<]*?>)/i) { |found| yield found } +- else +- highlighter = options.fetch(:highlighter, '<mark>\1</mark>') +- text.gsub(/(#{match})(?![^<]*?>)/i, highlighter) +- end ++ text.scan(/<[^>]*|[^<]+/).each_with_index do |segment, index| ++ if !segment.start_with?("<") ++ segment_pattern = index > 0 ? pattern_after_tag : pattern ++ ++ if block_given? ++ segment.gsub!(segment_pattern) { |found| yield found } ++ else ++ segment.gsub!(segment_pattern) do ++ match = Regexp.last_match ++ highlighter.gsub(/\\(\d)/) { ERB::Util.html_escape_once(match[$1.to_i]) } ++ end ++ end ++ end ++ end.join + end.html_safe + end + diff -Nru rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126080.patch rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126080.patch --- rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126080.patch 1969-12-31 18:00:00.000000000 -0600 +++ rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126080.patch 2026-11-20 16:24:04.000000000 -0600 @@ -0,0 +1,51 @@ +Origin: backport, https://github.com/rails/rails/commit/210ac22d446c8e2625b091e79256806b836eee20 +Reviewed-by: Simon Quigley <[email protected]> +Last-Update: 2026-11-20 + +Backported to 6.1.7.10. The LoadError check matches the constant's +first segment as a literal string. const_regexp was only used +there, so it is removed. + +From 210ac22d446c8e2625b091e79256806b836eee20 Mon Sep 17 00:00:00 2001 +From: Jeremy Daer <[email protected]> +Date: Sat, 24 Oct 2026 15:42:49 -0700 +Subject: [PATCH] Avoid dynamic regexp in safe_constantize LoadError handling + +--- +diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb +--- a/activesupport/lib/active_support/inflector/methods.rb ++++ b/activesupport/lib/active_support/inflector/methods.rb +@@ -332,7 +332,8 @@ + e.name.to_s == camel_cased_word.to_s) + rescue LoadError => e + message = e.respond_to?(:original_message) ? e.original_message : e.message +- raise unless /Unable to autoload constant #{const_regexp(camel_cased_word)}/.match?(message) ++ constant_name = camel_cased_word.to_s.split("::").find { |part| !part.empty? } || camel_cased_word ++ raise unless message.include?("Unable to autoload constant #{constant_name}") + end + + # Returns the suffix that should be added to a number to denote the position +@@ -362,23 +363,6 @@ + end + + private +- # Mounts a regular expression, returned as a string to ease interpolation, +- # that will match part by part the given constant. +- # +- # const_regexp("Foo::Bar::Baz") # => "Foo(::Bar(::Baz)?)?" +- # const_regexp("::") # => "::" +- def const_regexp(camel_cased_word) +- parts = camel_cased_word.split("::") +- +- return Regexp.escape(camel_cased_word) if parts.blank? +- +- last = parts.pop +- +- parts.reverse!.inject(last) do |acc, part| +- part.empty? ? acc : "#{part}(::#{acc})?" +- end +- end +- + # Applies inflection rules for +singularize+ and +pluralize+. + # + # If passed an optional +locale+ parameter, the uncountables will be diff -Nru rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126081.patch rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126081.patch --- rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126081.patch 1969-12-31 18:00:00.000000000 -0600 +++ rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126081.patch 2026-11-20 16:13:41.000000000 -0600 @@ -0,0 +1,41 @@ +Origin: backport, https://github.com/rails/rails/commit/2fc8838300133931e19eed3ea6cee76a7e83f19c +Reviewed-by: Simon Quigley <[email protected]> +Last-Update: 2026-11-20 + +Backported to 6.1.7.10. each_key is no longer delegated, and it +returns the Parameters object. + +From 2fc8838300133931e19eed3ea6cee76a7e83f19c Mon Sep 17 00:00:00 2001 +From: Mike Dalessio <[email protected]> +Date: Mon, 2 Nov 2026 19:05:59 -0500 +Subject: [PATCH] Return self from `Parameters#each_key` with a block + +--- +diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb +--- a/actionpack/lib/action_controller/metal/strong_parameters.rb ++++ b/actionpack/lib/action_controller/metal/strong_parameters.rb +@@ -244,7 +244,7 @@ + # + # Returns a new array of the values of the parameters. + delegate :keys, :key?, :has_key?, :member?, :values, :has_value?, :value?, :empty?, :include?, +- :as_json, :to_s, :each_key, to: :@parameters ++ :as_json, :to_s, to: :@parameters + + # By default, never raise an UnpermittedParameters exception if these + # params are present. The default includes both 'controller' and 'action' +@@ -404,6 +404,15 @@ + self + end + ++ # Calls block once for each key in the parameters, passing the key. If no ++ # block is given, an enumerator is returned instead. Returns the Parameters ++ # object, so mass assignment still checks +permitted?+. ++ def each_key(&block) ++ return to_enum(:each_key) unless block_given? ++ @parameters.each_key(&block) ++ self ++ end ++ + # Attribute that keeps track of converted arrays, if any, to avoid double + # looping in the common use case permit + mass-assignment. Defined in a + # method to instantiate it only if needed. diff -Nru rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126085.patch rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126085.patch --- rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126085.patch 1969-12-31 18:00:00.000000000 -0600 +++ rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126085.patch 2026-11-20 16:00:28.000000000 -0600 @@ -0,0 +1,103 @@ +Origin: backport, https://github.com/rails/rails/commit/7fe85a72a789eae5ee070ce3ee1dad10a8a5f70c +Reviewed-by: Simon Quigley <[email protected]> +Last-Update: 2026-11-20 + +Backported to 6.1.7.10. Direct uploads do not switch signing +versions. The signed URL and the returned headers bind +x-goog-content-length-range to the declared byte size. The guide's +header list and the GCS CORS example name that header. The direct +upload tests send it on the signed PUT. + +From 7fe85a72a789eae5ee070ce3ee1dad10a8a5f70c Mon Sep 17 00:00:00 2001 +From: Mike Dalessio <[email protected]> +Date: Mon, 2 Nov 2026 19:23:52 -0500 +Subject: [PATCH] Enforce the content length on GCS direct uploads + +--- +diff --git a/activestorage/lib/active_storage/service/gcs_service.rb b/activestorage/lib/active_storage/service/gcs_service.rb +--- a/activestorage/lib/active_storage/service/gcs_service.rb ++++ b/activestorage/lib/active_storage/service/gcs_service.rb +@@ -82,9 +82,13 @@ + end + end + +- def url_for_direct_upload(key, expires_in:, checksum:, **) ++ def url_for_direct_upload(key, expires_in:, checksum:, content_length:, **) + instrument :url, key: key do |payload| +- generated_url = bucket.signed_url key, method: "PUT", expires: expires_in, content_md5: checksum ++ generated_url = bucket.signed_url key, ++ method: "PUT", ++ expires: expires_in, ++ content_md5: checksum, ++ headers: { "x-goog-content-length-range" => "#{content_length},#{content_length}" } + + payload[:url] = generated_url + +@@ -92,10 +96,14 @@ + end + end + +- def headers_for_direct_upload(key, checksum:, filename: nil, disposition: nil, **) ++ def headers_for_direct_upload(key, checksum:, content_length:, filename: nil, disposition: nil, **) + content_disposition = content_disposition_with(type: disposition, filename: filename) if filename + +- { "Content-MD5" => checksum, "Content-Disposition" => content_disposition } ++ { ++ "Content-MD5" => checksum, ++ "Content-Disposition" => content_disposition, ++ "x-goog-content-length-range" => "#{content_length},#{content_length}" ++ } + end + + private +diff --git a/activestorage/test/service/gcs_service_test.rb b/activestorage/test/service/gcs_service_test.rb +--- a/activestorage/test/service/gcs_service_test.rb ++++ b/activestorage/test/service/gcs_service_test.rb +@@ -24,6 +24,7 @@ + request.body = data + request.add_field "Content-Type", "" + request.add_field "Content-MD5", checksum ++ request.add_field "x-goog-content-length-range", "#{data.size},#{data.size}" + Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http| + http.request request + end +@@ -42,7 +42,7 @@ + uri = URI.parse url + request = Net::HTTP::Put.new uri.request_uri + request.body = data +- @service.headers_for_direct_upload(key, checksum: checksum, filename: ActiveStorage::Filename.new("test.txt"), disposition: :attachment).each do |k, v| ++ @service.headers_for_direct_upload(key, checksum: checksum, content_length: data.size, filename: ActiveStorage::Filename.new("test.txt"), disposition: :attachment).each do |k, v| + request.add_field k, v + end + request.add_field "Content-Type", "" +diff --git a/activestorage/test/service/gcs_public_service_test.rb b/activestorage/test/service/gcs_public_service_test.rb +--- a/activestorage/test/service/gcs_public_service_test.rb ++++ b/activestorage/test/service/gcs_public_service_test.rb +@@ -29,6 +29,7 @@ + request.body = data + request.add_field "Content-Type", "" + request.add_field "Content-MD5", checksum ++ request.add_field "x-goog-content-length-range", "#{data.size},#{data.size}" + Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http| + http.request request + end +diff --git a/guides/source/active_storage_overview.md b/guides/source/active_storage_overview.md +--- a/guides/source/active_storage_overview.md ++++ b/guides/source/active_storage_overview.md +@@ -646,6 +646,7 @@ + * `Content-Disposition` (except for Azure Storage) + * `x-ms-blob-content-disposition` (for Azure Storage only) + * `x-ms-blob-type` (for Azure Storage only) ++ * `x-goog-content-length-range` (for GCS) + + No CORS configuration is required for the Disk service since it shares your app’s origin. + +@@ -681,7 +682,7 @@ + { + "origin": ["https://www.example.com"], + "method": ["PUT"], +- "responseHeader": ["Origin", "Content-Type", "Content-MD5", "Content-Disposition"], ++ "responseHeader": ["Origin", "Content-Type", "Content-MD5", "Content-Disposition", "x-goog-content-length-range"], + "maxAgeSeconds": 3600 + } + ] diff -Nru rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126186.patch rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126186.patch --- rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126186.patch 1969-12-31 18:00:00.000000000 -0600 +++ rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126186.patch 2026-11-20 15:38:15.000000000 -0600 @@ -0,0 +1,59 @@ +Origin: backport, https://github.com/rails/rails/commit/8106938fb0a595f11006dd1497cd409e27d7d636 +Reviewed-by: Simon Quigley <[email protected]> +Last-Update: 2026-11-20 + +Backported to 6.1.7.10. Blob#open takes the extension from +tempfile_extension. The 6.1 open call has no composed flag. + +From 8106938fb0a595f11006dd1497cd409e27d7d636 Mon Sep 17 00:00:00 2001 +From: Mike Dalessio <[email protected]> +Date: Sat, 12 Sep 2026 16:43:11 -0400 +Subject: [PATCH] Active Storage: tempfile extension must match the blob's + +--- +diff --git a/activestorage/app/models/active_storage/blob.rb b/activestorage/app/models/active_storage/blob.rb +--- a/activestorage/app/models/active_storage/blob.rb ++++ b/activestorage/app/models/active_storage/blob.rb +@@ -275,7 +275,8 @@ + + # Downloads the blob to a tempfile on disk. Yields the tempfile. + # +- # The tempfile's name is prefixed with +ActiveStorage-+ and the blob's ID. Its extension matches that of the blob. ++ # The tempfile's name is prefixed with +ActiveStorage-+ and the blob's ID. It keeps the blob filename's ++ # extension when that extension denotes the blob's content type, and has no extension otherwise. + # + # By default, the tempfile is created in <tt>Dir.tmpdir</tt>. Pass +tmpdir:+ to create it in a different directory: + # +@@ -288,7 +289,7 @@ + # Raises ActiveStorage::IntegrityError if the downloaded data does not match the blob's checksum. + def open(tmpdir: nil, &block) + service.open key, checksum: checksum, +- name: [ "ActiveStorage-#{id}-", filename.extension_with_delimiter ], tmpdir: tmpdir, &block ++ name: [ "ActiveStorage-#{id}-", tempfile_extension ], tmpdir: tmpdir, &block + end + + def mirror_later #:nodoc: +@@ -324,6 +325,23 @@ + end + + private ++ # Keep the uploaded extension only when Marcel maps it to this blob's media type. ++ # Otherwise a tool that selects a decoder from the extension, such as FFmpeg on .avs, ++ # would trust the attacker's filename. ++ def tempfile_extension ++ extension = filename.extension_with_delimiter ++ return "" if extension.blank? ++ ++ type_for_extension = Marcel::MimeType.for(name: filename.to_s) ++ return "" if type_for_extension == Marcel::MimeType::BINARY || type_for_extension != media_type ++ ++ extension ++ end ++ ++ def media_type ++ content_type.to_s.split(";").first.to_s.strip.downcase ++ end ++ + def compute_checksum_in_chunks(io) + Digest::MD5.new.tap do |checksum| + while chunk = io.read(5.megabytes) diff -Nru rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126188.patch rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126188.patch --- rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126188.patch 1969-12-31 18:00:00.000000000 -0600 +++ rails-6.1.7.10+dfsg/debian/patches/CVE-2026-126188.patch 2026-11-20 15:21:50.000000000 -0600 @@ -0,0 +1,76 @@ +Origin: backport, https://github.com/rails/rails/commit/69aff80d115bbb9d1e82fd6c6f2fd3ddeafb958b +Reviewed-by: Simon Quigley <[email protected]> +Last-Update: 2026-11-20 + +Backported to 6.1.7.10. There is no audio analyzer. The format +whitelist is passed to ffprobe and to the video previewer. + +From 69aff80d115bbb9d1e82fd6c6f2fd3ddeafb958b Mon Sep 17 00:00:00 2001 +From: Mike Dalessio <[email protected]> +Date: Sat, 31 Oct 2026 16:01:32 -0400 +Subject: [PATCH] Restrict the formats ffmpeg and ffprobe may open + +--- +diff --git a/activestorage/lib/active_storage.rb b/activestorage/lib/active_storage.rb +--- a/activestorage/lib/active_storage.rb ++++ b/activestorage/lib/active_storage.rb +@@ -357,6 +357,12 @@ + + mattr_accessor :video_preview_arguments, default: "-y -vframes 1 -f image2" + ++ mattr_accessor :ffmpeg_allowed_formats, default: %w[ mov matroska avi mpeg mpegts flv asf ogg mp3 wav flac aac aiff caf ].freeze ++ ++ def self.ffmpeg_format_whitelist_arguments # :nodoc: ++ [ "-format_whitelist", Array(ffmpeg_allowed_formats).join(",") ] unless ffmpeg_allowed_formats.nil? ++ end ++ + module Transformers + extend ActiveSupport::Autoload + +diff --git a/activestorage/lib/active_storage/analyzer/video_analyzer.rb b/activestorage/lib/active_storage/analyzer/video_analyzer.rb +--- a/activestorage/lib/active_storage/analyzer/video_analyzer.rb ++++ b/activestorage/lib/active_storage/analyzer/video_analyzer.rb +@@ -113,9 +113,12 @@ + "-show_streams", + "-show_format", + "-v", "error", ++ *ActiveStorage.ffmpeg_format_whitelist_arguments, + file.path + ]) do |output| + JSON.parse(output.read) ++ end.tap do ++ logger.warn "Video analysis failed because ffprobe exited with status #{$?.exitstatus}. The file may be corrupt, or in a format outside config.active_storage.ffmpeg_allowed_formats." unless $?.success? + end + rescue Errno::ENOENT + logger.info "Skipping video analysis because FFmpeg isn't installed" +diff --git a/activestorage/lib/active_storage/previewer/video_previewer.rb b/activestorage/lib/active_storage/previewer/video_previewer.rb +--- a/activestorage/lib/active_storage/previewer/video_previewer.rb ++++ b/activestorage/lib/active_storage/previewer/video_previewer.rb +@@ -30,7 +30,7 @@ + + private + def draw_relevant_frame_from(file, &block) +- draw self.class.ffmpeg_path, "-i", file.path, *Shellwords.split(ActiveStorage.video_preview_arguments), "-", &block ++ draw self.class.ffmpeg_path, *ActiveStorage.ffmpeg_format_whitelist_arguments, "-i", file.path, *Shellwords.split(ActiveStorage.video_preview_arguments), "-", &block + end + end + end +diff --git a/activestorage/lib/active_storage/engine.rb b/activestorage/lib/active_storage/engine.rb +--- a/activestorage/lib/active_storage/engine.rb ++++ b/activestorage/lib/active_storage/engine.rb +@@ -27,6 +27,7 @@ + config.active_storage.analyzers = [ ActiveStorage::Analyzer::ImageAnalyzer, ActiveStorage::Analyzer::VideoAnalyzer ] + config.active_storage.paths = ActiveSupport::OrderedOptions.new + config.active_storage.queues = ActiveSupport::InheritableOptions.new ++ config.active_storage.ffmpeg_allowed_formats = ActiveStorage.ffmpeg_allowed_formats + + config.active_storage.variable_content_types = %w( + image/png +@@ -108,6 +109,7 @@ + ActiveStorage.content_types_allowed_inline = app.config.active_storage.content_types_allowed_inline || [] + ActiveStorage.binary_content_type = app.config.active_storage.binary_content_type || "application/octet-stream" + ActiveStorage.video_preview_arguments = app.config.active_storage.video_preview_arguments || "-y -vframes 1 -f image2" ++ ActiveStorage.ffmpeg_allowed_formats = app.config.active_storage.ffmpeg_allowed_formats + + ActiveStorage.replace_on_assign_to_many = app.config.active_storage.replace_on_assign_to_many || false + ActiveStorage.track_variants = app.config.active_storage.track_variants || false diff -Nru rails-6.1.7.10+dfsg/debian/patches/series rails-6.1.7.10+dfsg/debian/patches/series --- rails-6.1.7.10+dfsg/debian/patches/series 2026-10-04 20:40:34.000000000 -0500 +++ rails-6.1.7.10+dfsg/debian/patches/series 2026-11-20 18:45:31.000000000 -0600 @@ -28,3 +28,18 @@ CVE-2026-33176-reject-scientific-notation.patch CVE-2026-33195-reject-disk-path-traversal.patch CVE-2026-33202-escape-disk-globs.patch +CVE-2026-126188.patch +CVE-2026-126186.patch +CVE-2026-126085.patch +CVE-2026-126081.patch +CVE-2026-126080.patch +CVE-2026-126078.patch +CVE-2026-126077.patch +CVE-2026-126076.patch +CVE-2026-126074.patch +CVE-2026-126073.patch +CVE-2026-126072.patch +CVE-2026-126069.patch +CVE-2026-126068.patch +CVE-2026-126067.patch +CVE-2026-122006.patch
OpenPGP_signature.asc
Description: OpenPGP digital signature
