Skip to content

Commit c0cc872

Browse files
[AutoPR- Security] Patch rubygem-thor for CVE-2025-54314 [LOW] (#14369)
Co-authored-by: archana25-ms <[email protected]>
1 parent 04f900e commit c0cc872

File tree

2 files changed

+70
-1
lines changed

2 files changed

+70
-1
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
From 16edd00fcc29a6f5849a08b38756679b03e443f2 Mon Sep 17 00:00:00 2001
2+
From: Azure Linux Security Servicing Account
3+
4+
Date: Wed, 23 Jul 2025 04:26:48 +0000
5+
Subject: [PATCH] Fix CVE CVE-2025-54314 in rubygem-thor
6+
7+
Upstream Patch Reference: https://github.com/rails/thor/commit/f7418232b167cbb5c8071b7d0491aef82948feff.patch
8+
---
9+
lib/thor/shell/basic.rb | 2 +-
10+
spec/actions/create_file_spec.rb | 2 +-
11+
spec/shell/basic_spec.rb | 4 ++--
12+
3 files changed, 4 insertions(+), 4 deletions(-)
13+
14+
diff --git a/lib/thor/shell/basic.rb b/lib/thor/shell/basic.rb
15+
index a490de4..887d191 100644
16+
--- a/lib/thor/shell/basic.rb
17+
+++ b/lib/thor/shell/basic.rb
18+
@@ -496,7 +496,7 @@ class Thor
19+
Tempfile.open([File.basename(destination), File.extname(destination)], File.dirname(destination)) do |temp|
20+
temp.write content
21+
temp.rewind
22+
- system %(#{merge_tool} "#{temp.path}" "#{destination}")
23+
+ system(merge_tool, temp.path, destination)
24+
end
25+
end
26+
27+
diff --git a/spec/actions/create_file_spec.rb b/spec/actions/create_file_spec.rb
28+
index 1e0c934..2841735 100644
29+
--- a/spec/actions/create_file_spec.rb
30+
+++ b/spec/actions/create_file_spec.rb
31+
@@ -134,7 +134,7 @@ describe Thor::Actions::CreateFile do
32+
create_file("doc/config.rb")
33+
allow(@base.shell).to receive(:merge_tool).and_return("meld")
34+
expect(Thor::LineEditor).to receive(:readline).and_return("m")
35+
- expect(@base.shell).to receive(:system).with(/meld/)
36+
+ expect(@base.shell).to receive(:system).with("meld", /doc\/config\.rb/, /doc\/config\.rb/)
37+
invoke!
38+
end
39+
end
40+
diff --git a/spec/shell/basic_spec.rb b/spec/shell/basic_spec.rb
41+
index b51c5e8..573f7a4 100644
42+
--- a/spec/shell/basic_spec.rb
43+
+++ b/spec/shell/basic_spec.rb
44+
@@ -502,14 +502,14 @@ TABLE
45+
it "invokes the merge tool" do
46+
allow(shell).to receive(:merge_tool).and_return("meld")
47+
expect(Thor::LineEditor).to receive(:readline).and_return("m")
48+
- expect(shell).to receive(:system).with(/meld/)
49+
+ expect(shell).to receive(:system).with("meld", /foo/, "foo")
50+
capture(:stdout) { shell.file_collision("foo") {} }
51+
end
52+
53+
it "invokes the merge tool that specified at ENV['THOR_MERGE']" do
54+
allow(ENV).to receive(:[]).with("THOR_MERGE").and_return("meld")
55+
expect(Thor::LineEditor).to receive(:readline).and_return("m")
56+
- expect(shell).to receive(:system).with(/meld/)
57+
+ expect(shell).to receive(:system).with("meld", /foo/, "foo")
58+
capture(:stdout) { shell.file_collision("foo") {} }
59+
end
60+
61+
--
62+
--
63+
2.45.4
64+

SPECS/rubygem-thor/rubygem-thor.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,22 @@
55
Summary: Thor is a toolkit for building powerful command-line interfaces
66
Name: rubygem-%{gem_name}
77
Version: 1.2.1
8-
Release: 2%{?dist}
8+
Release: 3%{?dist}
99
Group: Development/Languages
1010
License: MIT
1111
Vendor: Microsoft Corporation
1212
Distribution: Mariner
1313
URL: http://whatisthor.com/
1414
Source0: https://github.com/rails/thor/archive/refs/tags/v%{version}.tar.gz#/%{gem_name}-%{version}.tar.gz
15+
Patch0: CVE-2025-54314.patch
1516
BuildRequires: ruby
1617

1718
%description
1819
Thor is a toolkit for building powerful command-line interfaces.
1920

2021
%prep
2122
%setup -q -n %{gem_name}-%{version}
23+
%patch 0 -p1
2224

2325
%build
2426
gem build %{gem_name}
@@ -32,6 +34,9 @@ gem install -V --local --force --install-dir %{buildroot}/%{gemdir} %{gem_name}-
3234
%{gemdir}
3335

3436
%changelog
37+
* Wed Jul 23 2025 Azure Linux Security Servicing Account <[email protected]> - 1.2.1-3
38+
- Patch for CVE-2025-54314
39+
3540
* Thu Dec 21 2023 Sindhu Karri <[email protected]> - 1.2.1-2
3641
- Promote package to Mariner Base repo
3742

0 commit comments

Comments
 (0)