Skip to content

Commit 39960cd

Browse files
martinemdehsbt
authored andcommitted
[rubygems/rubygems] Reduce confusion about domains used for testing
Sometimes security reports believe they have found a vulnerability because they find a domain we don't own being used in the rubygems repository. Though there is nothing vulnerable about using 'fake' domains in tests when they are never hit, it nonetheless reduces confusion for everyone if we constrain our test domains to domains we actually own and control. ruby/rubygems@e77ebbe2fc
1 parent 507de22 commit 39960cd

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

spec/bundler/bundler/settings_spec.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
end
201201

202202
context "with a configured mirror" do
203-
let(:mirror_uri) { Gem::URI("https://rubygems-mirror.org/") }
203+
let(:mirror_uri) { Gem::URI("https://example-mirror.rubygems.org/") }
204204

205205
before { settings.set_local "mirror.https://rubygems.org/", mirror_uri.to_s }
206206

@@ -277,12 +277,12 @@
277277
end
278278

279279
it "normalizes HTTP URIs in mirror configuration" do
280-
settings.set_local "mirror.http://rubygems.org", "http://rubygems-mirror.org"
280+
settings.set_local "mirror.http://rubygems.org", "http://example-mirror.rubygems.org"
281281
expect(settings.all).to include("mirror.http://rubygems.org/")
282282
end
283283

284284
it "normalizes HTTPS URIs in mirror configuration" do
285-
settings.set_local "mirror.https://rubygems.org", "http://rubygems-mirror.org"
285+
settings.set_local "mirror.https://rubygems.org", "http://example-mirror.rubygems.org"
286286
expect(settings.all).to include("mirror.https://rubygems.org/")
287287
end
288288

@@ -297,9 +297,9 @@
297297
end
298298

299299
it "reads older keys without trailing slashes" do
300-
settings.set_local "mirror.https://rubygems.org", "http://rubygems-mirror.org"
300+
settings.set_local "mirror.https://rubygems.org", "http://example-mirror.rubygems.org"
301301
expect(settings.mirror_for("https://rubygems.org/")).to eq(
302-
Gem::URI("http://rubygems-mirror.org/")
302+
Gem::URI("http://example-mirror.rubygems.org/")
303303
)
304304
end
305305

@@ -323,8 +323,8 @@
323323
end
324324

325325
it "converts older keys without trailing slashes and double underscore" do
326-
config("BUNDLE_MIRROR__HTTPS://RUBYGEMS.ORG" => "http://rubygems-mirror.org")
327-
expect(settings["mirror.https://rubygems.org/"]).to eq("http://rubygems-mirror.org")
326+
config("BUNDLE_MIRROR__HTTPS://RUBYGEMS.ORG" => "http://example-mirror.rubygems.org")
327+
expect(settings["mirror.https://rubygems.org/"]).to eq("http://example-mirror.rubygems.org")
328328
end
329329

330330
it "ignores commented out keys" do
@@ -347,8 +347,8 @@
347347
end
348348

349349
it "reads newer keys format properly" do
350-
config("BUNDLE_MIRROR__HTTPS://RUBYGEMS__ORG/" => "http://rubygems-mirror.org")
351-
expect(settings["mirror.https://rubygems.org/"]).to eq("http://rubygems-mirror.org")
350+
config("BUNDLE_MIRROR__HTTPS://RUBYGEMS__ORG/" => "http://example-mirror.rubygems.org")
351+
expect(settings["mirror.https://rubygems.org/"]).to eq("http://example-mirror.rubygems.org")
352352
end
353353
end
354354
end

spec/bundler/bundler/source/rubygems/remote_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ def remote(uri)
106106

107107
context "when a mirror with inline credentials is configured for the URI" do
108108
let(:uri) { Gem::URI("https://rubygems.org/") }
109-
let(:mirror_uri_with_auth) { Gem::URI("https://username:password@rubygems-mirror.org/") }
110-
let(:mirror_uri_no_auth) { Gem::URI("https://rubygems-mirror.org/") }
109+
let(:mirror_uri_with_auth) { Gem::URI("https://username:password@example-mirror.rubygems.org/") }
110+
let(:mirror_uri_no_auth) { Gem::URI("https://example-mirror.rubygems.org/") }
111111

112112
before { Bundler.settings.temporary("mirror.https://rubygems.org/" => mirror_uri_with_auth.to_s) }
113113

@@ -132,8 +132,8 @@ def remote(uri)
132132

133133
context "when a mirror with configured credentials is configured for the URI" do
134134
let(:uri) { Gem::URI("https://rubygems.org/") }
135-
let(:mirror_uri_with_auth) { Gem::URI("https://#{credentials}@rubygems-mirror.org/") }
136-
let(:mirror_uri_no_auth) { Gem::URI("https://rubygems-mirror.org/") }
135+
let(:mirror_uri_with_auth) { Gem::URI("https://#{credentials}@example-mirror.rubygems.org/") }
136+
let(:mirror_uri_no_auth) { Gem::URI("https://example-mirror.rubygems.org/") }
137137

138138
before do
139139
Bundler.settings.temporary("mirror.https://rubygems.org/" => mirror_uri_no_auth.to_s)

spec/bundler/bundler/yaml_serializer_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@
112112

113113
it "handles colon in key/value" do
114114
yaml = <<~YAML
115-
BUNDLE_MIRROR__HTTPS://RUBYGEMS__ORG/: http://rubygems-mirror.org
115+
BUNDLE_MIRROR__HTTPS://RUBYGEMS__ORG/: http://example-mirror.rubygems.org
116116
YAML
117117

118-
expect(serializer.load(yaml)).to eq("BUNDLE_MIRROR__HTTPS://RUBYGEMS__ORG/" => "http://rubygems-mirror.org")
118+
expect(serializer.load(yaml)).to eq("BUNDLE_MIRROR__HTTPS://RUBYGEMS__ORG/" => "http://example-mirror.rubygems.org")
119119
end
120120

121121
it "handles arrays inside hashes" do

0 commit comments

Comments
 (0)