summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_uri.rb
diff options
context:
space:
mode:
authorJonathan <jonacom@lissismore.com>2021-09-17 12:39:25 -0600
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-09-22 10:14:48 +0900
commit13bb16f41edb4682f76d02a9bf2e4d65b443dcf8 (patch)
tree80f36bd2d4dc07e15a1aa6cbef72bfa69c29a6d3 /test/rubygems/test_gem_uri.rb
parent42dcac00b156d403f5bde0c9c709bc35a9c8e963 (diff)
[rubygems/rubygems] Fix bug where redacted credentials are sent to server
Implement deep cloning for `Gem::Uri` class to fix a bug where redacting credentials modifies the URI string in place instead of returning a modified copy. https://github.com/rubygems/rubygems/commit/eafb5a279b
Diffstat (limited to 'test/rubygems/test_gem_uri.rb')
-rw-r--r--test/rubygems/test_gem_uri.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_uri.rb b/test/rubygems/test_gem_uri.rb
index 0c70443f32..7fe572518b 100644
--- a/test/rubygems/test_gem_uri.rb
+++ b/test/rubygems/test_gem_uri.rb
@@ -29,4 +29,11 @@ class TestUri < Gem::TestCase
def test_redacted_with_invalid_uri
assert_equal "https://www.example.com:80index", Gem::Uri.new("https://www.example.com:80index").redacted.to_s
end
+
+ def test_redacted_does_not_modify_uri
+ url = 'https://user:password@example.com'
+ uri = Gem::Uri.new(url)
+ assert_equal 'https://user:REDACTED@example.com', uri.redacted.to_s
+ assert_equal url, uri.to_s
+ end
end