dependabot-nuget 0.229.0 → 0.231.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dependabot/nuget/file_fetcher/import_paths_finder.rb +1 -0
- data/lib/dependabot/nuget/file_fetcher/sln_project_paths_finder.rb +1 -0
- data/lib/dependabot/nuget/file_fetcher.rb +14 -13
- data/lib/dependabot/nuget/file_parser/dotnet_tools_json_parser.rb +1 -0
- data/lib/dependabot/nuget/file_parser/global_json_parser.rb +1 -0
- data/lib/dependabot/nuget/file_parser/packages_config_parser.rb +1 -0
- data/lib/dependabot/nuget/file_parser/project_file_parser.rb +10 -9
- data/lib/dependabot/nuget/file_parser/property_value_finder.rb +17 -16
- data/lib/dependabot/nuget/file_parser.rb +1 -0
- data/lib/dependabot/nuget/file_updater/packages_config_declaration_finder.rb +3 -2
- data/lib/dependabot/nuget/file_updater/project_file_declaration_finder.rb +1 -0
- data/lib/dependabot/nuget/file_updater/property_value_updater.rb +5 -4
- data/lib/dependabot/nuget/file_updater.rb +6 -5
- data/lib/dependabot/nuget/metadata_finder.rb +19 -18
- data/lib/dependabot/nuget/requirement.rb +3 -2
- data/lib/dependabot/nuget/update_checker/property_updater.rb +6 -5
- data/lib/dependabot/nuget/update_checker/repository_finder.rb +23 -22
- data/lib/dependabot/nuget/update_checker/requirements_updater.rb +1 -0
- data/lib/dependabot/nuget/update_checker/version_finder.rb +28 -27
- data/lib/dependabot/nuget/update_checker.rb +5 -4
- data/lib/dependabot/nuget/version.rb +7 -6
- data/lib/dependabot/nuget.rb +3 -2
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 608f0d97c405be7a8f527e34e436ce218bf3e7921ef697352f96e9bb50e348b5
|
4
|
+
data.tar.gz: a57f339fabc51be6fb38520a14777b544a4318f695f654538f6e5974e3b19707
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c519c1e1afeea8c81820fffab374e9b8943bb6bd6463b57ffb30fbe58b72a1a33a78480031498c10598e89dd95c5cd37c1f3ae3e5ccad6df3eac40f72e4392ae
|
7
|
+
data.tar.gz: e80994506a551c678d419b4e02962b7e257ad908f80e7b913b41ff83fd0367b5de8ea60c91d73d4b82917565c9d891c239dee26f7e70e93d4efd87477e3d2858
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# typed: false
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require "dependabot/file_fetchers"
|
@@ -77,8 +78,8 @@ module Dependabot
|
|
77
78
|
|
78
79
|
@packages_config_files ||=
|
79
80
|
candidate_paths.filter_map do |dir|
|
80
|
-
file = repo_contents(dir: dir)
|
81
|
-
find { |f| f.name.casecmp("packages.config").zero? }
|
81
|
+
file = repo_contents(dir: dir)
|
82
|
+
.find { |f| f.name.casecmp("packages.config").zero? }
|
82
83
|
fetch_file_from_host(File.join(dir, file.name)) if file
|
83
84
|
end
|
84
85
|
end
|
@@ -90,9 +91,9 @@ module Dependabot
|
|
90
91
|
|
91
92
|
# If there are no sln files but there is a src directory, check that dir
|
92
93
|
if sln_files.none? && src_dir
|
93
|
-
sln_files = repo_contents(dir: "src")
|
94
|
-
select { |f| f.name.end_with?(".sln") }.map(&:dup)
|
95
|
-
map { |file| file.tap { |f| f.name = "src/" + f.name } }
|
94
|
+
sln_files = repo_contents(dir: "src")
|
95
|
+
.select { |f| f.name.end_with?(".sln") }.map(&:dup)
|
96
|
+
.map { |file| file.tap { |f| f.name = "src/" + f.name } }
|
96
97
|
end
|
97
98
|
|
98
99
|
# Return `nil` if no sln files were found
|
@@ -156,9 +157,9 @@ module Dependabot
|
|
156
157
|
@sln_project_files ||=
|
157
158
|
begin
|
158
159
|
paths = sln_files.flat_map do |sln_file|
|
159
|
-
SlnProjectPathsFinder
|
160
|
-
new(sln_file: sln_file)
|
161
|
-
project_paths
|
160
|
+
SlnProjectPathsFinder
|
161
|
+
.new(sln_file: sln_file)
|
162
|
+
.project_paths
|
162
163
|
end
|
163
164
|
|
164
165
|
paths.filter_map do |path|
|
@@ -177,9 +178,9 @@ module Dependabot
|
|
177
178
|
return unless sln_file_names
|
178
179
|
|
179
180
|
@sln_files ||=
|
180
|
-
sln_file_names
|
181
|
-
map { |sln_file_name| fetch_file_from_host(sln_file_name) }
|
182
|
-
select { |file| file.content.valid_encoding? }
|
181
|
+
sln_file_names
|
182
|
+
.map { |sln_file_name| fetch_file_from_host(sln_file_name) }
|
183
|
+
.select { |file| file.content.valid_encoding? }
|
183
184
|
end
|
184
185
|
|
185
186
|
def csproj_file
|
@@ -231,8 +232,8 @@ module Dependabot
|
|
231
232
|
break if visited_directories.include?(dir)
|
232
233
|
|
233
234
|
visited_directories << dir
|
234
|
-
file = repo_contents(dir: dir)
|
235
|
-
find { |f| f.name.casecmp("nuget.config").zero? }
|
235
|
+
file = repo_contents(dir: dir)
|
236
|
+
.find { |f| f.name.casecmp("nuget.config").zero? }
|
236
237
|
if file
|
237
238
|
file = fetch_file_from_host(File.join(dir, file.name))
|
238
239
|
file&.tap { |f| f.support_file = true }
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# typed: false
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require "nokogiri"
|
@@ -127,8 +128,8 @@ module Dependabot
|
|
127
128
|
if prop_name
|
128
129
|
# Get the root property name unless no details could be found,
|
129
130
|
# in which case use the top-level name to ease debugging
|
130
|
-
root_prop_name = details_for_property(prop_name, project_file)
|
131
|
-
fetch(:root_property_name) || prop_name
|
131
|
+
root_prop_name = details_for_property(prop_name, project_file)
|
132
|
+
&.fetch(:root_property_name) || prop_name
|
132
133
|
requirement[:metadata] = { property_name: root_prop_name }
|
133
134
|
end
|
134
135
|
|
@@ -185,9 +186,9 @@ module Dependabot
|
|
185
186
|
|
186
187
|
return unless raw_requirement.match?(PROPERTY_REGEX)
|
187
188
|
|
188
|
-
raw_requirement
|
189
|
-
match(PROPERTY_REGEX)
|
190
|
-
named_captures.fetch("property")
|
189
|
+
raw_requirement
|
190
|
+
.match(PROPERTY_REGEX)
|
191
|
+
.named_captures.fetch("property")
|
191
192
|
end
|
192
193
|
|
193
194
|
# rubocop:disable Metrics/PerceivedComplexity
|
@@ -206,8 +207,8 @@ module Dependabot
|
|
206
207
|
def evaluated_value(value, project_file)
|
207
208
|
return value unless value.match?(PROPERTY_REGEX)
|
208
209
|
|
209
|
-
property_name = value.match(PROPERTY_REGEX)
|
210
|
-
|
210
|
+
property_name = value.match(PROPERTY_REGEX)
|
211
|
+
.named_captures.fetch("property")
|
211
212
|
property_details = details_for_property(property_name, project_file)
|
212
213
|
|
213
214
|
# Don't halt parsing for a missing property value until we're
|
@@ -218,8 +219,8 @@ module Dependabot
|
|
218
219
|
end
|
219
220
|
|
220
221
|
def details_for_property(property_name, project_file)
|
221
|
-
property_value_finder
|
222
|
-
property_details(
|
222
|
+
property_value_finder
|
223
|
+
.property_details(
|
223
224
|
property_name: property_name,
|
224
225
|
callsite_file: project_file
|
225
226
|
)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# typed: false
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require "dependabot/nuget/file_fetcher/import_paths_finder"
|
@@ -53,11 +54,11 @@ module Dependabot
|
|
53
54
|
end
|
54
55
|
|
55
56
|
def check_next_level_of_stack(node_details, stack)
|
56
|
-
property_name = node_details.fetch(:value)
|
57
|
-
|
58
|
-
|
59
|
-
callsite_file = dependency_files
|
60
|
-
find { |f| f.name == node_details.fetch(:file) }
|
57
|
+
property_name = node_details.fetch(:value)
|
58
|
+
.match(PROPERTY_REGEX)
|
59
|
+
.named_captures.fetch("property")
|
60
|
+
callsite_file = dependency_files
|
61
|
+
.find { |f| f.name == node_details.fetch(:file) }
|
61
62
|
|
62
63
|
raise "Circular reference!" if stack.include?([property_name, callsite_file.name])
|
63
64
|
|
@@ -82,17 +83,17 @@ module Dependabot
|
|
82
83
|
|
83
84
|
# Otherwise, we need to look in an imported file
|
84
85
|
import_path_finder =
|
85
|
-
Nuget::FileFetcher::ImportPathsFinder
|
86
|
-
new(project_file: file)
|
86
|
+
Nuget::FileFetcher::ImportPathsFinder
|
87
|
+
.new(project_file: file)
|
87
88
|
|
88
89
|
import_paths = [
|
89
90
|
*import_path_finder.import_paths,
|
90
91
|
*import_path_finder.project_reference_paths
|
91
92
|
]
|
92
93
|
|
93
|
-
file = import_paths
|
94
|
-
filter_map { |p| dependency_files.find { |f| f.name == p } }
|
95
|
-
find { |f| deep_find_prop_node(property: property, file: f) }
|
94
|
+
file = import_paths
|
95
|
+
.filter_map { |p| dependency_files.find { |f| f.name == p } }
|
96
|
+
.find { |f| deep_find_prop_node(property: property, file: f) }
|
96
97
|
|
97
98
|
return unless file
|
98
99
|
|
@@ -137,8 +138,8 @@ module Dependabot
|
|
137
138
|
Pathname.new(base + "/Directory.Build.targets").cleanpath.to_path
|
138
139
|
end.reverse + ["Directory.Build.targets"]
|
139
140
|
|
140
|
-
path = possible_paths.uniq
|
141
|
-
|
141
|
+
path = possible_paths.uniq
|
142
|
+
.find { |p| dependency_files.find { |f| f.name == p } }
|
142
143
|
|
143
144
|
dependency_files.find { |f| f.name == path }
|
144
145
|
end
|
@@ -154,8 +155,8 @@ module Dependabot
|
|
154
155
|
end.reverse + ["Directory.Build.props"]
|
155
156
|
|
156
157
|
path =
|
157
|
-
possible_paths.uniq
|
158
|
-
|
158
|
+
possible_paths.uniq
|
159
|
+
.find { |p| dependency_files.find { |f| f.name.casecmp(p).zero? } }
|
159
160
|
|
160
161
|
dependency_files.find { |f| f.name == path }
|
161
162
|
end
|
@@ -170,8 +171,8 @@ module Dependabot
|
|
170
171
|
Pathname.new(base + "/Directory.Packages.props").cleanpath.to_path
|
171
172
|
end.reverse + ["Directory.Packages.props"]
|
172
173
|
|
173
|
-
path = possible_paths.uniq
|
174
|
-
|
174
|
+
path = possible_paths.uniq
|
175
|
+
.find { |p| dependency_files.find { |f| f.name == p } }
|
175
176
|
|
176
177
|
dependency_files.find { |f| f.name == path }
|
177
178
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# typed: false
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require "nokogiri"
|
@@ -20,8 +21,8 @@ module Dependabot
|
|
20
21
|
@packages_config = packages_config
|
21
22
|
@declaring_requirement = declaring_requirement
|
22
23
|
|
23
|
-
if declaring_requirement[:file].split("/").last
|
24
|
-
|
24
|
+
if declaring_requirement[:file].split("/").last
|
25
|
+
.casecmp("packages.config").zero?
|
25
26
|
return
|
26
27
|
end
|
27
28
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# typed: false
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require "nokogiri"
|
@@ -17,8 +18,8 @@ module Dependabot
|
|
17
18
|
def update_files_for_property_change(property_name:, updated_value:,
|
18
19
|
callsite_file:)
|
19
20
|
declaration_details =
|
20
|
-
property_value_finder
|
21
|
-
property_details(
|
21
|
+
property_value_finder
|
22
|
+
.property_details(
|
22
23
|
property_name: property_name,
|
23
24
|
callsite_file: callsite_file
|
24
25
|
)
|
@@ -47,8 +48,8 @@ module Dependabot
|
|
47
48
|
|
48
49
|
def property_value_finder
|
49
50
|
@property_value_finder ||=
|
50
|
-
Nuget::FileParser::PropertyValueFinder
|
51
|
-
new(dependency_files: dependency_files)
|
51
|
+
Nuget::FileParser::PropertyValueFinder
|
52
|
+
.new(dependency_files: dependency_files)
|
52
53
|
end
|
53
54
|
|
54
55
|
def update_file(file:, content:)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# typed: false
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require "dependabot/file_updaters"
|
@@ -72,8 +73,8 @@ module Dependabot
|
|
72
73
|
def update_files_for_dependency(files:, dependency:)
|
73
74
|
# The UpdateChecker ensures the order of requirements is preserved
|
74
75
|
# when updating, so we can zip them together in new/old pairs.
|
75
|
-
reqs = dependency.requirements.zip(dependency.previous_requirements)
|
76
|
-
|
76
|
+
reqs = dependency.requirements.zip(dependency.previous_requirements)
|
77
|
+
.reject { |new_req, old_req| new_req == old_req }
|
77
78
|
|
78
79
|
# Loop through each changed requirement and update the files
|
79
80
|
reqs.each do |new_req, old_req|
|
@@ -97,9 +98,9 @@ module Dependabot
|
|
97
98
|
files = files.dup
|
98
99
|
property_name = req.fetch(:metadata).fetch(:property_name)
|
99
100
|
|
100
|
-
PropertyValueUpdater
|
101
|
-
new(dependency_files: files)
|
102
|
-
update_files_for_property_change(
|
101
|
+
PropertyValueUpdater
|
102
|
+
.new(dependency_files: files)
|
103
|
+
.update_files_for_property_change(
|
103
104
|
property_name: property_name,
|
104
105
|
updated_value: req.fetch(:requirement),
|
105
106
|
callsite_file: file
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# typed: false
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require "nokogiri"
|
@@ -55,10 +56,10 @@ module Dependabot
|
|
55
56
|
end
|
56
57
|
|
57
58
|
def extract_search_url(body)
|
58
|
-
JSON.parse(body)
|
59
|
-
|
60
|
-
|
61
|
-
fetch("@id")
|
59
|
+
JSON.parse(body)
|
60
|
+
.fetch("resources", [])
|
61
|
+
.find { |r| r.fetch("@type") == "SearchQueryService" }
|
62
|
+
&.fetch("@id")
|
62
63
|
end
|
63
64
|
|
64
65
|
def extract_source_repo(body)
|
@@ -80,8 +81,8 @@ module Dependabot
|
|
80
81
|
|
81
82
|
def look_up_source_in_nuspec(nuspec)
|
82
83
|
potential_source_urls = [
|
83
|
-
nuspec.at_css("package > metadata > repository")
|
84
|
-
attribute("url")&.value,
|
84
|
+
nuspec.at_css("package > metadata > repository")
|
85
|
+
&.attribute("url")&.value,
|
85
86
|
nuspec.at_css("package > metadata > repository > url")&.content,
|
86
87
|
nuspec.at_css("package > metadata > projectUrl")&.content,
|
87
88
|
nuspec.at_css("package > metadata > licenseUrl")&.content
|
@@ -95,8 +96,8 @@ module Dependabot
|
|
95
96
|
|
96
97
|
def source_from_anywhere_in_nuspec(nuspec)
|
97
98
|
github_urls = []
|
98
|
-
nuspec.to_s.force_encoding(Encoding::UTF_8)
|
99
|
-
|
99
|
+
nuspec.to_s.force_encoding(Encoding::UTF_8)
|
100
|
+
.scan(Source::SOURCE_REGEX) do
|
100
101
|
github_urls << Regexp.last_match.to_s
|
101
102
|
end
|
102
103
|
|
@@ -118,15 +119,15 @@ module Dependabot
|
|
118
119
|
end
|
119
120
|
|
120
121
|
def dependency_nuspec_url
|
121
|
-
source = dependency.requirements
|
122
|
-
|
122
|
+
source = dependency.requirements
|
123
|
+
.find { |r| r&.fetch(:source) }&.fetch(:source)
|
123
124
|
|
124
125
|
source.fetch(:nuspec_url) if source&.key?(:nuspec_url)
|
125
126
|
end
|
126
127
|
|
127
128
|
def dependency_source_url
|
128
|
-
source = dependency.requirements
|
129
|
-
|
129
|
+
source = dependency.requirements
|
130
|
+
.find { |r| r&.fetch(:source) }&.fetch(:source)
|
130
131
|
|
131
132
|
return unless source
|
132
133
|
return source.fetch(:source_url) if source.key?(:source_url)
|
@@ -136,14 +137,14 @@ module Dependabot
|
|
136
137
|
|
137
138
|
# rubocop:disable Metrics/PerceivedComplexity
|
138
139
|
def auth_header
|
139
|
-
source = dependency.requirements
|
140
|
-
|
140
|
+
source = dependency.requirements
|
141
|
+
.find { |r| r&.fetch(:source) }&.fetch(:source)
|
141
142
|
url = source&.fetch(:url, nil) || source&.fetch("url")
|
142
143
|
|
143
|
-
token = credentials
|
144
|
-
select { |cred| cred["type"] == "nuget_feed" }
|
145
|
-
find { |cred| cred["url"] == url }
|
146
|
-
fetch("token", nil)
|
144
|
+
token = credentials
|
145
|
+
.select { |cred| cred["type"] == "nuget_feed" }
|
146
|
+
.find { |cred| cred["url"] == url }
|
147
|
+
&.fetch("token", nil)
|
147
148
|
|
148
149
|
return {} unless token
|
149
150
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# typed: false
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require "dependabot/utils"
|
@@ -101,5 +102,5 @@ module Dependabot
|
|
101
102
|
end
|
102
103
|
end
|
103
104
|
|
104
|
-
Dependabot::Utils
|
105
|
-
register_requirement_class("nuget", Dependabot::Nuget::Requirement)
|
105
|
+
Dependabot::Utils
|
106
|
+
.register_requirement_class("nuget", Dependabot::Nuget::Requirement)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# typed: false
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require "dependabot/nuget/file_parser"
|
@@ -19,8 +20,8 @@ module Dependabot
|
|
19
20
|
@ignored_versions = ignored_versions
|
20
21
|
@raise_on_ignored = raise_on_ignored
|
21
22
|
@target_version = target_version_details&.fetch(:version)
|
22
|
-
@source_details = target_version_details
|
23
|
-
slice(:nuspec_url, :repo_url, :source_url)
|
23
|
+
@source_details = target_version_details
|
24
|
+
&.slice(:nuspec_url, :repo_url, :source_url)
|
24
25
|
end
|
25
26
|
|
26
27
|
def update_possible?
|
@@ -75,9 +76,9 @@ module Dependabot
|
|
75
76
|
end
|
76
77
|
|
77
78
|
def property_name
|
78
|
-
@property_name ||= dependency.requirements
|
79
|
-
|
80
|
-
dig(:metadata, :property_name)
|
79
|
+
@property_name ||= dependency.requirements
|
80
|
+
.find { |r| r.dig(:metadata, :property_name) }
|
81
|
+
&.dig(:metadata, :property_name)
|
81
82
|
|
82
83
|
raise "No requirement with a property name!" unless @property_name
|
83
84
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# typed: false
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require "excon"
|
@@ -77,25 +78,25 @@ module Dependabot
|
|
77
78
|
end
|
78
79
|
|
79
80
|
def base_url_from_v3_metadata(metadata)
|
80
|
-
metadata
|
81
|
-
fetch("resources", [])
|
82
|
-
find { |r| r.fetch("@type") == "PackageBaseAddress/3.0.0" }
|
83
|
-
fetch("@id")
|
81
|
+
metadata
|
82
|
+
.fetch("resources", [])
|
83
|
+
.find { |r| r.fetch("@type") == "PackageBaseAddress/3.0.0" }
|
84
|
+
&.fetch("@id")
|
84
85
|
end
|
85
86
|
|
86
87
|
def search_url_from_v3_metadata(metadata)
|
87
|
-
metadata
|
88
|
-
fetch("resources", [])
|
89
|
-
find { |r| r.fetch("@type") == "SearchQueryService" }
|
90
|
-
fetch("@id")
|
88
|
+
metadata
|
89
|
+
.fetch("resources", [])
|
90
|
+
.find { |r| r.fetch("@type") == "SearchQueryService" }
|
91
|
+
&.fetch("@id")
|
91
92
|
end
|
92
93
|
|
93
94
|
def build_v2_url(response, repo_details)
|
94
95
|
doc = Nokogiri::XML(response.body)
|
95
96
|
|
96
97
|
doc.remove_namespaces!
|
97
|
-
base_url = doc.at_xpath("service")&.attributes
|
98
|
-
fetch("base", nil)&.value
|
98
|
+
base_url = doc.at_xpath("service")&.attributes
|
99
|
+
&.fetch("base", nil)&.value
|
99
100
|
|
100
101
|
base_url ||= repo_details.fetch(:url)
|
101
102
|
|
@@ -137,9 +138,9 @@ module Dependabot
|
|
137
138
|
|
138
139
|
def credential_repositories
|
139
140
|
@credential_repositories ||=
|
140
|
-
credentials
|
141
|
-
select { |cred| cred["type"] == "nuget_feed" }
|
142
|
-
map { |c| { url: c.fetch("url"), token: c["token"] } }
|
141
|
+
credentials
|
142
|
+
.select { |cred| cred["type"] == "nuget_feed" }
|
143
|
+
.map { |c| { url: c.fetch("url"), token: c["token"] } }
|
143
144
|
end
|
144
145
|
|
145
146
|
def config_file_repositories
|
@@ -226,13 +227,13 @@ module Dependabot
|
|
226
227
|
"> #{tag} > add")
|
227
228
|
|
228
229
|
username =
|
229
|
-
creds_nodes
|
230
|
-
find { |n| n.attribute("key")&.value == "Username" }
|
231
|
-
attribute("value")&.value
|
230
|
+
creds_nodes
|
231
|
+
.find { |n| n.attribute("key")&.value == "Username" }
|
232
|
+
&.attribute("value")&.value
|
232
233
|
password =
|
233
|
-
creds_nodes
|
234
|
-
find { |n| n.attribute("key")&.value == "ClearTextPassword" }
|
235
|
-
attribute("value")&.value
|
234
|
+
creds_nodes
|
235
|
+
.find { |n| n.attribute("key")&.value == "ClearTextPassword" }
|
236
|
+
&.attribute("value")&.value
|
236
237
|
|
237
238
|
# NOTE: We have to look for plain text passwords, as we have no
|
238
239
|
# way of decrypting encrypted passwords. For the same reason we
|
@@ -250,9 +251,9 @@ module Dependabot
|
|
250
251
|
# rubocop:enable Metrics/PerceivedComplexity
|
251
252
|
|
252
253
|
def remove_wrapping_zero_width_chars(string)
|
253
|
-
string.force_encoding("UTF-8").encode
|
254
|
-
|
255
|
-
|
254
|
+
string.force_encoding("UTF-8").encode
|
255
|
+
.gsub(/\A[\u200B-\u200D\uFEFF]/, "")
|
256
|
+
.gsub(/[\u200B-\u200D\uFEFF]\Z/, "")
|
256
257
|
end
|
257
258
|
|
258
259
|
def auth_header_for_token(token)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# typed: false
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require "excon"
|
@@ -75,8 +76,8 @@ module Dependabot
|
|
75
76
|
ignored_versions.each do |req|
|
76
77
|
ignore_req = requirement_class.new(parse_requirement_string(req))
|
77
78
|
filtered =
|
78
|
-
filtered
|
79
|
-
reject { |v| ignore_req.satisfied_by?(v.fetch(:version)) }
|
79
|
+
filtered
|
80
|
+
.reject { |v| ignore_req.satisfied_by?(v.fetch(:version)) }
|
80
81
|
end
|
81
82
|
|
82
83
|
if @raise_on_ignored && filter_lower_versions(filtered).empty? &&
|
@@ -103,13 +104,13 @@ module Dependabot
|
|
103
104
|
|
104
105
|
def available_v3_versions
|
105
106
|
v3_nuget_listings.flat_map do |listing|
|
106
|
-
listing
|
107
|
-
fetch("versions", [])
|
108
|
-
map do |v|
|
107
|
+
listing
|
108
|
+
.fetch("versions", [])
|
109
|
+
.map do |v|
|
109
110
|
listing_details = listing.fetch("listing_details")
|
110
|
-
nuspec_url = listing_details
|
111
|
-
fetch(:versions_url, nil)
|
112
|
-
gsub(/index\.json$/, "#{v}/#{sanitized_name}.nuspec")
|
111
|
+
nuspec_url = listing_details
|
112
|
+
.fetch(:versions_url, nil)
|
113
|
+
&.gsub(/index\.json$/, "#{v}/#{sanitized_name}.nuspec")
|
113
114
|
|
114
115
|
{
|
115
116
|
version: version_class.new(v),
|
@@ -133,8 +134,8 @@ module Dependabot
|
|
133
134
|
|
134
135
|
entry_details = dependency_details_from_v2_entry(entry)
|
135
136
|
entry_details.merge(
|
136
|
-
repo_url: listing.fetch("listing_details")
|
137
|
-
fetch(:repository_url)
|
137
|
+
repo_url: listing.fetch("listing_details")
|
138
|
+
.fetch(:repository_url)
|
138
139
|
)
|
139
140
|
end
|
140
141
|
end
|
@@ -173,9 +174,9 @@ module Dependabot
|
|
173
174
|
return true if reqs.any?("*-*")
|
174
175
|
next unless reqs.any? { |r| r.include?("-") }
|
175
176
|
|
176
|
-
requirement_class
|
177
|
-
requirements_array(req.fetch(:requirement))
|
178
|
-
any? do |r|
|
177
|
+
requirement_class
|
178
|
+
.requirements_array(req.fetch(:requirement))
|
179
|
+
.any? do |r|
|
179
180
|
r.requirements.any? { |a| a.last.release == version.release }
|
180
181
|
end
|
181
182
|
rescue Gem::Requirement::BadRequirementError
|
@@ -189,9 +190,9 @@ module Dependabot
|
|
189
190
|
return @v3_nuget_listings unless @v3_nuget_listings.nil?
|
190
191
|
|
191
192
|
@v3_nuget_listings ||=
|
192
|
-
dependency_urls
|
193
|
-
select { |details| details.fetch(:repository_type) == "v3" }
|
194
|
-
filter_map do |url_details|
|
193
|
+
dependency_urls
|
194
|
+
.select { |details| details.fetch(:repository_type) == "v3" }
|
195
|
+
.filter_map do |url_details|
|
195
196
|
versions = versions_for_v3_repository(url_details)
|
196
197
|
next unless versions
|
197
198
|
|
@@ -203,10 +204,10 @@ module Dependabot
|
|
203
204
|
return @v2_nuget_listings unless @v2_nuget_listings.nil?
|
204
205
|
|
205
206
|
@v2_nuget_listings ||=
|
206
|
-
dependency_urls
|
207
|
-
select { |details| details.fetch(:repository_type) == "v2" }
|
208
|
-
flat_map { |url_details| fetch_paginated_v2_nuget_listings(url_details) }
|
209
|
-
filter_map do |url_details, response|
|
207
|
+
dependency_urls
|
208
|
+
.select { |details| details.fetch(:repository_type) == "v2" }
|
209
|
+
.flat_map { |url_details| fetch_paginated_v2_nuget_listings(url_details) }
|
210
|
+
.filter_map do |url_details, response|
|
210
211
|
next unless response.status == 200
|
211
212
|
|
212
213
|
{
|
@@ -277,10 +278,10 @@ module Dependabot
|
|
277
278
|
return unless response.status == 200
|
278
279
|
|
279
280
|
body = remove_wrapping_zero_width_chars(response.body)
|
280
|
-
JSON.parse(body).fetch("data")
|
281
|
-
|
282
|
-
fetch("versions")
|
283
|
-
map { |d| d.fetch("version") }
|
281
|
+
JSON.parse(body).fetch("data")
|
282
|
+
.find { |d| d.fetch("id").casecmp(sanitized_name).zero? }
|
283
|
+
&.fetch("versions")
|
284
|
+
&.map { |d| d.fetch("version") }
|
284
285
|
rescue Excon::Error::Timeout, Excon::Error::Socket
|
285
286
|
repo_url = repository_details[:repository_url]
|
286
287
|
raise if repo_url == RepositoryFinder::DEFAULT_REPOSITORY_URL
|
@@ -315,9 +316,9 @@ module Dependabot
|
|
315
316
|
end
|
316
317
|
|
317
318
|
def remove_wrapping_zero_width_chars(string)
|
318
|
-
string.force_encoding("UTF-8").encode
|
319
|
-
|
320
|
-
|
319
|
+
string.force_encoding("UTF-8").encode
|
320
|
+
.gsub(/\A[\u200B-\u200D\uFEFF]/, "")
|
321
|
+
.gsub(/[\u200B-\u200D\uFEFF]\Z/, "")
|
321
322
|
end
|
322
323
|
|
323
324
|
def excon_options
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# typed: false
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require "dependabot/nuget/file_parser"
|
@@ -41,8 +42,8 @@ module Dependabot
|
|
41
42
|
RequirementsUpdater.new(
|
42
43
|
requirements: dependency.requirements,
|
43
44
|
latest_version: preferred_resolvable_version&.to_s,
|
44
|
-
source_details: preferred_version_details
|
45
|
-
slice(:nuspec_url, :repo_url, :source_url)
|
45
|
+
source_details: preferred_version_details
|
46
|
+
&.slice(:nuspec_url, :repo_url, :source_url)
|
46
47
|
).updated_requirements
|
47
48
|
end
|
48
49
|
|
@@ -132,8 +133,8 @@ module Dependabot
|
|
132
133
|
|
133
134
|
def declarations_using_a_property
|
134
135
|
@declarations_using_a_property ||=
|
135
|
-
dependency.requirements
|
136
|
-
|
136
|
+
dependency.requirements
|
137
|
+
.select { |req| req.dig(:metadata, :property_name) }
|
137
138
|
end
|
138
139
|
|
139
140
|
def all_property_based_dependencies
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# typed: false
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require "dependabot/version"
|
@@ -51,15 +52,15 @@ module Dependabot
|
|
51
52
|
# rubocop:disable Metrics/PerceivedComplexity
|
52
53
|
def compare_prerelease_part(other)
|
53
54
|
release_str = @version_string.split("-").first || ""
|
54
|
-
prerelease_string = @version_string
|
55
|
-
sub(release_str, "")
|
56
|
-
sub("-", "")
|
55
|
+
prerelease_string = @version_string
|
56
|
+
.sub(release_str, "")
|
57
|
+
.sub("-", "")
|
57
58
|
prerelease_string = nil if prerelease_string == ""
|
58
59
|
|
59
60
|
other_release_str = other.to_s.split("-").first || ""
|
60
|
-
other_prerelease_string = other.to_s
|
61
|
-
|
62
|
-
|
61
|
+
other_prerelease_string = other.to_s
|
62
|
+
.sub(other_release_str, "")
|
63
|
+
.sub("-", "")
|
63
64
|
other_prerelease_string = nil if other_prerelease_string == ""
|
64
65
|
|
65
66
|
return -1 if prerelease_string && !other_prerelease_string
|
data/lib/dependabot/nuget.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# typed: false
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
# These all need to be required so the various classes can be registered in a
|
@@ -11,8 +12,8 @@ require "dependabot/nuget/requirement"
|
|
11
12
|
require "dependabot/nuget/version"
|
12
13
|
|
13
14
|
require "dependabot/pull_request_creator/labeler"
|
14
|
-
Dependabot::PullRequestCreator::Labeler
|
15
|
-
register_label_details("nuget", name: ".NET", colour: "7121c6")
|
15
|
+
Dependabot::PullRequestCreator::Labeler
|
16
|
+
.register_label_details("nuget", name: ".NET", colour: "7121c6")
|
16
17
|
|
17
18
|
require "dependabot/dependency"
|
18
19
|
Dependabot::Dependency.register_production_check(
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dependabot-nuget
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.231.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-09-12 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.231.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.231.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: debug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 1.19.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop-sorbet
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.7.3
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.7.3
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: stackprof
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -213,7 +227,7 @@ licenses:
|
|
213
227
|
- Nonstandard
|
214
228
|
metadata:
|
215
229
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
216
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
230
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.231.0
|
217
231
|
post_install_message:
|
218
232
|
rdoc_options: []
|
219
233
|
require_paths:
|