dependabot-github_actions 0.391.0 → 0.393.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/github_actions/file_fetcher.rb +1 -1
- data/lib/dependabot/github_actions/file_updater.rb +7 -7
- data/lib/dependabot/github_actions/metadata_finder.rb +3 -8
- data/lib/dependabot/github_actions/package/package_details_fetcher.rb +38 -20
- data/lib/dependabot/github_actions/update_checker.rb +41 -20
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4209eb988f4acc1fdb05b3f95694cfba5e7972ea3cd29020a5a32aca407b64ab
|
|
4
|
+
data.tar.gz: 5638cd93a7068ed55e5eb77c5f8a85d3f5a0b01c7d3591dc3ef77c5f634498ff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 93a1ad33067ffe60ffa89d0963fe22df5b949677e00184a798aa27f00cf71d6d86c513248c960459269097e89610cb4128565adb356ee9478053cd141ee7a799
|
|
7
|
+
data.tar.gz: 8ee8ecae42b4e24b50ac8ae56482553479564564f04842326baf4ecb40557edecf6adc641667f75087184fa1ecda30533df78e591404efc37a13a2c06dd90583
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# typed:
|
|
1
|
+
# typed: strong
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
require "sorbet-runtime"
|
|
@@ -144,21 +144,21 @@ module Dependabot
|
|
|
144
144
|
updated_requirement_pairs =
|
|
145
145
|
dependency.requirements.zip(T.must(dependency.previous_requirements))
|
|
146
146
|
.reject do |new_req, old_req|
|
|
147
|
-
next true if new_req
|
|
147
|
+
next true if new_req.file != file.name
|
|
148
148
|
|
|
149
|
-
new_req
|
|
149
|
+
new_req.source == T.must(old_req).source
|
|
150
150
|
end
|
|
151
151
|
|
|
152
152
|
updated_content = T.must(file.content)
|
|
153
153
|
|
|
154
154
|
updated_requirement_pairs.each do |new_req, old_req|
|
|
155
155
|
# TODO: Support updating Docker sources
|
|
156
|
-
next unless new_req.
|
|
156
|
+
next unless new_req.source_string("type") == "git"
|
|
157
157
|
|
|
158
|
-
old_ref = T.must(
|
|
159
|
-
new_ref =
|
|
158
|
+
old_ref = T.must(T.must(old_req).source_string("ref"))
|
|
159
|
+
new_ref = T.must(new_req.source_string("ref"))
|
|
160
160
|
|
|
161
|
-
old_declaration = T.must(
|
|
161
|
+
old_declaration = T.must(T.must(old_req).metadata_string("declaration_string"))
|
|
162
162
|
new_declaration =
|
|
163
163
|
old_declaration
|
|
164
164
|
.gsub(/@.*+/, "@#{new_ref}")
|
|
@@ -15,14 +15,9 @@ module Dependabot
|
|
|
15
15
|
|
|
16
16
|
sig { override.returns(T.nilable(Dependabot::Source)) }
|
|
17
17
|
def look_up_source
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if info.nil?
|
|
22
|
-
"https://#{source_hostname}/#{dependency.name}"
|
|
23
|
-
else
|
|
24
|
-
info[:url] || info.fetch("url")
|
|
25
|
-
end
|
|
18
|
+
requirement = dependency.requirements.find(&:source_hash)
|
|
19
|
+
url = requirement&.source_string("url") ||
|
|
20
|
+
"https://#{source_hostname}/#{dependency.name}"
|
|
26
21
|
Source.from_url(url)
|
|
27
22
|
end
|
|
28
23
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# typed:
|
|
1
|
+
# typed: strong
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
require "json"
|
|
@@ -78,14 +78,16 @@ module Dependabot
|
|
|
78
78
|
# If the dependency is pinned to a tag that looks like a version then
|
|
79
79
|
# we want to update that tag.
|
|
80
80
|
if git_commit_checker.pinned_ref_looks_like_version? && latest_version_tag
|
|
81
|
-
latest_version = latest_version_tag
|
|
81
|
+
latest_version = tag_version(T.must(latest_version_tag))
|
|
82
|
+
return unless latest_version.is_a?(Dependabot::Version)
|
|
82
83
|
return current_version if shortened_semver_eq?(dependency.version, latest_version.to_s)
|
|
83
84
|
|
|
84
85
|
return latest_version
|
|
85
86
|
end
|
|
86
87
|
|
|
87
88
|
if git_commit_checker.pinned_ref_looks_like_commit_sha? && latest_version_tag
|
|
88
|
-
latest_version = latest_version_tag
|
|
89
|
+
latest_version = tag_version(T.must(latest_version_tag))
|
|
90
|
+
return unless latest_version.is_a?(Dependabot::Version)
|
|
89
91
|
return latest_commit_for_pinned_ref unless git_commit_checker.local_tag_for_pinned_sha
|
|
90
92
|
|
|
91
93
|
return latest_version
|
|
@@ -97,7 +99,7 @@ module Dependabot
|
|
|
97
99
|
end
|
|
98
100
|
# rubocop:enable Metrics/PerceivedComplexity
|
|
99
101
|
|
|
100
|
-
sig { returns(T.nilable(T::Hash[Symbol,
|
|
102
|
+
sig { returns(T.nilable(T::Hash[Symbol, Object])) }
|
|
101
103
|
def lowest_security_fix_version_tag
|
|
102
104
|
# TODO: Support Docker sources
|
|
103
105
|
return unless git_dependency?
|
|
@@ -113,25 +115,27 @@ module Dependabot
|
|
|
113
115
|
find_lowest_secure_version(tags)
|
|
114
116
|
end
|
|
115
117
|
end,
|
|
116
|
-
T.nilable(T::Hash[Symbol,
|
|
118
|
+
T.nilable(T::Hash[Symbol, Object])
|
|
117
119
|
)
|
|
118
120
|
end
|
|
119
121
|
|
|
120
|
-
sig { returns(T.nilable(T::Hash[Symbol,
|
|
122
|
+
sig { returns(T.nilable(T::Hash[Symbol, Object])) }
|
|
121
123
|
def latest_version_tag
|
|
122
124
|
@latest_version_tag ||= T.let(
|
|
123
125
|
begin
|
|
124
126
|
return git_commit_checker.local_tag_for_latest_version if dependency.version.nil?
|
|
125
127
|
|
|
126
128
|
ref = git_commit_checker.local_ref_for_latest_version_matching_existing_precision
|
|
127
|
-
return ref if ref && ref.
|
|
129
|
+
return ref if ref&.version && T.must(ref.version) > current_version
|
|
128
130
|
|
|
129
131
|
lower_precision_ref = git_commit_checker.local_ref_for_latest_version_lower_precision
|
|
130
|
-
|
|
132
|
+
# Keep the matching-precision ref when no newer lower-precision tag exists
|
|
133
|
+
return ref if ref&.version == current_version &&
|
|
134
|
+
(lower_precision_ref.nil? || T.must(lower_precision_ref.version) <= current_version)
|
|
131
135
|
|
|
132
136
|
lower_precision_ref
|
|
133
137
|
end,
|
|
134
|
-
T.nilable(T::Hash[Symbol,
|
|
138
|
+
T.nilable(T::Hash[Symbol, Object])
|
|
135
139
|
)
|
|
136
140
|
end
|
|
137
141
|
|
|
@@ -159,9 +163,7 @@ module Dependabot
|
|
|
159
163
|
[]
|
|
160
164
|
end
|
|
161
165
|
|
|
162
|
-
sig
|
|
163
|
-
returns(T::Array[T::Hash[Symbol, T.untyped]])
|
|
164
|
-
end
|
|
166
|
+
sig { returns(T::Array[T::Hash[Symbol, Object]]) }
|
|
165
167
|
def allowed_version_tags_with_release_dates
|
|
166
168
|
allowed_version_tags_hashes = git_commit_checker.local_tags_for_allowed_versions
|
|
167
169
|
tag_to_release_date = T.let({}, T::Hash[String, T.nilable(String)])
|
|
@@ -173,14 +175,14 @@ module Dependabot
|
|
|
173
175
|
|
|
174
176
|
# Combine version info with release dates and sort by version descending
|
|
175
177
|
result = allowed_version_tags_hashes.map do |tag_hash|
|
|
176
|
-
tag_name = tag_hash
|
|
178
|
+
tag_name = tag_name(tag_hash)
|
|
177
179
|
tag_hash.merge(
|
|
178
180
|
release_date: tag_to_release_date[tag_name]
|
|
179
181
|
)
|
|
180
182
|
end
|
|
181
183
|
|
|
182
184
|
# Sort by version descending (newest first)
|
|
183
|
-
result.sort_by { |tag_hash| tag_hash.fetch(:version) }.reverse
|
|
185
|
+
result.sort_by { |tag_hash| T.cast(tag_hash.fetch(:version), Gem::Version) }.reverse
|
|
184
186
|
end
|
|
185
187
|
|
|
186
188
|
private
|
|
@@ -244,23 +246,39 @@ module Dependabot
|
|
|
244
246
|
end
|
|
245
247
|
|
|
246
248
|
sig do
|
|
247
|
-
params(tags: T::Array[T::Hash[Symbol,
|
|
249
|
+
params(tags: T::Array[T::Hash[Symbol, Object]]).returns(T.nilable(T::Hash[Symbol, Object]))
|
|
248
250
|
end
|
|
249
251
|
def find_lowest_secure_version(tags)
|
|
250
|
-
relevant_tags =
|
|
251
|
-
|
|
252
|
+
relevant_tags = tags.reject do |tag|
|
|
253
|
+
security_advisories.any? { |advisory| advisory.vulnerable?(T.must(tag_version(tag))) }
|
|
254
|
+
end
|
|
252
255
|
|
|
253
256
|
relevant_tags = filter_lower_tags(relevant_tags)
|
|
254
|
-
relevant_tags.min_by { |tag|
|
|
257
|
+
relevant_tags.min_by { |tag| T.must(tag_version(tag)) }
|
|
255
258
|
end
|
|
256
259
|
|
|
257
260
|
sig do
|
|
258
|
-
params(tags_array: T::Array[T::Hash[Symbol,
|
|
261
|
+
params(tags_array: T::Array[T::Hash[Symbol, Object]]).returns(T::Array[T::Hash[Symbol, Object]])
|
|
259
262
|
end
|
|
260
263
|
def filter_lower_tags(tags_array)
|
|
261
264
|
return tags_array unless current_version
|
|
262
265
|
|
|
263
|
-
tags_array.select { |tag|
|
|
266
|
+
tags_array.select { |tag| T.must(tag_version(tag)) > current_version }
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
sig { params(tag: T::Hash[Symbol, Object]).returns(String) }
|
|
270
|
+
def tag_name(tag)
|
|
271
|
+
return tag.tag if tag.is_a?(Dependabot::GitTagDetails)
|
|
272
|
+
|
|
273
|
+
T.cast(tag.fetch(:tag), String)
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
sig { params(tag: T::Hash[Symbol, Object]).returns(T.nilable(Gem::Version)) }
|
|
277
|
+
def tag_version(tag)
|
|
278
|
+
return tag.version if tag.is_a?(Dependabot::GitTagDetails)
|
|
279
|
+
|
|
280
|
+
version = tag[:version]
|
|
281
|
+
version if version.is_a?(Gem::Version)
|
|
264
282
|
end
|
|
265
283
|
|
|
266
284
|
sig { returns(T::Boolean) }
|
|
@@ -65,24 +65,14 @@ module Dependabot
|
|
|
65
65
|
sig { override.returns(T::Array[Dependabot::DependencyRequirement]) }
|
|
66
66
|
def updated_requirements
|
|
67
67
|
updated_reqs = dependency.requirements.map do |req|
|
|
68
|
-
source =
|
|
68
|
+
source = req.source_hash
|
|
69
69
|
updated = updated_ref(source, onboarded: onboarded_requirement?(req))
|
|
70
70
|
next req unless updated
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
# Maintain a short git hash only if it matches the latest
|
|
75
|
-
if req[:type] == "git" &&
|
|
76
|
-
git_commit_checker.ref_looks_like_commit_sha?(updated) &&
|
|
77
|
-
git_commit_checker.ref_looks_like_commit_sha?(T.must(current)) &&
|
|
78
|
-
updated.start_with?(T.must(current))
|
|
79
|
-
next req
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
new_source = source.merge(ref: updated)
|
|
83
|
-
req.merge(source: new_source)
|
|
72
|
+
new_source = source_with_ref(T.must(source), updated)
|
|
73
|
+
Dependabot::DependencyRequirement.create(req.merge(source: new_source))
|
|
84
74
|
end
|
|
85
|
-
|
|
75
|
+
updated_reqs
|
|
86
76
|
end
|
|
87
77
|
|
|
88
78
|
private
|
|
@@ -171,9 +161,7 @@ module Dependabot
|
|
|
171
161
|
@git_metadata_fetcher ||= T.let(
|
|
172
162
|
Dependabot::GitMetadataFetcher.new(
|
|
173
163
|
url: T.must(
|
|
174
|
-
dependency.requirements.filter_map
|
|
175
|
-
T.cast(requirement.source, T.nilable(GitSource))&.fetch(:url, nil)
|
|
176
|
-
end.first
|
|
164
|
+
dependency.requirements.filter_map { |requirement| requirement.source_string("url") }.first
|
|
177
165
|
),
|
|
178
166
|
credentials: credentials
|
|
179
167
|
),
|
|
@@ -248,20 +236,24 @@ module Dependabot
|
|
|
248
236
|
end
|
|
249
237
|
|
|
250
238
|
sig do
|
|
251
|
-
params(
|
|
239
|
+
params(
|
|
240
|
+
source: T.nilable(Dependabot::DependencyRequirement::ObjectHash),
|
|
241
|
+
onboarded: T::Boolean
|
|
242
|
+
)
|
|
252
243
|
.returns(T.nilable(String))
|
|
253
244
|
end
|
|
254
245
|
def updated_ref(source, onboarded: false)
|
|
255
246
|
# TODO: Support Docker sources
|
|
256
247
|
return unless git_commit_checker.git_dependency?
|
|
257
248
|
|
|
258
|
-
|
|
249
|
+
git_source = source && symbolize_source(source)
|
|
250
|
+
finder = onboarded ? latest_version_finder_for(git_source) : T.must(latest_version_finder)
|
|
259
251
|
|
|
260
252
|
if vulnerable? && (new_tag = finder.lowest_security_fix_release)
|
|
261
253
|
return new_tag.fetch(:tag)
|
|
262
254
|
end
|
|
263
255
|
|
|
264
|
-
source_git_commit_checker = git_helper.git_commit_checker_for(
|
|
256
|
+
source_git_commit_checker = git_helper.git_commit_checker_for(git_source)
|
|
265
257
|
|
|
266
258
|
# Return the git tag if updating a pinned version
|
|
267
259
|
if source_git_commit_checker.pinned_ref_looks_like_version? &&
|
|
@@ -279,6 +271,35 @@ module Dependabot
|
|
|
279
271
|
nil
|
|
280
272
|
end
|
|
281
273
|
|
|
274
|
+
sig do
|
|
275
|
+
params(source: Dependabot::DependencyRequirement::ObjectHash)
|
|
276
|
+
.returns(GitSource)
|
|
277
|
+
end
|
|
278
|
+
def symbolize_source(source)
|
|
279
|
+
T.cast(source.to_h { |key, value| [key.to_sym, value] }, GitSource)
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
sig do
|
|
283
|
+
params(
|
|
284
|
+
source: Dependabot::DependencyRequirement::ObjectHash,
|
|
285
|
+
ref: String
|
|
286
|
+
).returns(Dependabot::DependencyRequirement::ObjectHash)
|
|
287
|
+
end
|
|
288
|
+
def source_with_ref(source, ref)
|
|
289
|
+
updated = source.dup
|
|
290
|
+
key = if source.key?(:ref)
|
|
291
|
+
:ref
|
|
292
|
+
elsif source.key?("ref")
|
|
293
|
+
"ref"
|
|
294
|
+
elsif source.keys.any?(Symbol)
|
|
295
|
+
:ref
|
|
296
|
+
else
|
|
297
|
+
"ref"
|
|
298
|
+
end
|
|
299
|
+
updated[key] = ref
|
|
300
|
+
updated
|
|
301
|
+
end
|
|
302
|
+
|
|
282
303
|
sig do
|
|
283
304
|
params(source_checker: Dependabot::GitCommitChecker, finder: LatestVersionFinder)
|
|
284
305
|
.returns(T.nilable(String))
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dependabot-github_actions
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.393.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dependabot
|
|
@@ -15,14 +15,14 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.
|
|
18
|
+
version: 0.393.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.
|
|
25
|
+
version: 0.393.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: debug
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -266,7 +266,7 @@ licenses:
|
|
|
266
266
|
- MIT
|
|
267
267
|
metadata:
|
|
268
268
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
|
269
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
|
269
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.393.0
|
|
270
270
|
rdoc_options: []
|
|
271
271
|
require_paths:
|
|
272
272
|
- lib
|