Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
2859662716
!45 Fix CVE-2023-28120
From: @wk333 
Reviewed-by: @jxy_git 
Signed-off-by: @jxy_git
2024-06-26 08:21:51 +00:00
wk333
201c049519 Fix CVE-2023-28120 2024-06-26 15:15:26 +08:00
openeuler-ci-bot
ee9a2d631a
!42 fix CVE-2022-23633
From: @xiangbudaomz 
Reviewed-by: @jxy_git 
Signed-off-by: @jxy_git
2024-06-25 08:10:49 +00:00
zouzhimin
8fed2caae1 fix CVE-2022-23633 2024-06-12 09:47:27 +08:00
openeuler-ci-bot
950233262b
!37 [sync] PR-32: Fix CVE-2023-38037
From: @openeuler-sync-bot 
Reviewed-by: @jxy_git 
Signed-off-by: @jxy_git
2023-09-11 09:21:36 +00:00
wk333
8756d34f76 Fix CVE-2023-38037
(cherry picked from commit 2f153051b6ec0f210720c92fb921afe983b94418)
2023-09-11 17:10:24 +08:00
openeuler-ci-bot
67976979cc
!17 FIX CVE-2023-22796
From: @wszlight 
Reviewed-by: @small_leek 
Signed-off-by: @small_leek
2023-02-22 02:13:17 +00:00
wszlight
7e09cf61f4 fix CVE-2023-22796
update spec
2023-02-21 10:37:15 +00:00
openeuler-ci-bot
edf356934a !6 [sync] PR-3: upgrade to 5.2.4.4
From: @openeuler-sync-bot
Reviewed-by: @small_leek
Signed-off-by: @small_leek
2021-03-16 10:03:18 +08:00
si-gui
511c006813 upgrade to 5.2.4.4
(cherry picked from commit df8785e211e6a48c878ec0bfef0c5570371dc6ab)
2021-03-15 10:38:34 +08:00
8 changed files with 227 additions and 4 deletions

79
CVE-2022-23633.patch Normal file
View File

@ -0,0 +1,79 @@
From d1267768e9f57ebcf86ff7f011aca7fb08e733eb Mon Sep 17 00:00:00 2001
From: Aaron Patterson <aaron@rubyonrails.org>
Date: Fri, 11 Feb 2022 11:23:01 -0800
Subject: [PATCH] Fix reloader to work with new Executor signature
This is a follow up to [CVE-2022-23633].
---
lib/active_support/reloader.rb | 2 +-
lib/active_support/execution_wrapper.rb | 29 ++++++++++---------
2 file changed, 11 insertion(+), 10 deletion(-)
diff --git a/lib/active_support/reloader.rb b/lib/active_support/reloader.rb
index 2f81cd4..e751866 100644
--- a/lib/active_support/reloader.rb
+++ b/lib/active_support/reloader.rb
@@ -58,7 +58,7 @@ module ActiveSupport
prepare!
end
- def self.run! # :nodoc:
+ def self.run!(reset: false) # :nodoc:
if check!
super
else
diff --git a/lib/active_support/execution_wrapper.rb b/lib/active_support/execution_wrapper.rb
index ca810db584..07c4f435db 100644
--- a/lib/active_support/execution_wrapper.rb
+++ b/lib/active_support/execution_wrapper.rb
@@ -62,18 +62,21 @@ def self.register_hook(hook, outer: false)
# after the work has been performed.
#
# Where possible, prefer +wrap+.
- def self.run!
- if active?
- Null
+ def self.run!(reset: false)
+ if reset
+ lost_instance = active.delete(Thread.current)
+ lost_instance&.complete!
else
- new.tap do |instance|
- success = nil
- begin
- instance.run!
- success = true
- ensure
- instance.complete! unless success
- end
+ return Null if active?
+ end
+
+ new.tap do |instance|
+ success = nil
+ begin
+ instance.run!
+ success = true
+ ensure
+ instance.complete! unless success
end
end
end
@@ -102,11 +105,11 @@ def self.inherited(other) # :nodoc:
self.active = Concurrent::Hash.new
def self.active? # :nodoc:
- @active[Thread.current]
+ @active.key?(Thread.current)
end
def run! # :nodoc:
- self.class.active[Thread.current] = true
+ self.class.active[Thread.current] = self
run_callbacks(:run)
end
--
2.43.0

30
CVE-2023-22796.patch Normal file
View File

@ -0,0 +1,30 @@
From a7cda7e6aa5334ab41b1f4b0f671be931be946ef Mon Sep 17 00:00:00 2001
From: John Hawthorn <john@hawthorn.email>
Date: Wed, 11 Jan 2023 10:14:55 -0800
Subject: [PATCH] Avoid regex backtracking in Inflector.underscore
[CVE-2023-22796]
---
activesupport/lib/active_support/inflector/methods.rb | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/activesupport-5.2.4.4/lib/active_support/inflector/methods.rb b/activesupport-5.2.4.4/lib/active_support/inflector/methods.rb
index ad136532bf..acb86fe1a4 100644
--- a/activesupport-5.2.4.4/lib/active_support/inflector/methods.rb
+++ b/activesupport-5.2.4.4/lib/active_support/inflector/methods.rb
@@ -93,8 +93,7 @@ def underscore(camel_cased_word)
return camel_cased_word unless /[A-Z-]|::/.match?(camel_cased_word)
- word = camel_cased_word.to_s.gsub("::".freeze, "/".freeze)
- word.gsub!(inflections.acronyms_underscore_regex) { "#{$1 && '_'.freeze }#{$2.downcase}" }
+ word = camel_cased_word.to_s.gsub("::", "/")
+ word.gsub!(inflections.acronyms_underscore_regex) { "#{$1 && '_' }#{$2.downcase}" }
- word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2'.freeze)
- word.gsub!(/([a-z\d])([A-Z])/, '\1_\2'.freeze)
+ word.gsub!(/([A-Z])(?=[A-Z][a-z])|([a-z\d])(?=[A-Z])/) { ($1 || $2) << "_" }
- word.tr!("-".freeze, "_".freeze)
+ word.tr!("-", "_")
word.downcase!
word
--
2.35.1

24
CVE-2023-28120.patch Normal file
View File

@ -0,0 +1,24 @@
From 3cf23c3f891e2e81c977ea4ab83b62bc2a444b70 Mon Sep 17 00:00:00 2001
From: Akira Matsuda <ronnie@dio.jp>
Date: Thu, 5 Jan 2023 05:25:37 +0900
Subject: [PATCH] Implement SafeBuffer#bytesplice
---
.../core_ext/string/output_safety.rb | 4 +++
1 files changed, 4 insertions(+)
diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb
index 8a06ccdd8e385..a627540a353db 100644
--- a/activesupport/lib/active_support/core_ext/string/output_safety.rb
+++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb
@@ -216,6 +216,10 @@ def concat(value)
end
alias << concat
+ def bytesplice(*args, value)
+ super(*args, implicit_html_escape_interpolated_argument(value))
+ end
+
def prepend(value)
super(html_escape_interpolated_argument(value))
end

59
CVE-2023-38037.patch Normal file
View File

@ -0,0 +1,59 @@
From c85cc667ebfd3c270df37c7575d580ea6462e12f Mon Sep 17 00:00:00 2001
From: Aaron Patterson <aaron@rubyonrails.org>
Date: Tue, 22 Aug 2023 09:58:43 -0700
Subject: [PATCH] Use a temporary file for storing unencrypted files while
editing
Refer: https://github.com/rails/rails/commit/c85cc667ebfd3c270df37c7575d580ea6462e12f
When we're editing the contents of encrypted files, we should use the
`Tempfile` class because it creates temporary files with restrictive
permissions. This prevents other users on the same system from reading
the contents of those files while the user is editing them.
[CVE-2023-38037]
---
lib/active_support/encrypted_file.rb | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/lib/active_support/encrypted_file.rb b/lib/active_support/encrypted_file.rb
index c66f1b5..cb63e6e 100644
--- a/lib/active_support/encrypted_file.rb
+++ b/lib/active_support/encrypted_file.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
require "pathname"
+require "tempfile"
require "active_support/message_encryptor"
module ActiveSupport
@@ -57,17 +58,16 @@ module ActiveSupport
private
def writing(contents)
- tmp_file = "#{Process.pid}.#{content_path.basename.to_s.chomp('.enc')}"
- tmp_path = Pathname.new File.join(Dir.tmpdir, tmp_file)
- tmp_path.binwrite contents
+ Tempfile.create(["", "-" + content_path.basename.to_s.chomp(".enc")]) do |tmp_file|
+ tmp_path = Pathname.new(tmp_file)
+ tmp_path.binwrite contents
- yield tmp_path
+ yield tmp_path
- updated_contents = tmp_path.binread
+ updated_contents = tmp_path.binread
- write(updated_contents) if updated_contents != contents
- ensure
- FileUtils.rm(tmp_path) if tmp_path.exist?
+ write(updated_contents) if updated_contents != contents
+ end
end
--
2.33.0

Binary file not shown.

BIN
activesupport-5.2.4.4.gem Normal file

Binary file not shown.

View File

@ -2,13 +2,22 @@
%global gem_name activesupport
Name: rubygem-%{gem_name}
Epoch: 2
Version: 5.2.3
Release: 1
Version: 5.2.4.4
Release: 5
Summary: A support libraries and Ruby core extensions extracted from the Rails framework
License: MIT
URL: http://rubyonrails.org
Source0: https://rubygems.org/gems/activesupport-5.2.3.gem
Source1: https://github.com/rails/rails/archive/v5.2.3.tar.gz
Source0: https://rubygems.org/gems/activesupport-5.2.4.4.gem
Source1: https://github.com/rails/rails/archive/v5.2.4.4.tar.gz
Patch0: CVE-2023-22796.patch
Patch1: CVE-2023-38037.patch
# https://github.com/rails/rails/commit/676ad96fa5d9d0213babc32c9bad8190597a00d1
# https://github.com/rails/rails/commit/07d9600172a18b45791c89e95a642e13fc367545
Patch3000: CVE-2022-23633.patch
# https://github.com/rails/rails/commit/3cf23c3f891e2e81c977ea4ab83b62bc2a444b70
Patch3001: CVE-2023-28120.patch
Requires: rubygem(bigdecimal) rubygem(json)
BuildRequires: ruby(release) rubygems-devel ruby >= 2.2.2 rubygem(bigdecimal) rubygem(builder)
BuildRequires: rubygem(concurrent-ruby) rubygem(connection_pool) rubygem(dalli)
@ -29,6 +38,10 @@ Documentation for %{name}.
%prep
%setup -q -n %{gem_name}-%{version}
%patch0 -p2
%patch1 -p1
%patch3000 -p1
%patch3001 -p2
%build
gem build ../%{gem_name}-%{version}.gemspec
@ -72,6 +85,24 @@ popd
%doc %{gem_instdir}/README.rdoc
%changelog
* Wed Jun 26 2024 wangkai <13474090681@163.com> - 2:5.2.4.4-5
- Fix CVE-2023-28120
* Tue Jun 25 2024 zouzhimin <zouzhimin@kylinos.cn> - 2:5.2.4.4-4
- Type:CVES
- ID:CVE-2022-23633
- SUG:NA
- DESC:fix CVE-2022-23633
* Mon Sep 11 2023 wangkai <13474090681@163.com> - 2:5.2.4.4-3
- Fix CVE-2023-38037
* Tue Feb 21 2023 wushaozheng <wushaozheng@ncti-gba.cn> - 2:5.2.4.4-2
- fix CVE-2023-22796
* Mon Feb 8 2021 sunguoshuai <sunguoshuai@huawei.com> - 5.2.4.4-1
- Upgrade to 5.2.4.4
* Sat Sep 5 2020 liyanan <liyanan32@huawei.com> - 5.2.3-2
- fix build fail

Binary file not shown.