Projects
Eulaceura:Mainline:GA
ruby
_service:obs_scm:backport-0003-CVE-2024-35221.p...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:backport-0003-CVE-2024-35221.patch of Package ruby
From 466ed0e1ace6ebf069d444d666f0db3f9224a4b9 Mon Sep 17 00:00:00 2001 From: Samuel Giddins <segiddins@segiddins.me> Date: Sat, 10 Feb 2024 19:52:13 -0800 Subject: [PATCH] [rubygems/rubygems] Add a test for safe yaml https://github.com/rubygems/rubygems/commit/148deade0a --- test/rubygems/test_gem_safe_yaml.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/rubygems/test_gem_safe_yaml.rb diff --git a/test/rubygems/test_gem_safe_yaml.rb b/test/rubygems/test_gem_safe_yaml.rb new file mode 100644 index 0000000000..4f7e400132 --- /dev/null +++ b/test/rubygems/test_gem_safe_yaml.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +require_relative "helper" + +Gem.load_yaml + +class TestGemSafeYAML < Gem::TestCase + def test_aliases_enabled_by_default + assert_predicate Gem::SafeYAML, :aliases_enabled? + assert_equal({ "a" => "a", "b" => "a" }, Gem::SafeYAML.safe_load("a: &a a\nb: *a\n")) + end + + def test_aliases_disabled + aliases_enabled = Gem::SafeYAML.aliases_enabled? + Gem::SafeYAML.aliases_enabled = false + refute_predicate Gem::SafeYAML, :aliases_enabled? + assert_raise Psych::AliasesNotEnabled do + Gem::SafeYAML.safe_load("a: &a\nb: *a\n") + end + ensure + Gem::SafeYAML.aliases_enabled = aliases_enabled + end +end -- 2.33.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2