dependabot-nuget 0.262.0 → 0.264.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/NuGetUpdater.Cli/Commands/AnalyzeCommand.cs +37 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs +3 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Program.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Analyze.cs +169 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs +79 -67
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.FrameworkCheck.cs +0 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +10 -11
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalysisResult.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs +441 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/CompatabilityChecker.cs +177 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/DependencyFinder.cs +47 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/DependencyInfo.cs +12 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/Extensions.cs +36 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/NuGetContext.cs +128 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/Requirement.cs +105 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/RequirementConverter.cs +17 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/SecurityVulnerability.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/SecurityVulnerabilityExtensions.cs +36 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/VersionFinder.cs +179 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/VersionResult.cs +54 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Dependency.cs +5 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +2 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/WorkspaceDiscoveryResult.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/CompatabilityChecker.cs +0 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/FrameworkCompatibilityService.cs +0 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/FrameworkChecker/SupportedFrameworks.cs +0 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs +0 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectResolver.cs +0 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs +6 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/WebApplicationTargetsConditionPatcher.cs +0 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/XmlFilePreAndPostProcessor.cs +0 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/HashSetExtensions.cs +0 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/JsonHelper.cs +0 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/Logger.cs +0 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +7 -8
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +0 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ProcessExtensions.cs +0 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/XmlExtensions.cs +0 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTestBase.cs +90 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTests.cs +304 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/CompatibilityCheckerTests.cs +145 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/ExpectedAnalysisResult.cs +8 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/RequirementTests.cs +69 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/SecurityVulnerabilityExtensionsTests.cs +78 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/VersionFinderTests.cs +193 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs +1 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.DotNetToolsJson.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.PackagesConfig.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Proj.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.Project.cs +102 -9
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +4 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/ExpectedDiscoveryResults.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs +8 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +2 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +8 -7
- data/lib/dependabot/nuget/analysis/analysis_json_reader.rb +63 -0
- data/lib/dependabot/nuget/analysis/dependency_analysis.rb +63 -0
- data/lib/dependabot/nuget/file_fetcher.rb +7 -6
- data/lib/dependabot/nuget/file_parser.rb +28 -21
- data/lib/dependabot/nuget/file_updater.rb +22 -25
- data/lib/dependabot/nuget/metadata_finder.rb +2 -160
- data/lib/dependabot/nuget/native_discovery/native_dependency_details.rb +102 -0
- data/lib/dependabot/nuget/native_discovery/native_dependency_file_discovery.rb +129 -0
- data/lib/dependabot/nuget/native_discovery/native_directory_packages_props_discovery.rb +44 -0
- data/lib/dependabot/nuget/native_discovery/native_discovery_json_reader.rb +174 -0
- data/lib/dependabot/nuget/native_discovery/native_evaluation_details.rb +63 -0
- data/lib/dependabot/nuget/native_discovery/native_project_discovery.rb +82 -0
- data/lib/dependabot/nuget/native_discovery/native_property_details.rb +43 -0
- data/lib/dependabot/nuget/native_discovery/native_workspace_discovery.rb +68 -0
- data/lib/dependabot/nuget/native_helpers.rb +59 -0
- data/lib/dependabot/nuget/native_update_checker/native_requirements_updater.rb +105 -0
- data/lib/dependabot/nuget/native_update_checker/native_update_checker.rb +200 -0
- data/lib/dependabot/nuget/nuget_config_credential_helpers.rb +3 -2
- data/lib/dependabot/nuget/update_checker.rb +48 -1
- metadata +39 -5
@@ -0,0 +1,105 @@
|
|
1
|
+
# typed: strict
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#######################################################################
|
5
|
+
# For more details on Dotnet version constraints, see: #
|
6
|
+
# https://docs.microsoft.com/en-us/nuget/reference/package-versioning #
|
7
|
+
#######################################################################
|
8
|
+
|
9
|
+
require "sorbet-runtime"
|
10
|
+
|
11
|
+
require "dependabot/update_checkers/base"
|
12
|
+
require "dependabot/nuget/native_discovery/native_dependency_details"
|
13
|
+
require "dependabot/nuget/version"
|
14
|
+
|
15
|
+
module Dependabot
|
16
|
+
module Nuget
|
17
|
+
class NativeUpdateChecker < Dependabot::UpdateCheckers::Base
|
18
|
+
class NativeRequirementsUpdater
|
19
|
+
extend T::Sig
|
20
|
+
|
21
|
+
sig do
|
22
|
+
params(
|
23
|
+
requirements: T::Array[T::Hash[Symbol, T.untyped]],
|
24
|
+
dependency_details: T.nilable(Dependabot::Nuget::NativeDependencyDetails)
|
25
|
+
)
|
26
|
+
.void
|
27
|
+
end
|
28
|
+
def initialize(requirements:, dependency_details:)
|
29
|
+
@requirements = requirements
|
30
|
+
@dependency_details = dependency_details
|
31
|
+
end
|
32
|
+
|
33
|
+
sig { returns(T::Array[T::Hash[Symbol, T.untyped]]) }
|
34
|
+
def updated_requirements
|
35
|
+
return requirements unless clean_version
|
36
|
+
|
37
|
+
# NOTE: Order is important here. The FileUpdater needs the updated
|
38
|
+
# requirement at index `i` to correspond to the previous requirement
|
39
|
+
# at the same index.
|
40
|
+
requirements.map do |req|
|
41
|
+
next req if req.fetch(:requirement).nil?
|
42
|
+
next req if req.fetch(:requirement).include?(",")
|
43
|
+
|
44
|
+
new_req =
|
45
|
+
if req.fetch(:requirement).include?("*")
|
46
|
+
update_wildcard_requirement(req.fetch(:requirement))
|
47
|
+
else
|
48
|
+
# Since range requirements are excluded by the line above we can
|
49
|
+
# replace anything that looks like a version with the new
|
50
|
+
# version
|
51
|
+
req[:requirement].sub(
|
52
|
+
/#{Nuget::Version::VERSION_PATTERN}/o,
|
53
|
+
clean_version.to_s
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
next req if new_req == req.fetch(:requirement)
|
58
|
+
|
59
|
+
new_source = req[:source]&.dup
|
60
|
+
unless @dependency_details.nil?
|
61
|
+
new_source = {
|
62
|
+
type: "nuget_repo",
|
63
|
+
source_url: @dependency_details.info_url
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
req.merge({ requirement: new_req, source: new_source })
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
sig { returns(T::Array[T::Hash[Symbol, T.untyped]]) }
|
74
|
+
attr_reader :requirements
|
75
|
+
|
76
|
+
sig { returns(T.class_of(Dependabot::Nuget::Version)) }
|
77
|
+
def version_class
|
78
|
+
Dependabot::Nuget::Version
|
79
|
+
end
|
80
|
+
|
81
|
+
sig { returns(T.nilable(Dependabot::Nuget::Version)) }
|
82
|
+
def clean_version
|
83
|
+
return unless @dependency_details&.version
|
84
|
+
|
85
|
+
version_class.new(@dependency_details.version)
|
86
|
+
end
|
87
|
+
|
88
|
+
sig { params(req_string: String).returns(String) }
|
89
|
+
def update_wildcard_requirement(req_string)
|
90
|
+
return req_string if req_string == "*-*"
|
91
|
+
|
92
|
+
return req_string if req_string == "*"
|
93
|
+
|
94
|
+
precision = T.must(req_string.split("*").first).split(/\.|\-/).count
|
95
|
+
wildcard_section = req_string.partition(/(?=[.\-]\*)/).last
|
96
|
+
|
97
|
+
version_parts = T.must(clean_version).segments.first(precision)
|
98
|
+
version = version_parts.join(".")
|
99
|
+
|
100
|
+
version + wildcard_section
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,200 @@
|
|
1
|
+
# typed: strong
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "dependabot/nuget/analysis/analysis_json_reader"
|
5
|
+
require "dependabot/nuget/native_discovery/native_discovery_json_reader"
|
6
|
+
require "dependabot/update_checkers"
|
7
|
+
require "dependabot/update_checkers/base"
|
8
|
+
require "sorbet-runtime"
|
9
|
+
|
10
|
+
module Dependabot
|
11
|
+
module Nuget
|
12
|
+
class NativeUpdateChecker < Dependabot::UpdateCheckers::Base
|
13
|
+
extend T::Sig
|
14
|
+
|
15
|
+
require_relative "native_requirements_updater"
|
16
|
+
|
17
|
+
sig { override.returns(T.nilable(String)) }
|
18
|
+
def latest_version
|
19
|
+
# No need to find latest version for transitive dependencies unless they have a vulnerability.
|
20
|
+
return dependency.version if !dependency.top_level? && !vulnerable?
|
21
|
+
|
22
|
+
# if no update sources have the requisite package, then we can only assume that the current version is correct
|
23
|
+
@latest_version = T.let(
|
24
|
+
update_analysis.dependency_analysis.updated_version,
|
25
|
+
T.nilable(String)
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
sig { override.returns(T.nilable(T.any(String, Gem::Version))) }
|
30
|
+
def latest_resolvable_version
|
31
|
+
# We always want a full unlock since any package update could update peer dependencies as well.
|
32
|
+
# To force a full unlock instead of an own unlock, we return nil.
|
33
|
+
nil
|
34
|
+
end
|
35
|
+
|
36
|
+
sig { override.returns(Dependabot::Nuget::Version) }
|
37
|
+
def lowest_security_fix_version
|
38
|
+
update_analysis.dependency_analysis.numeric_updated_version
|
39
|
+
end
|
40
|
+
|
41
|
+
sig { override.returns(T.nilable(Dependabot::Nuget::Version)) }
|
42
|
+
def lowest_resolvable_security_fix_version
|
43
|
+
return nil if version_comes_from_multi_dependency_property?
|
44
|
+
|
45
|
+
update_analysis.dependency_analysis.numeric_updated_version
|
46
|
+
end
|
47
|
+
|
48
|
+
sig { override.returns(NilClass) }
|
49
|
+
def latest_resolvable_version_with_no_unlock
|
50
|
+
# Irrelevant, since Nuget has a single dependency file
|
51
|
+
nil
|
52
|
+
end
|
53
|
+
|
54
|
+
sig { override.returns(T::Array[T::Hash[Symbol, T.untyped]]) }
|
55
|
+
def updated_requirements
|
56
|
+
dep_details = updated_dependency_details.find { |d| d.name.casecmp?(dependency.name) }
|
57
|
+
NativeRequirementsUpdater.new(
|
58
|
+
requirements: dependency.requirements,
|
59
|
+
dependency_details: dep_details
|
60
|
+
).updated_requirements
|
61
|
+
end
|
62
|
+
|
63
|
+
sig { returns(T::Boolean) }
|
64
|
+
def up_to_date?
|
65
|
+
!update_analysis.dependency_analysis.can_update
|
66
|
+
end
|
67
|
+
|
68
|
+
sig { returns(T::Boolean) }
|
69
|
+
def requirements_unlocked_or_can_be?
|
70
|
+
update_analysis.dependency_analysis.can_update
|
71
|
+
end
|
72
|
+
|
73
|
+
sig { returns(T::Boolean) }
|
74
|
+
def public_latest_version_resolvable_with_full_unlock?
|
75
|
+
latest_version_resolvable_with_full_unlock?
|
76
|
+
end
|
77
|
+
|
78
|
+
sig { returns(T::Array[Dependabot::Dependency]) }
|
79
|
+
def public_updated_dependencies_after_full_unlock
|
80
|
+
updated_dependencies_after_full_unlock
|
81
|
+
end
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
sig { returns(AnalysisJsonReader) }
|
86
|
+
def update_analysis
|
87
|
+
@update_analysis ||= T.let(request_analysis, T.nilable(AnalysisJsonReader))
|
88
|
+
end
|
89
|
+
|
90
|
+
sig { returns(String) }
|
91
|
+
def dependency_file_path
|
92
|
+
File.join(NativeDiscoveryJsonReader.temp_directory, "dependency", "#{dependency.name}.json")
|
93
|
+
end
|
94
|
+
|
95
|
+
sig { returns(AnalysisJsonReader) }
|
96
|
+
def request_analysis
|
97
|
+
discovery_file_path = NativeDiscoveryJsonReader.get_discovery_file_path_from_dependency_files(dependency_files)
|
98
|
+
analysis_folder_path = AnalysisJsonReader.temp_directory
|
99
|
+
|
100
|
+
write_dependency_info
|
101
|
+
|
102
|
+
NativeHelpers.run_nuget_analyze_tool(repo_root: T.must(repo_contents_path),
|
103
|
+
discovery_file_path: discovery_file_path,
|
104
|
+
dependency_file_path: dependency_file_path,
|
105
|
+
analysis_folder_path: analysis_folder_path,
|
106
|
+
credentials: credentials)
|
107
|
+
|
108
|
+
analysis_json = AnalysisJsonReader.analysis_json(dependency_name: dependency.name)
|
109
|
+
|
110
|
+
AnalysisJsonReader.new(analysis_json: T.must(analysis_json))
|
111
|
+
end
|
112
|
+
|
113
|
+
sig { void }
|
114
|
+
def write_dependency_info
|
115
|
+
dependency_info = {
|
116
|
+
Name: dependency.name,
|
117
|
+
Version: dependency.version.to_s,
|
118
|
+
IsVulnerable: vulnerable?,
|
119
|
+
IgnoredVersions: ignored_versions,
|
120
|
+
Vulnerabilities: security_advisories.map do |vulnerability|
|
121
|
+
{
|
122
|
+
DependencyName: vulnerability.dependency_name,
|
123
|
+
PackageManager: vulnerability.package_manager,
|
124
|
+
VulnerableVersions: vulnerability.vulnerable_versions.map(&:to_s),
|
125
|
+
SafeVersions: vulnerability.safe_versions.map(&:to_s)
|
126
|
+
}
|
127
|
+
end
|
128
|
+
}.to_json
|
129
|
+
dependency_directory = File.dirname(dependency_file_path)
|
130
|
+
|
131
|
+
begin
|
132
|
+
Dir.mkdir(dependency_directory)
|
133
|
+
rescue StandardError
|
134
|
+
nil?
|
135
|
+
end
|
136
|
+
|
137
|
+
File.write(dependency_file_path, dependency_info)
|
138
|
+
end
|
139
|
+
|
140
|
+
sig { returns(Dependabot::FileParsers::Base::DependencySet) }
|
141
|
+
def discovered_dependencies
|
142
|
+
discovery_json_reader = NativeDiscoveryJsonReader.get_discovery_from_dependency_files(dependency_files)
|
143
|
+
discovery_json_reader.dependency_set
|
144
|
+
end
|
145
|
+
|
146
|
+
sig { override.returns(T::Boolean) }
|
147
|
+
def latest_version_resolvable_with_full_unlock?
|
148
|
+
# We always want a full unlock since any package update could update peer dependencies as well.
|
149
|
+
true
|
150
|
+
end
|
151
|
+
|
152
|
+
sig { override.returns(T::Array[Dependabot::Dependency]) }
|
153
|
+
def updated_dependencies_after_full_unlock
|
154
|
+
dependencies = discovered_dependencies.dependencies
|
155
|
+
updated_dependency_details.filter_map do |dependency_details|
|
156
|
+
dep = dependencies.find { |d| d.name.casecmp(dependency_details.name)&.zero? }
|
157
|
+
next unless dep
|
158
|
+
|
159
|
+
metadata = {}
|
160
|
+
# For peer dependencies, instruct updater to not directly update this dependency
|
161
|
+
metadata = { information_only: true } unless dependency.name.casecmp(dependency_details.name)&.zero?
|
162
|
+
|
163
|
+
# rebuild the new requirements with the updated dependency details
|
164
|
+
updated_reqs = dep.requirements.map do |r|
|
165
|
+
r = r.clone
|
166
|
+
r[:requirement] = dependency_details.version
|
167
|
+
r[:source] = {
|
168
|
+
type: "nuget_repo",
|
169
|
+
source_url: dependency_details.info_url
|
170
|
+
}
|
171
|
+
r
|
172
|
+
end
|
173
|
+
|
174
|
+
Dependency.new(
|
175
|
+
name: dep.name,
|
176
|
+
version: dependency_details.version,
|
177
|
+
requirements: updated_reqs,
|
178
|
+
previous_version: dep.version,
|
179
|
+
previous_requirements: dep.requirements,
|
180
|
+
package_manager: dep.package_manager,
|
181
|
+
metadata: metadata
|
182
|
+
)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
sig { returns(T::Array[Dependabot::Nuget::NativeDependencyDetails]) }
|
187
|
+
def updated_dependency_details
|
188
|
+
@updated_dependency_details ||= T.let(update_analysis.dependency_analysis.updated_dependencies,
|
189
|
+
T.nilable(T::Array[Dependabot::Nuget::NativeDependencyDetails]))
|
190
|
+
end
|
191
|
+
|
192
|
+
sig { returns(T::Boolean) }
|
193
|
+
def version_comes_from_multi_dependency_property?
|
194
|
+
update_analysis.dependency_analysis.version_comes_from_multi_dependency_property
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
Dependabot::UpdateCheckers.register("nuget", Dependabot::Nuget::UpdateChecker)
|
@@ -69,12 +69,13 @@ module Dependabot
|
|
69
69
|
begin
|
70
70
|
yield
|
71
71
|
rescue StandardError => e
|
72
|
-
|
72
|
+
log_message =
|
73
73
|
<<~LOG_MESSAGE
|
74
74
|
Block argument of NuGetConfigCredentialHelpers::patch_nuget_config_for_action causes an exception #{e}:
|
75
75
|
#{e.message}
|
76
76
|
LOG_MESSAGE
|
77
|
-
)
|
77
|
+
Dependabot.logger.error(log_message)
|
78
|
+
puts log_message
|
78
79
|
ensure
|
79
80
|
restore_user_nuget_config
|
80
81
|
end
|
@@ -16,10 +16,19 @@ module Dependabot
|
|
16
16
|
require_relative "update_checker/requirements_updater"
|
17
17
|
require_relative "update_checker/dependency_finder"
|
18
18
|
|
19
|
+
require_relative "native_update_checker/native_update_checker"
|
20
|
+
|
19
21
|
PROPERTY_REGEX = /\$\((?<property>.*?)\)/
|
20
22
|
|
23
|
+
sig { returns(T::Boolean) }
|
24
|
+
def self.native_analysis_enabled?
|
25
|
+
Dependabot::Experiments.enabled?(:nuget_native_analysis)
|
26
|
+
end
|
27
|
+
|
21
28
|
sig { override.returns(T.nilable(String)) }
|
22
29
|
def latest_version
|
30
|
+
return native_update_checker.latest_version if UpdateChecker.native_analysis_enabled?
|
31
|
+
|
23
32
|
# No need to find latest version for transitive dependencies unless they have a vulnerability.
|
24
33
|
return dependency.version if !dependency.top_level? && !vulnerable?
|
25
34
|
|
@@ -32,6 +41,8 @@ module Dependabot
|
|
32
41
|
|
33
42
|
sig { override.returns(T.nilable(T.any(String, Gem::Version))) }
|
34
43
|
def latest_resolvable_version
|
44
|
+
return native_update_checker.latest_resolvable_version if UpdateChecker.native_analysis_enabled?
|
45
|
+
|
35
46
|
# We always want a full unlock since any package update could update peer dependencies as well.
|
36
47
|
# To force a full unlock instead of an own unlock, we return nil.
|
37
48
|
nil
|
@@ -39,10 +50,12 @@ module Dependabot
|
|
39
50
|
|
40
51
|
sig { override.returns(Dependabot::Nuget::Version) }
|
41
52
|
def lowest_security_fix_version
|
53
|
+
return native_update_checker.lowest_security_fix_version if UpdateChecker.native_analysis_enabled?
|
54
|
+
|
42
55
|
lowest_security_fix_version_details&.fetch(:version)
|
43
56
|
end
|
44
57
|
|
45
|
-
sig { override.returns(T.nilable(Dependabot::Version)) }
|
58
|
+
sig { override.returns(T.nilable(Dependabot::Nuget::Version)) }
|
46
59
|
def lowest_resolvable_security_fix_version
|
47
60
|
return nil if version_comes_from_multi_dependency_property?
|
48
61
|
|
@@ -51,12 +64,16 @@ module Dependabot
|
|
51
64
|
|
52
65
|
sig { override.returns(NilClass) }
|
53
66
|
def latest_resolvable_version_with_no_unlock
|
67
|
+
return native_update_checker.latest_resolvable_version_with_no_unlock if UpdateChecker.native_analysis_enabled?
|
68
|
+
|
54
69
|
# Irrelevant, since Nuget has a single dependency file
|
55
70
|
nil
|
56
71
|
end
|
57
72
|
|
58
73
|
sig { override.returns(T::Array[T::Hash[Symbol, T.untyped]]) }
|
59
74
|
def updated_requirements
|
75
|
+
return native_update_checker.updated_requirements if UpdateChecker.native_analysis_enabled?
|
76
|
+
|
60
77
|
RequirementsUpdater.new(
|
61
78
|
requirements: dependency.requirements,
|
62
79
|
latest_version: preferred_resolvable_version_details&.fetch(:version, nil)&.to_s,
|
@@ -66,6 +83,8 @@ module Dependabot
|
|
66
83
|
|
67
84
|
sig { returns(T::Boolean) }
|
68
85
|
def up_to_date?
|
86
|
+
return native_update_checker.up_to_date? if UpdateChecker.native_analysis_enabled?
|
87
|
+
|
69
88
|
# No need to update transitive dependencies unless they have a vulnerability.
|
70
89
|
return true if !dependency.top_level? && !vulnerable?
|
71
90
|
|
@@ -89,6 +108,26 @@ module Dependabot
|
|
89
108
|
|
90
109
|
private
|
91
110
|
|
111
|
+
sig { returns(Dependabot::Nuget::NativeUpdateChecker) }
|
112
|
+
def native_update_checker
|
113
|
+
@native_update_checker ||=
|
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
|
+
)
|
129
|
+
end
|
130
|
+
|
92
131
|
sig { returns(T.nilable(T::Hash[Symbol, T.untyped])) }
|
93
132
|
def preferred_resolvable_version_details
|
94
133
|
# If this dependency is vulnerable, prefer trying to update to the
|
@@ -101,6 +140,10 @@ module Dependabot
|
|
101
140
|
|
102
141
|
sig { override.returns(T::Boolean) }
|
103
142
|
def latest_version_resolvable_with_full_unlock?
|
143
|
+
if UpdateChecker.native_analysis_enabled?
|
144
|
+
return native_update_checker.public_latest_version_resolvable_with_full_unlock?
|
145
|
+
end
|
146
|
+
|
104
147
|
# We always want a full unlock since any package update could update peer dependencies as well.
|
105
148
|
return true unless version_comes_from_multi_dependency_property?
|
106
149
|
|
@@ -109,6 +152,10 @@ module Dependabot
|
|
109
152
|
|
110
153
|
sig { override.returns(T::Array[Dependabot::Dependency]) }
|
111
154
|
def updated_dependencies_after_full_unlock
|
155
|
+
if UpdateChecker.native_analysis_enabled?
|
156
|
+
return native_update_checker.public_updated_dependencies_after_full_unlock
|
157
|
+
end
|
158
|
+
|
112
159
|
return property_updater.updated_dependencies if version_comes_from_multi_dependency_property?
|
113
160
|
|
114
161
|
puts "Finding updated dependencies for #{dependency.name}."
|
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.264.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-05 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.264.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.264.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubyzip
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -290,15 +290,24 @@ files:
|
|
290
290
|
- helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Resolver/NuGet.Resolver.csproj
|
291
291
|
- helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Versioning/NuGet.Versioning.csproj
|
292
292
|
- helpers/lib/NuGetUpdater/NuGetProjects/README.md
|
293
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Analyze.cs
|
293
294
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs
|
294
295
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.FrameworkCheck.cs
|
295
296
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs
|
296
297
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/NuGetUpdater.Cli.Test.csproj
|
298
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/AnalyzeCommand.cs
|
297
299
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs
|
298
300
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/FrameworkCheckCommand.cs
|
299
301
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/UpdateCommand.cs
|
300
302
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/NuGetUpdater.Cli.csproj
|
301
303
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Program.cs
|
304
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTestBase.cs
|
305
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTests.cs
|
306
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/CompatibilityCheckerTests.cs
|
307
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/ExpectedAnalysisResult.cs
|
308
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/RequirementTests.cs
|
309
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/SecurityVulnerabilityExtensionsTests.cs
|
310
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/VersionFinderTests.cs
|
302
311
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTestBase.cs
|
303
312
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.DotNetToolsJson.cs
|
304
313
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.GlobalJson.cs
|
@@ -332,6 +341,19 @@ files:
|
|
332
341
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/JsonHelperTests.cs
|
333
342
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs
|
334
343
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/SdkPackageUpdaterHelperTests.cs
|
344
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalysisResult.cs
|
345
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs
|
346
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/CompatabilityChecker.cs
|
347
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/DependencyFinder.cs
|
348
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/DependencyInfo.cs
|
349
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/Extensions.cs
|
350
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/NuGetContext.cs
|
351
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/Requirement.cs
|
352
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/RequirementConverter.cs
|
353
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/SecurityVulnerability.cs
|
354
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/SecurityVulnerabilityExtensions.cs
|
355
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/VersionFinder.cs
|
356
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/VersionResult.cs
|
335
357
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Dependency.cs
|
336
358
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyType.cs
|
337
359
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DirectoryPackagesPropsDiscovery.cs
|
@@ -385,6 +407,8 @@ files:
|
|
385
407
|
- helpers/lib/NuGetUpdater/global.json
|
386
408
|
- helpers/lib/NuGetUpdater/xunit.runner.json
|
387
409
|
- lib/dependabot/nuget.rb
|
410
|
+
- lib/dependabot/nuget/analysis/analysis_json_reader.rb
|
411
|
+
- lib/dependabot/nuget/analysis/dependency_analysis.rb
|
388
412
|
- lib/dependabot/nuget/cache_manager.rb
|
389
413
|
- lib/dependabot/nuget/discovery/dependency_details.rb
|
390
414
|
- lib/dependabot/nuget/discovery/dependency_file_discovery.rb
|
@@ -401,7 +425,17 @@ files:
|
|
401
425
|
- lib/dependabot/nuget/file_updater.rb
|
402
426
|
- lib/dependabot/nuget/http_response_helpers.rb
|
403
427
|
- lib/dependabot/nuget/metadata_finder.rb
|
428
|
+
- lib/dependabot/nuget/native_discovery/native_dependency_details.rb
|
429
|
+
- lib/dependabot/nuget/native_discovery/native_dependency_file_discovery.rb
|
430
|
+
- lib/dependabot/nuget/native_discovery/native_directory_packages_props_discovery.rb
|
431
|
+
- lib/dependabot/nuget/native_discovery/native_discovery_json_reader.rb
|
432
|
+
- lib/dependabot/nuget/native_discovery/native_evaluation_details.rb
|
433
|
+
- lib/dependabot/nuget/native_discovery/native_project_discovery.rb
|
434
|
+
- lib/dependabot/nuget/native_discovery/native_property_details.rb
|
435
|
+
- lib/dependabot/nuget/native_discovery/native_workspace_discovery.rb
|
404
436
|
- lib/dependabot/nuget/native_helpers.rb
|
437
|
+
- lib/dependabot/nuget/native_update_checker/native_requirements_updater.rb
|
438
|
+
- lib/dependabot/nuget/native_update_checker/native_update_checker.rb
|
405
439
|
- lib/dependabot/nuget/nuget_client.rb
|
406
440
|
- lib/dependabot/nuget/nuget_config_credential_helpers.rb
|
407
441
|
- lib/dependabot/nuget/requirement.rb
|
@@ -422,7 +456,7 @@ licenses:
|
|
422
456
|
- MIT
|
423
457
|
metadata:
|
424
458
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
425
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
459
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.264.0
|
426
460
|
post_install_message:
|
427
461
|
rdoc_options: []
|
428
462
|
require_paths:
|