dependabot-nuget 0.289.0 → 0.291.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/helpers/lib/NuGetUpdater/Directory.Packages.props +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/AnalyzeCommand.cs +7 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/RunCommand.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Analyze.cs +26 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +2 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Run.cs +0 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs +6 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/CompatabilityChecker.cs +24 -9
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/DependencyFinder.cs +2 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/NuGetContext.cs +0 -13
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/RequirementConverter.cs +17 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +44 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/PackagesConfigDiscovery.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/ProjectDiscoveryResult.cs +2 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs +19 -11
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ErrorType.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ExperimentsManager.cs +3 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Advisory.cs +13 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/AllowedUpdate.cs +18 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/CommitOptions.cs +8 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Condition.cs +19 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyGroup.cs +8 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/GroupPullRequest.cs +9 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Job.cs +13 -10
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/PullRequest.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/RequirementsUpdateStrategy.cs +15 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +24 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/VersionConverter.cs +19 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs +2 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/LockFileUpdater.cs +3 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackageReferenceUpdater.cs +43 -18
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs +13 -12
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/JsonHelper.cs +2 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +40 -14
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/NuGetHelper.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ProcessExtensions.cs +45 -7
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ProjectHelper.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTestBase.cs +5 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.DotNetToolsJson.cs +45 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs +35 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +0 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +41 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/ExpectedDiscoveryResults.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/SdkProjectDiscoveryTests.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs +2 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/MiscellaneousTests.cs +85 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +7 -31
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs +340 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs +18 -7
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackagesConfigUpdaterTests.cs +24 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +0 -12
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +84 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +66 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackageReference.cs +55 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +0 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +785 -755
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/PathHelperTests.cs +2 -2
- data/lib/dependabot/nuget/analysis/analysis_json_reader.rb +1 -1
- data/lib/dependabot/nuget/analysis/dependency_analysis.rb +3 -3
- data/lib/dependabot/nuget/discovery/dependency_details.rb +10 -3
- data/lib/dependabot/nuget/discovery/dependency_file_discovery.rb +8 -12
- data/lib/dependabot/nuget/discovery/discovery_json_reader.rb +214 -29
- data/lib/dependabot/nuget/discovery/project_discovery.rb +41 -8
- data/lib/dependabot/nuget/discovery/workspace_discovery.rb +14 -19
- data/lib/dependabot/nuget/file_fetcher.rb +3 -3
- data/lib/dependabot/nuget/file_parser.rb +92 -3
- data/lib/dependabot/nuget/file_updater.rb +13 -13
- data/lib/dependabot/nuget/language.rb +82 -0
- data/lib/dependabot/nuget/native_helpers.rb +37 -5
- data/lib/dependabot/nuget/package_manager.rb +51 -0
- data/lib/dependabot/nuget/update_checker/requirements_updater.rb +23 -27
- data/lib/dependabot/nuget/update_checker.rb +116 -190
- metadata +20 -29
- data/lib/dependabot/nuget/discovery/directory_packages_props_discovery.rb +0 -43
- data/lib/dependabot/nuget/http_response_helpers.rb +0 -19
- data/lib/dependabot/nuget/native_discovery/native_dependency_details.rb +0 -102
- data/lib/dependabot/nuget/native_discovery/native_dependency_file_discovery.rb +0 -122
- data/lib/dependabot/nuget/native_discovery/native_discovery_json_reader.rb +0 -277
- data/lib/dependabot/nuget/native_discovery/native_evaluation_details.rb +0 -63
- data/lib/dependabot/nuget/native_discovery/native_project_discovery.rb +0 -104
- data/lib/dependabot/nuget/native_discovery/native_property_details.rb +0 -43
- data/lib/dependabot/nuget/native_discovery/native_workspace_discovery.rb +0 -61
- data/lib/dependabot/nuget/native_update_checker/native_requirements_updater.rb +0 -105
- data/lib/dependabot/nuget/native_update_checker/native_update_checker.rb +0 -214
- data/lib/dependabot/nuget/nuget_client.rb +0 -223
- data/lib/dependabot/nuget/update_checker/compatibility_checker.rb +0 -116
- data/lib/dependabot/nuget/update_checker/dependency_finder.rb +0 -297
- data/lib/dependabot/nuget/update_checker/nupkg_fetcher.rb +0 -221
- data/lib/dependabot/nuget/update_checker/nuspec_fetcher.rb +0 -110
- data/lib/dependabot/nuget/update_checker/property_updater.rb +0 -196
- data/lib/dependabot/nuget/update_checker/repository_finder.rb +0 -466
- data/lib/dependabot/nuget/update_checker/tfm_comparer.rb +0 -34
- data/lib/dependabot/nuget/update_checker/tfm_finder.rb +0 -30
- data/lib/dependabot/nuget/update_checker/version_finder.rb +0 -449
@@ -1,7 +1,8 @@
|
|
1
|
-
# typed:
|
1
|
+
# typed: strong
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require "dependabot/nuget/
|
4
|
+
require "dependabot/nuget/analysis/analysis_json_reader"
|
5
|
+
require "dependabot/nuget/discovery/discovery_json_reader"
|
5
6
|
require "dependabot/update_checkers"
|
6
7
|
require "dependabot/update_checkers/base"
|
7
8
|
require "sorbet-runtime"
|
@@ -11,38 +12,22 @@ module Dependabot
|
|
11
12
|
class UpdateChecker < Dependabot::UpdateCheckers::Base
|
12
13
|
extend T::Sig
|
13
14
|
|
14
|
-
require_relative "update_checker/version_finder"
|
15
|
-
require_relative "update_checker/property_updater"
|
16
15
|
require_relative "update_checker/requirements_updater"
|
17
|
-
require_relative "update_checker/dependency_finder"
|
18
|
-
|
19
|
-
require_relative "native_update_checker/native_update_checker"
|
20
|
-
|
21
|
-
PROPERTY_REGEX = /\$\((?<property>.*?)\)/
|
22
|
-
|
23
|
-
sig { returns(T::Boolean) }
|
24
|
-
def self.native_analysis_enabled?
|
25
|
-
Dependabot::Experiments.enabled?(:nuget_native_analysis)
|
26
|
-
end
|
27
16
|
|
28
17
|
sig { override.returns(T.nilable(String)) }
|
29
18
|
def latest_version
|
30
|
-
return native_update_checker.latest_version if UpdateChecker.native_analysis_enabled?
|
31
|
-
|
32
19
|
# No need to find latest version for transitive dependencies unless they have a vulnerability.
|
33
20
|
return dependency.version if !dependency.top_level? && !vulnerable?
|
34
21
|
|
35
22
|
# if no update sources have the requisite package, then we can only assume that the current version is correct
|
36
23
|
@latest_version = T.let(
|
37
|
-
|
24
|
+
update_analysis.dependency_analysis.updated_version,
|
38
25
|
T.nilable(String)
|
39
26
|
)
|
40
27
|
end
|
41
28
|
|
42
29
|
sig { override.returns(T.nilable(T.any(String, Gem::Version))) }
|
43
30
|
def latest_resolvable_version
|
44
|
-
return native_update_checker.latest_resolvable_version if UpdateChecker.native_analysis_enabled?
|
45
|
-
|
46
31
|
# We always want a full unlock since any package update could update peer dependencies as well.
|
47
32
|
# To force a full unlock instead of an own unlock, we return nil.
|
48
33
|
nil
|
@@ -50,232 +35,173 @@ module Dependabot
|
|
50
35
|
|
51
36
|
sig { override.returns(Dependabot::Nuget::Version) }
|
52
37
|
def lowest_security_fix_version
|
53
|
-
|
54
|
-
|
55
|
-
lowest_security_fix_version_details&.fetch(:version)
|
38
|
+
update_analysis.dependency_analysis.numeric_updated_version
|
56
39
|
end
|
57
40
|
|
58
41
|
sig { override.returns(T.nilable(Dependabot::Nuget::Version)) }
|
59
42
|
def lowest_resolvable_security_fix_version
|
60
43
|
return nil if version_comes_from_multi_dependency_property?
|
61
44
|
|
62
|
-
|
45
|
+
update_analysis.dependency_analysis.numeric_updated_version
|
63
46
|
end
|
64
47
|
|
65
48
|
sig { override.returns(NilClass) }
|
66
49
|
def latest_resolvable_version_with_no_unlock
|
67
|
-
return native_update_checker.latest_resolvable_version_with_no_unlock if UpdateChecker.native_analysis_enabled?
|
68
|
-
|
69
50
|
# Irrelevant, since Nuget has a single dependency file
|
70
51
|
nil
|
71
52
|
end
|
72
53
|
|
73
54
|
sig { override.returns(T::Array[T::Hash[Symbol, T.untyped]]) }
|
74
55
|
def updated_requirements
|
75
|
-
|
76
|
-
|
56
|
+
dep_details = updated_dependency_details.find { |d| d.name.casecmp?(dependency.name) }
|
77
57
|
RequirementsUpdater.new(
|
78
58
|
requirements: dependency.requirements,
|
79
|
-
|
80
|
-
source_details: preferred_resolvable_version_details&.slice(:nuspec_url, :repo_url, :source_url)
|
59
|
+
dependency_details: dep_details
|
81
60
|
).updated_requirements
|
82
61
|
end
|
83
62
|
|
84
63
|
sig { returns(T::Boolean) }
|
85
64
|
def up_to_date?
|
86
|
-
|
87
|
-
|
88
|
-
# No need to update transitive dependencies unless they have a vulnerability.
|
89
|
-
return true if !dependency.top_level? && !vulnerable?
|
90
|
-
|
91
|
-
# If any requirements have an uninterpolated property in them then
|
92
|
-
# that property couldn't be found, and we assume that the dependency
|
93
|
-
# is up-to-date
|
94
|
-
return true unless requirements_unlocked_or_can_be?
|
95
|
-
|
96
|
-
super
|
65
|
+
!update_analysis.dependency_analysis.can_update
|
97
66
|
end
|
98
67
|
|
99
68
|
sig { returns(T::Boolean) }
|
100
69
|
def requirements_unlocked_or_can_be?
|
101
|
-
|
102
|
-
# that property couldn't be found, and the requirement therefore
|
103
|
-
# cannot be unlocked (since we can't update that property)
|
104
|
-
dependency.requirements.none? do |req|
|
105
|
-
req.fetch(:requirement)&.match?(PROPERTY_REGEX)
|
106
|
-
end
|
70
|
+
update_analysis.dependency_analysis.can_update
|
107
71
|
end
|
108
72
|
|
109
73
|
private
|
110
74
|
|
111
|
-
sig { returns(
|
112
|
-
def
|
113
|
-
|
114
|
-
T.let(
|
115
|
-
Dependabot::Nuget::NativeUpdateChecker.new(
|
116
|
-
dependency: dependency,
|
117
|
-
dependency_files: dependency_files,
|
118
|
-
credentials: credentials,
|
119
|
-
repo_contents_path: repo_contents_path,
|
120
|
-
ignored_versions: ignored_versions,
|
121
|
-
raise_on_ignored: raise_on_ignored,
|
122
|
-
security_advisories: security_advisories,
|
123
|
-
requirements_update_strategy: requirements_update_strategy,
|
124
|
-
dependency_group: dependency_group,
|
125
|
-
options: options
|
126
|
-
),
|
127
|
-
T.nilable(Dependabot::Nuget::NativeUpdateChecker)
|
128
|
-
)
|
75
|
+
sig { returns(String) }
|
76
|
+
def job_file_path
|
77
|
+
ENV.fetch("DEPENDABOT_JOB_PATH")
|
129
78
|
end
|
130
79
|
|
131
|
-
sig { returns(
|
132
|
-
def
|
133
|
-
|
134
|
-
# lowest_resolvable_security_fix_version. Otherwise update all the way
|
135
|
-
# to the latest_resolvable_version.
|
136
|
-
return lowest_security_fix_version_details if vulnerable?
|
137
|
-
|
138
|
-
latest_version_details
|
80
|
+
sig { returns(AnalysisJsonReader) }
|
81
|
+
def update_analysis
|
82
|
+
@update_analysis ||= T.let(request_analysis, T.nilable(AnalysisJsonReader))
|
139
83
|
end
|
140
84
|
|
141
|
-
sig {
|
142
|
-
def
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
# We always want a full unlock since any package update could update peer dependencies as well.
|
148
|
-
return true unless version_comes_from_multi_dependency_property?
|
149
|
-
|
150
|
-
property_updater.update_possible?
|
85
|
+
sig { returns(String) }
|
86
|
+
def dependency_file_path
|
87
|
+
d = File.join(Dir.tmpdir, "dependency")
|
88
|
+
FileUtils.mkdir_p(d)
|
89
|
+
File.join(d, "#{dependency.name}.json")
|
151
90
|
end
|
152
91
|
|
153
|
-
sig {
|
154
|
-
def
|
155
|
-
|
156
|
-
|
92
|
+
sig { returns(T::Array[String]) }
|
93
|
+
def dependency_file_paths
|
94
|
+
dependency_files.map do |file|
|
95
|
+
DiscoveryJsonReader.dependency_file_path(
|
96
|
+
repo_contents_path: T.must(repo_contents_path),
|
97
|
+
dependency_file: file
|
98
|
+
)
|
157
99
|
end
|
100
|
+
end
|
158
101
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
updated_dependency = Dependency.new(
|
164
|
-
name: dependency.name,
|
165
|
-
version: latest_version,
|
166
|
-
requirements: updated_requirements,
|
167
|
-
previous_version: dependency.version,
|
168
|
-
previous_requirements: dependency.requirements,
|
169
|
-
package_manager: dependency.package_manager
|
102
|
+
sig { returns(AnalysisJsonReader) }
|
103
|
+
def request_analysis
|
104
|
+
discovery_file_path = DiscoveryJsonReader.get_discovery_json_path_for_dependency_file_paths(
|
105
|
+
dependency_file_paths
|
170
106
|
)
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
107
|
+
analysis_folder_path = AnalysisJsonReader.temp_directory
|
108
|
+
|
109
|
+
write_dependency_info
|
110
|
+
|
111
|
+
NativeHelpers.run_nuget_analyze_tool(job_path: job_file_path,
|
112
|
+
repo_root: T.must(repo_contents_path),
|
113
|
+
discovery_file_path: discovery_file_path,
|
114
|
+
dependency_file_path: dependency_file_path,
|
115
|
+
analysis_folder_path: analysis_folder_path,
|
116
|
+
credentials: credentials)
|
117
|
+
|
118
|
+
analysis_json = AnalysisJsonReader.analysis_json(dependency_name: dependency.name)
|
119
|
+
|
120
|
+
AnalysisJsonReader.new(analysis_json: T.must(analysis_json))
|
121
|
+
end
|
122
|
+
|
123
|
+
sig { void }
|
124
|
+
def write_dependency_info
|
125
|
+
dependency_info = {
|
126
|
+
Name: dependency.name,
|
127
|
+
Version: dependency.version.to_s,
|
128
|
+
IsVulnerable: vulnerable?,
|
129
|
+
IgnoredVersions: ignored_versions,
|
130
|
+
Vulnerabilities: security_advisories.map do |vulnerability|
|
131
|
+
{
|
132
|
+
DependencyName: vulnerability.dependency_name,
|
133
|
+
PackageManager: vulnerability.package_manager,
|
134
|
+
VulnerableVersions: vulnerability.vulnerable_versions.map(&:to_s),
|
135
|
+
SafeVersions: vulnerability.safe_versions.map(&:to_s)
|
136
|
+
}
|
137
|
+
end
|
138
|
+
}.to_json
|
139
|
+
dependency_directory = File.dirname(dependency_file_path)
|
181
140
|
|
182
|
-
|
183
|
-
|
184
|
-
|
141
|
+
begin
|
142
|
+
Dir.mkdir(dependency_directory)
|
143
|
+
rescue StandardError
|
144
|
+
nil?
|
145
|
+
end
|
185
146
|
|
186
|
-
|
147
|
+
Dependabot.logger.info("Writing dependency info: #{dependency_info}")
|
148
|
+
File.write(dependency_file_path, dependency_info)
|
187
149
|
end
|
188
150
|
|
189
|
-
sig { returns(
|
190
|
-
def
|
191
|
-
|
192
|
-
T.let(
|
193
|
-
version_finder.latest_version_details,
|
194
|
-
T.nilable(T::Hash[Symbol, T.untyped])
|
195
|
-
)
|
151
|
+
sig { returns(Dependabot::FileParsers::Base::DependencySet) }
|
152
|
+
def discovered_dependencies
|
153
|
+
DiscoveryJsonReader.load_discovery_for_dependency_file_paths(dependency_file_paths).dependency_set
|
196
154
|
end
|
197
155
|
|
198
|
-
sig { returns(T
|
199
|
-
def
|
200
|
-
|
201
|
-
|
202
|
-
version_finder.lowest_security_fix_version_details,
|
203
|
-
T.nilable(T::Hash[Symbol, T.untyped])
|
204
|
-
)
|
156
|
+
sig { override.returns(T::Boolean) }
|
157
|
+
def latest_version_resolvable_with_full_unlock?
|
158
|
+
# We always want a full unlock since any package update could update peer dependencies as well.
|
159
|
+
true
|
205
160
|
end
|
206
161
|
|
207
|
-
sig { returns(Dependabot::
|
208
|
-
def
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
162
|
+
sig { override.returns(T::Array[Dependabot::Dependency]) }
|
163
|
+
def updated_dependencies_after_full_unlock
|
164
|
+
dependencies = discovered_dependencies.dependencies
|
165
|
+
updated_dependency_details.filter_map do |dependency_details|
|
166
|
+
dep = dependencies.find { |d| d.name.casecmp(dependency_details.name)&.zero? }
|
167
|
+
next unless dep
|
168
|
+
|
169
|
+
metadata = {}
|
170
|
+
# For peer dependencies, instruct updater to not directly update this dependency
|
171
|
+
metadata = { information_only: true } unless dependency.name.casecmp(dependency_details.name)&.zero?
|
172
|
+
|
173
|
+
# rebuild the new requirements with the updated dependency details
|
174
|
+
updated_reqs = dep.requirements.map do |r|
|
175
|
+
r = r.clone
|
176
|
+
r[:requirement] = dependency_details.version
|
177
|
+
r[:source] = {
|
178
|
+
type: "nuget_repo",
|
179
|
+
source_url: dependency_details.info_url
|
180
|
+
}
|
181
|
+
r
|
182
|
+
end
|
223
183
|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
credentials: credentials,
|
233
|
-
ignored_versions: ignored_versions,
|
234
|
-
raise_on_ignored: @raise_on_ignored,
|
235
|
-
repo_contents_path: @repo_contents_path
|
236
|
-
),
|
237
|
-
T.nilable(Dependabot::Nuget::UpdateChecker::PropertyUpdater)
|
184
|
+
Dependency.new(
|
185
|
+
name: dep.name,
|
186
|
+
version: dependency_details.version,
|
187
|
+
requirements: updated_reqs,
|
188
|
+
previous_version: dep.version,
|
189
|
+
previous_requirements: dep.requirements,
|
190
|
+
package_manager: dep.package_manager,
|
191
|
+
metadata: metadata
|
238
192
|
)
|
239
|
-
end
|
240
|
-
|
241
|
-
sig { returns(T::Boolean) }
|
242
|
-
def version_comes_from_multi_dependency_property?
|
243
|
-
declarations_using_a_property.any? do |requirement|
|
244
|
-
property_name = requirement.fetch(:metadata).fetch(:property_name)
|
245
|
-
|
246
|
-
all_property_based_dependencies.any? do |dep|
|
247
|
-
next false if dep.name == dependency.name
|
248
|
-
|
249
|
-
dep.requirements.any? do |req|
|
250
|
-
req.dig(:metadata, :property_name) == property_name
|
251
|
-
end
|
252
|
-
end
|
253
193
|
end
|
254
194
|
end
|
255
195
|
|
256
|
-
sig { returns(T::Array[
|
257
|
-
def
|
258
|
-
@
|
259
|
-
|
260
|
-
dependency.requirements
|
261
|
-
.select { |req| req.dig(:metadata, :property_name) },
|
262
|
-
T.nilable(T::Array[T::Hash[Symbol, T.untyped]])
|
263
|
-
)
|
196
|
+
sig { returns(T::Array[Dependabot::Nuget::DependencyDetails]) }
|
197
|
+
def updated_dependency_details
|
198
|
+
@updated_dependency_details ||= T.let(update_analysis.dependency_analysis.updated_dependencies,
|
199
|
+
T.nilable(T::Array[Dependabot::Nuget::DependencyDetails]))
|
264
200
|
end
|
265
201
|
|
266
|
-
sig { returns(T::
|
267
|
-
def
|
268
|
-
|
269
|
-
T.let(
|
270
|
-
Nuget::FileParser.new(
|
271
|
-
dependency_files: dependency_files,
|
272
|
-
repo_contents_path: repo_contents_path,
|
273
|
-
source: nil
|
274
|
-
).parse.select do |dep|
|
275
|
-
dep.requirements.any? { |req| req.dig(:metadata, :property_name) }
|
276
|
-
end,
|
277
|
-
T.nilable(T::Array[Dependabot::Dependency])
|
278
|
-
)
|
202
|
+
sig { returns(T::Boolean) }
|
203
|
+
def version_comes_from_multi_dependency_property?
|
204
|
+
update_analysis.dependency_analysis.version_comes_from_multi_dependency_property
|
279
205
|
end
|
280
206
|
end
|
281
207
|
end
|
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.291.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-19 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.291.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.291.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubyzip
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -331,6 +331,7 @@ files:
|
|
331
331
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/SupportedFrameworkFacts.cs
|
332
332
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs
|
333
333
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/NuGetUpdater.Core.Test.csproj
|
334
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/MiscellaneousTests.cs
|
334
335
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs
|
335
336
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs
|
336
337
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/TestApiHandler.cs
|
@@ -370,6 +371,7 @@ files:
|
|
370
371
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/NuGetContext.cs
|
371
372
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/Requirement.cs
|
372
373
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/RequirementArrayConverter.cs
|
374
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/RequirementConverter.cs
|
373
375
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/SecurityVulnerability.cs
|
374
376
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/SecurityVulnerabilityExtensions.cs
|
375
377
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/VersionFinder.cs
|
@@ -413,10 +415,15 @@ files:
|
|
413
415
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/NativeResult.cs
|
414
416
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/NuGetUpdater.Core.csproj
|
415
417
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Property.cs
|
418
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Advisory.cs
|
416
419
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/AllowedUpdate.cs
|
420
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/CommitOptions.cs
|
421
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Condition.cs
|
417
422
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/CreatePullRequest.cs
|
418
423
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyFile.cs
|
419
424
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyFileNotFound.cs
|
425
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyGroup.cs
|
426
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/GroupPullRequest.cs
|
420
427
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/IncrementMetric.cs
|
421
428
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Job.cs
|
422
429
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobErrorBase.cs
|
@@ -425,9 +432,11 @@ files:
|
|
425
432
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobSource.cs
|
426
433
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/MarkAsProcessed.cs
|
427
434
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/PrivateSourceAuthenticationFailure.cs
|
435
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/PullRequest.cs
|
428
436
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/ReportedDependency.cs
|
429
437
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/ReportedRequirement.cs
|
430
438
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/RequirementSource.cs
|
439
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/RequirementsUpdateStrategy.cs
|
431
440
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/UnknownError.cs
|
432
441
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/UpdateNotPossible.cs
|
433
442
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/UpdatedDependencyList.cs
|
@@ -435,6 +444,7 @@ files:
|
|
435
444
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/IApiHandler.cs
|
436
445
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunResult.cs
|
437
446
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs
|
447
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/VersionConverter.cs
|
438
448
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/TargetFrameworkReporter.targets
|
439
449
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/UpdateNotPossibleException.cs
|
440
450
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs
|
@@ -473,7 +483,6 @@ files:
|
|
473
483
|
- lib/dependabot/nuget/cache_manager.rb
|
474
484
|
- lib/dependabot/nuget/discovery/dependency_details.rb
|
475
485
|
- lib/dependabot/nuget/discovery/dependency_file_discovery.rb
|
476
|
-
- lib/dependabot/nuget/discovery/directory_packages_props_discovery.rb
|
477
486
|
- lib/dependabot/nuget/discovery/discovery_json_reader.rb
|
478
487
|
- lib/dependabot/nuget/discovery/evaluation_details.rb
|
479
488
|
- lib/dependabot/nuget/discovery/project_discovery.rb
|
@@ -482,40 +491,22 @@ files:
|
|
482
491
|
- lib/dependabot/nuget/file_fetcher.rb
|
483
492
|
- lib/dependabot/nuget/file_parser.rb
|
484
493
|
- lib/dependabot/nuget/file_updater.rb
|
485
|
-
- lib/dependabot/nuget/
|
494
|
+
- lib/dependabot/nuget/language.rb
|
486
495
|
- lib/dependabot/nuget/metadata_finder.rb
|
487
|
-
- lib/dependabot/nuget/native_discovery/native_dependency_details.rb
|
488
|
-
- lib/dependabot/nuget/native_discovery/native_dependency_file_discovery.rb
|
489
|
-
- lib/dependabot/nuget/native_discovery/native_discovery_json_reader.rb
|
490
|
-
- lib/dependabot/nuget/native_discovery/native_evaluation_details.rb
|
491
|
-
- lib/dependabot/nuget/native_discovery/native_project_discovery.rb
|
492
|
-
- lib/dependabot/nuget/native_discovery/native_property_details.rb
|
493
|
-
- lib/dependabot/nuget/native_discovery/native_workspace_discovery.rb
|
494
496
|
- lib/dependabot/nuget/native_helpers.rb
|
495
|
-
- lib/dependabot/nuget/native_update_checker/native_requirements_updater.rb
|
496
|
-
- lib/dependabot/nuget/native_update_checker/native_update_checker.rb
|
497
|
-
- lib/dependabot/nuget/nuget_client.rb
|
498
497
|
- lib/dependabot/nuget/nuget_config_credential_helpers.rb
|
498
|
+
- lib/dependabot/nuget/package_manager.rb
|
499
499
|
- lib/dependabot/nuget/requirement.rb
|
500
500
|
- lib/dependabot/nuget/update_checker.rb
|
501
|
-
- lib/dependabot/nuget/update_checker/compatibility_checker.rb
|
502
|
-
- lib/dependabot/nuget/update_checker/dependency_finder.rb
|
503
|
-
- lib/dependabot/nuget/update_checker/nupkg_fetcher.rb
|
504
|
-
- lib/dependabot/nuget/update_checker/nuspec_fetcher.rb
|
505
|
-
- lib/dependabot/nuget/update_checker/property_updater.rb
|
506
|
-
- lib/dependabot/nuget/update_checker/repository_finder.rb
|
507
501
|
- lib/dependabot/nuget/update_checker/requirements_updater.rb
|
508
|
-
- lib/dependabot/nuget/update_checker/tfm_comparer.rb
|
509
|
-
- lib/dependabot/nuget/update_checker/tfm_finder.rb
|
510
|
-
- lib/dependabot/nuget/update_checker/version_finder.rb
|
511
502
|
- lib/dependabot/nuget/version.rb
|
512
503
|
homepage: https://github.com/dependabot/dependabot-core
|
513
504
|
licenses:
|
514
505
|
- MIT
|
515
506
|
metadata:
|
516
507
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
517
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
518
|
-
post_install_message:
|
508
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.291.0
|
509
|
+
post_install_message:
|
519
510
|
rdoc_options: []
|
520
511
|
require_paths:
|
521
512
|
- lib
|
@@ -531,7 +522,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
531
522
|
version: 3.1.0
|
532
523
|
requirements: []
|
533
524
|
rubygems_version: 3.5.9
|
534
|
-
signing_key:
|
525
|
+
signing_key:
|
535
526
|
specification_version: 4
|
536
527
|
summary: Provides Dependabot support for .NET (NuGet)
|
537
528
|
test_files: []
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# typed: strong
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "dependabot/nuget/discovery/dependency_details"
|
5
|
-
require "sorbet-runtime"
|
6
|
-
|
7
|
-
module Dependabot
|
8
|
-
module Nuget
|
9
|
-
class DirectoryPackagesPropsDiscovery < DependencyFileDiscovery
|
10
|
-
extend T::Sig
|
11
|
-
|
12
|
-
sig do
|
13
|
-
params(json: T.nilable(T::Hash[String, T.untyped])).returns(T.nilable(DirectoryPackagesPropsDiscovery))
|
14
|
-
end
|
15
|
-
def self.from_json(json)
|
16
|
-
return nil if json.nil?
|
17
|
-
|
18
|
-
file_path = T.let(json.fetch("FilePath"), String)
|
19
|
-
is_transitive_pinning_enabled = T.let(json.fetch("IsTransitivePinningEnabled"), T::Boolean)
|
20
|
-
dependencies = T.let(json.fetch("Dependencies"), T::Array[T::Hash[String, T.untyped]]).map do |dep|
|
21
|
-
DependencyDetails.from_json(dep)
|
22
|
-
end
|
23
|
-
|
24
|
-
DirectoryPackagesPropsDiscovery.new(file_path: file_path,
|
25
|
-
is_transitive_pinning_enabled: is_transitive_pinning_enabled,
|
26
|
-
dependencies: dependencies)
|
27
|
-
end
|
28
|
-
|
29
|
-
sig do
|
30
|
-
params(file_path: String,
|
31
|
-
is_transitive_pinning_enabled: T::Boolean,
|
32
|
-
dependencies: T::Array[DependencyDetails]).void
|
33
|
-
end
|
34
|
-
def initialize(file_path:, is_transitive_pinning_enabled:, dependencies:)
|
35
|
-
super(file_path: file_path, dependencies: dependencies)
|
36
|
-
@is_transitive_pinning_enabled = is_transitive_pinning_enabled
|
37
|
-
end
|
38
|
-
|
39
|
-
sig { returns(T::Boolean) }
|
40
|
-
attr_reader :is_transitive_pinning_enabled
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# typed: strict
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "sorbet-runtime"
|
5
|
-
|
6
|
-
module Dependabot
|
7
|
-
module Nuget
|
8
|
-
module HttpResponseHelpers
|
9
|
-
extend T::Sig
|
10
|
-
|
11
|
-
sig { params(string: String).returns(String) }
|
12
|
-
def self.remove_wrapping_zero_width_chars(string)
|
13
|
-
string.force_encoding("UTF-8").encode
|
14
|
-
.gsub(/\A[\u200B-\u200D\uFEFF]/, "")
|
15
|
-
.gsub(/[\u200B-\u200D\uFEFF]\Z/, "")
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|