dependabot-npm_and_yarn 0.305.0 → 0.306.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/dependabot/npm_and_yarn/package/registry_finder.rb +22 -10
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ff9efde259877135fd46b68bcaacb237d36e81e6f75cef7272c9b0f5b0ac7e3
|
4
|
+
data.tar.gz: 49e0c62b28e246185249baf59537874550a7cb921a975c16516c7f53c07a6fdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63420987691aaabf0ba1fa1ce85f8607af5f7c5f96ed9e7addef8bf0f74de3bb9eccedceb62126881556f1e9c457106868575befcfd02226617b10ae9b4819c5
|
7
|
+
data.tar.gz: 867565a2869b6d54a1d23f41c4cf14e8566e56ea0c56a4ca731a8b8ffb250f80f014840f81485a972eea7da426b08b652f78216856f06af3b6f63b326172ddf6
|
@@ -221,7 +221,12 @@ module Dependabot
|
|
221
221
|
registries = []
|
222
222
|
registries += credentials
|
223
223
|
.select { |cred| cred["type"] == "npm_registry" && cred["registry"] }
|
224
|
-
.tap
|
224
|
+
.tap do |arr|
|
225
|
+
arr.each do |c|
|
226
|
+
c["registry"] = prepare_registry_url(c["registry"])
|
227
|
+
c["token"] ||= nil
|
228
|
+
end
|
229
|
+
end
|
225
230
|
registries += npmrc_registries
|
226
231
|
registries += yarnrc_registries
|
227
232
|
|
@@ -238,12 +243,12 @@ module Dependabot
|
|
238
243
|
npmrc_file&.content&.scan(NPM_AUTH_TOKEN_REGEX) do
|
239
244
|
next if Regexp.last_match&.[](:registry)&.include?("${")
|
240
245
|
|
241
|
-
registry = T.must(Regexp.last_match)[:registry]
|
246
|
+
registry = prepare_registry_url(T.must(Regexp.last_match)[:registry])
|
242
247
|
token = T.must(Regexp.last_match)[:token]&.strip
|
243
248
|
|
244
249
|
registries << {
|
245
250
|
"type" => "npm_registry",
|
246
|
-
"registry" => registry
|
251
|
+
"registry" => registry,
|
247
252
|
"token" => token
|
248
253
|
}
|
249
254
|
end
|
@@ -291,14 +296,14 @@ module Dependabot
|
|
291
296
|
return @configured_global_registry if @configured_global_registry
|
292
297
|
|
293
298
|
if parsed_yarnrc_yml&.key?("npmRegistryServer")
|
294
|
-
return @configured_global_registry = T.must(parsed_yarnrc_yml)["npmRegistryServer"]
|
299
|
+
return @configured_global_registry = prepare_registry_url(T.must(parsed_yarnrc_yml)["npmRegistryServer"])
|
295
300
|
end
|
296
301
|
|
297
302
|
replaces_base = credentials.find { |cred| cred["type"] == "npm_registry" && cred.replaces_base? }
|
298
303
|
if replaces_base
|
299
304
|
registry = replaces_base["registry"]
|
300
305
|
registry = "https://#{registry}" unless registry&.start_with?("http")
|
301
|
-
return @configured_global_registry = registry
|
306
|
+
return @configured_global_registry = prepare_registry_url(registry)
|
302
307
|
end
|
303
308
|
|
304
309
|
@configured_global_registry = nil
|
@@ -323,7 +328,7 @@ module Dependabot
|
|
323
328
|
|
324
329
|
if parsed_yarnrc_yml
|
325
330
|
yarn_berry_registry = parsed_yarnrc_yml&.dig("npmScopes", scope.delete_prefix("@"), "npmRegistryServer")
|
326
|
-
return yarn_berry_registry if yarn_berry_registry
|
331
|
+
return prepare_registry_url(yarn_berry_registry) if yarn_berry_registry
|
327
332
|
end
|
328
333
|
|
329
334
|
nil
|
@@ -341,7 +346,7 @@ module Dependabot
|
|
341
346
|
file&.content&.scan(syntax) do
|
342
347
|
next if Regexp.last_match&.[](:registry)&.include?("${")
|
343
348
|
|
344
|
-
url = T.must(T.must(Regexp.last_match)[:registry])
|
349
|
+
url = T.must(prepare_registry_url(T.must(T.must(Regexp.last_match)[:registry])))
|
345
350
|
registry = normalize_configured_registry(url)
|
346
351
|
registries << {
|
347
352
|
"type" => "npm_registry",
|
@@ -365,7 +370,7 @@ module Dependabot
|
|
365
370
|
file&.content.to_s.scan(syntax) do
|
366
371
|
next if Regexp.last_match&.[](:registry)&.include?("${") || Regexp.last_match&.[](:scope) != scope
|
367
372
|
|
368
|
-
return T.must(T.must(Regexp.last_match)[:registry])
|
373
|
+
return prepare_registry_url(T.must(T.must(Regexp.last_match)[:registry]))
|
369
374
|
end
|
370
375
|
|
371
376
|
nil
|
@@ -388,7 +393,9 @@ module Dependabot
|
|
388
393
|
&.map { |r| r.fetch(:source) }&.uniq&.compact
|
389
394
|
&.sort_by { |source| self.class.central_registry?(source[:url]) ? 1 : 0 }
|
390
395
|
|
391
|
-
sources&.find { |s| s[:type] == "registry" }
|
396
|
+
sources&.find { |s| s[:type] == "registry" }
|
397
|
+
&.fetch(:url)
|
398
|
+
&.then { |url| prepare_registry_url(url) }
|
392
399
|
end
|
393
400
|
|
394
401
|
sig { returns(T.nilable(T::Hash[String, T.untyped])) }
|
@@ -405,7 +412,12 @@ module Dependabot
|
|
405
412
|
def normalize_configured_registry(url)
|
406
413
|
url.sub(%r{/+$}, "")
|
407
414
|
.sub(%r{^.*?//}, "")
|
408
|
-
|
415
|
+
end
|
416
|
+
|
417
|
+
sig { params(url: T.nilable(String)).returns(T.nilable(String)) }
|
418
|
+
def prepare_registry_url(url)
|
419
|
+
url&.strip
|
420
|
+
&.gsub(/\s+/, "%20")
|
409
421
|
end
|
410
422
|
end
|
411
423
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependabot-npm_and_yarn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.306.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-04-
|
11
|
+
date: 2025-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dependabot-common
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.306.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.306.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: debug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -357,7 +357,7 @@ licenses:
|
|
357
357
|
- MIT
|
358
358
|
metadata:
|
359
359
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
360
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
360
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.306.0
|
361
361
|
post_install_message:
|
362
362
|
rdoc_options: []
|
363
363
|
require_paths:
|