dependabot-common 0.375.0 → 0.377.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/dependency_file.rb +19 -0
- data/lib/dependabot/registry_client.rb +14 -2
- data/lib/dependabot/shared_helpers.rb +20 -6
- data/lib/dependabot.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6be97d14c40d59ea74fe9f48f02e95c13c734175d7eee00543924af96a216516
|
|
4
|
+
data.tar.gz: daf82ec144a7a3e8eb766988dec53b09e000dc34117d75c8ec220ccda7114d0f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4cc34b89173ce3b43c688f5692a0a5c19b1bf66e3c527c5409e2e7699e7a15f7888feab422b4cda76f3c720be69463f4699fd4fba2d6491c10be5455811d194d
|
|
7
|
+
data.tar.gz: f74a92a16c5fd939ed7121f8f2a5e47fc6dbcce641bb572909cda4be83782a00ad715eb5c4d19d5e6ff7055bc1d4aab595c57a835d3f9860758844dc2d1542ba
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# typed: strong
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require "digest"
|
|
4
5
|
require "pathname"
|
|
5
6
|
require "sorbet-runtime"
|
|
6
7
|
|
|
@@ -209,6 +210,24 @@ module Dependabot
|
|
|
209
210
|
T.must(content)
|
|
210
211
|
end
|
|
211
212
|
|
|
213
|
+
# Returns the Git blob OID for this file's content,
|
|
214
|
+
# matching the value GitHub/Spokes uses for the same blob.
|
|
215
|
+
# Accepts :sha1 (default) or :sha256 to match the repository's object format.
|
|
216
|
+
sig { params(algorithm: Symbol).returns(T.nilable(String)) }
|
|
217
|
+
def blob_oid(algorithm: :sha1)
|
|
218
|
+
return nil unless content
|
|
219
|
+
|
|
220
|
+
raw = decoded_content.dup.force_encoding(Encoding::BINARY)
|
|
221
|
+
header = "blob #{raw.bytesize}\0".b
|
|
222
|
+
digest = case algorithm
|
|
223
|
+
when :sha256 then Digest::SHA256.new
|
|
224
|
+
else Digest::SHA1.new
|
|
225
|
+
end
|
|
226
|
+
digest.update(header)
|
|
227
|
+
digest.update(raw)
|
|
228
|
+
digest.hexdigest
|
|
229
|
+
end
|
|
230
|
+
|
|
212
231
|
private
|
|
213
232
|
|
|
214
233
|
sig { params(directory: String).returns(String) }
|
|
@@ -36,7 +36,7 @@ module Dependabot
|
|
|
36
36
|
retry_interval: 5
|
|
37
37
|
)
|
|
38
38
|
rescue Excon::Error::Timeout, Excon::Error::Socket => e
|
|
39
|
-
cache_error(url, e)
|
|
39
|
+
cache_error(url, e) if cacheable_error?(e)
|
|
40
40
|
raise e
|
|
41
41
|
end
|
|
42
42
|
|
|
@@ -57,7 +57,7 @@ module Dependabot
|
|
|
57
57
|
**SharedHelpers.excon_defaults({ headers: headers }.merge(options))
|
|
58
58
|
)
|
|
59
59
|
rescue Excon::Error::Timeout, Excon::Error::Socket => e
|
|
60
|
-
cache_error(url, e)
|
|
60
|
+
cache_error(url, e) if cacheable_error?(e)
|
|
61
61
|
raise e
|
|
62
62
|
end
|
|
63
63
|
|
|
@@ -77,5 +77,17 @@ module Dependabot
|
|
|
77
77
|
host = URI(url).host
|
|
78
78
|
@cached_errors.fetch(host, nil)
|
|
79
79
|
end
|
|
80
|
+
|
|
81
|
+
sig { params(error: CachedErrorType).returns(T::Boolean) }
|
|
82
|
+
private_class_method def self.cacheable_error?(error)
|
|
83
|
+
if error.is_a?(Excon::Error::Socket)
|
|
84
|
+
case error.socket_error
|
|
85
|
+
when EOFError
|
|
86
|
+
return false
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
true
|
|
91
|
+
end
|
|
80
92
|
end
|
|
81
93
|
end
|
|
@@ -303,13 +303,20 @@ module Dependabot
|
|
|
303
303
|
previous_config = ENV.fetch("GIT_CONFIG_GLOBAL", nil)
|
|
304
304
|
# adding a random suffix to avoid conflicts when running in parallel
|
|
305
305
|
# some package managers like bundler will modify the global git config
|
|
306
|
-
|
|
306
|
+
random_suffix = SecureRandom.hex(16)
|
|
307
|
+
git_config_global_path = File.expand_path("#{random_suffix}.gitconfig", Utils::BUMP_TMP_DIR_PATH)
|
|
308
|
+
git_store_path = File.join(Dir.pwd, "#{random_suffix}.git.store")
|
|
307
309
|
previous_terminal_prompt = ENV.fetch("GIT_TERMINAL_PROMPT", nil)
|
|
308
310
|
|
|
309
311
|
begin
|
|
310
312
|
ENV["GIT_CONFIG_GLOBAL"] = git_config_global_path
|
|
311
313
|
ENV["GIT_TERMINAL_PROMPT"] = "false"
|
|
312
|
-
configure_git_to_use_https_with_credentials(
|
|
314
|
+
configure_git_to_use_https_with_credentials(
|
|
315
|
+
credentials,
|
|
316
|
+
safe_directories,
|
|
317
|
+
git_config_global_path,
|
|
318
|
+
git_store_path
|
|
319
|
+
)
|
|
313
320
|
yield
|
|
314
321
|
ensure
|
|
315
322
|
ENV["GIT_CONFIG_GLOBAL"] = previous_config
|
|
@@ -319,6 +326,7 @@ module Dependabot
|
|
|
319
326
|
raise Dependabot::OutOfDisk, e.message
|
|
320
327
|
ensure
|
|
321
328
|
FileUtils.rm_f(T.must(git_config_global_path))
|
|
329
|
+
FileUtils.rm_f(T.must(git_store_path))
|
|
322
330
|
end
|
|
323
331
|
|
|
324
332
|
# Handle SCP-style git URIs
|
|
@@ -339,10 +347,16 @@ module Dependabot
|
|
|
339
347
|
params(
|
|
340
348
|
credentials: T::Array[Dependabot::Credential],
|
|
341
349
|
safe_directories: T::Array[String],
|
|
342
|
-
git_config_global_path: String
|
|
350
|
+
git_config_global_path: String,
|
|
351
|
+
git_store_path: String
|
|
343
352
|
).void
|
|
344
353
|
end
|
|
345
|
-
def self.configure_git_to_use_https_with_credentials(
|
|
354
|
+
def self.configure_git_to_use_https_with_credentials(
|
|
355
|
+
credentials,
|
|
356
|
+
safe_directories,
|
|
357
|
+
git_config_global_path,
|
|
358
|
+
git_store_path
|
|
359
|
+
)
|
|
346
360
|
File.open(git_config_global_path, "w") do |file|
|
|
347
361
|
file << "# Generated by dependabot/dependabot-core"
|
|
348
362
|
end
|
|
@@ -353,7 +367,7 @@ module Dependabot
|
|
|
353
367
|
# whenever the credentials are deemed to be invalid, they're erased.
|
|
354
368
|
run_shell_command(
|
|
355
369
|
"git config --global credential.helper " \
|
|
356
|
-
"'!#{credential_helper_path} --file #{
|
|
370
|
+
"'!#{credential_helper_path} --file #{git_store_path}'",
|
|
357
371
|
allow_unsafe_shell_command: true,
|
|
358
372
|
fingerprint: "git config --global credential.helper '<helper_command>'"
|
|
359
373
|
)
|
|
@@ -398,7 +412,7 @@ module Dependabot
|
|
|
398
412
|
end
|
|
399
413
|
|
|
400
414
|
# Save the file
|
|
401
|
-
File.write(
|
|
415
|
+
File.write(git_store_path, git_store_content)
|
|
402
416
|
end
|
|
403
417
|
# rubocop:enable Metrics/AbcSize
|
|
404
418
|
# rubocop:enable Metrics/PerceivedComplexity
|
data/lib/dependabot.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dependabot-common
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.377.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dependabot
|
|
@@ -43,20 +43,20 @@ dependencies:
|
|
|
43
43
|
requirements:
|
|
44
44
|
- - ">="
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '
|
|
46
|
+
version: '2.4'
|
|
47
47
|
- - "<"
|
|
48
48
|
- !ruby/object:Gem::Version
|
|
49
|
-
version:
|
|
49
|
+
version: 5.0.0
|
|
50
50
|
type: :runtime
|
|
51
51
|
prerelease: false
|
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
|
53
53
|
requirements:
|
|
54
54
|
- - ">="
|
|
55
55
|
- !ruby/object:Gem::Version
|
|
56
|
-
version: '
|
|
56
|
+
version: '2.4'
|
|
57
57
|
- - "<"
|
|
58
58
|
- !ruby/object:Gem::Version
|
|
59
|
-
version:
|
|
59
|
+
version: 5.0.0
|
|
60
60
|
- !ruby/object:Gem::Dependency
|
|
61
61
|
name: commonmarker
|
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -147,14 +147,14 @@ dependencies:
|
|
|
147
147
|
requirements:
|
|
148
148
|
- - "<"
|
|
149
149
|
- !ruby/object:Gem::Version
|
|
150
|
-
version: '2.
|
|
150
|
+
version: '2.20'
|
|
151
151
|
type: :runtime
|
|
152
152
|
prerelease: false
|
|
153
153
|
version_requirements: !ruby/object:Gem::Requirement
|
|
154
154
|
requirements:
|
|
155
155
|
- - "<"
|
|
156
156
|
- !ruby/object:Gem::Version
|
|
157
|
-
version: '2.
|
|
157
|
+
version: '2.20'
|
|
158
158
|
- !ruby/object:Gem::Dependency
|
|
159
159
|
name: nokogiri
|
|
160
160
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -617,7 +617,7 @@ licenses:
|
|
|
617
617
|
- MIT
|
|
618
618
|
metadata:
|
|
619
619
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
|
620
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
|
620
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.377.0
|
|
621
621
|
rdoc_options: []
|
|
622
622
|
require_paths:
|
|
623
623
|
- lib
|