dependabot-nuget 0.277.0 → 0.279.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/helpers/build +1 -1
- data/helpers/lib/NuGetUpdater/.editorconfig +1 -0
- data/helpers/lib/NuGetUpdater/Directory.Build.props +1 -0
- data/helpers/lib/NuGetUpdater/Directory.Common.props +1 -1
- data/helpers/lib/NuGetUpdater/Directory.Packages.props +6 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/RunCommand.cs +42 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Program.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Run.cs +132 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +2 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs +94 -85
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/DependencyFinder.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/Requirement.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +47 -41
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/NuGetUpdater.Core.csproj +2 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/AllowedUpdate.cs +6 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/CreatePullRequest.cs +18 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyFile.cs +18 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyFileNotFound.cs +6 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/IncrementMetric.cs +7 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Job.cs +49 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobErrorBase.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobFile.cs +6 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobSource.cs +11 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/MarkAsProcessed.cs +9 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/PrivateSourceAuthenticationFailure.cs +6 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/ReportedDependency.cs +16 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/ReportedRequirement.cs +9 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/RequirementSource.cs +7 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/UnknownError.cs +6 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/UpdatedDependencyList.cs +7 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/HttpApiHandler.cs +64 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/IApiHandler.cs +12 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunResult.cs +13 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +328 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/LockFileUpdater.cs +28 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +53 -37
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +5 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/NuGetHelper.cs +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +34 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/ProcessExtensions.cs +2 -4
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/RequirementTests.cs +4 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs +10 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +315 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs +60 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/TestApiHandler.cs +41 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdatedDependencyListTests.cs +69 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +8 -8
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs +10 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/PathHelperTests.cs +22 -0
- data/helpers/lib/NuGetUpdater/global.json +1 -1
- data/lib/dependabot/nuget/file_fetcher.rb +17 -0
- data/lib/dependabot/nuget/file_updater.rb +5 -1
- data/lib/dependabot/nuget/native_helpers.rb +4 -1
- data/lib/dependabot/nuget/requirement.rb +2 -0
- data/lib/dependabot/nuget/update_checker/repository_finder.rb +26 -2
- metadata +33 -5
@@ -0,0 +1,41 @@
|
|
1
|
+
using NuGetUpdater.Core.Run;
|
2
|
+
using NuGetUpdater.Core.Run.ApiModel;
|
3
|
+
|
4
|
+
namespace NuGetUpdater.Core.Test;
|
5
|
+
|
6
|
+
internal class TestApiHandler : IApiHandler
|
7
|
+
{
|
8
|
+
private readonly List<(Type, object)> _receivedMessages = new();
|
9
|
+
|
10
|
+
public IEnumerable<(Type Type, object Object)> ReceivedMessages => _receivedMessages;
|
11
|
+
|
12
|
+
public Task RecordUpdateJobError(JobErrorBase error)
|
13
|
+
{
|
14
|
+
_receivedMessages.Add((error.GetType(), error));
|
15
|
+
return Task.CompletedTask;
|
16
|
+
}
|
17
|
+
|
18
|
+
public Task UpdateDependencyList(UpdatedDependencyList updatedDependencyList)
|
19
|
+
{
|
20
|
+
_receivedMessages.Add((updatedDependencyList.GetType(), updatedDependencyList));
|
21
|
+
return Task.CompletedTask;
|
22
|
+
}
|
23
|
+
|
24
|
+
public Task IncrementMetric(IncrementMetric incrementMetric)
|
25
|
+
{
|
26
|
+
_receivedMessages.Add((incrementMetric.GetType(), incrementMetric));
|
27
|
+
return Task.CompletedTask;
|
28
|
+
}
|
29
|
+
|
30
|
+
public Task CreatePullRequest(CreatePullRequest createPullRequest)
|
31
|
+
{
|
32
|
+
_receivedMessages.Add((createPullRequest.GetType(), createPullRequest));
|
33
|
+
return Task.CompletedTask;
|
34
|
+
}
|
35
|
+
|
36
|
+
public Task MarkAsProcessed(MarkAsProcessed markAsProcessed)
|
37
|
+
{
|
38
|
+
_receivedMessages.Add((markAsProcessed.GetType(), markAsProcessed));
|
39
|
+
return Task.CompletedTask;
|
40
|
+
}
|
41
|
+
}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
using System.Text.Json;
|
2
|
+
|
3
|
+
using NuGetUpdater.Core.Discover;
|
4
|
+
using NuGetUpdater.Core.Run;
|
5
|
+
using NuGetUpdater.Core.Run.ApiModel;
|
6
|
+
|
7
|
+
using Xunit;
|
8
|
+
|
9
|
+
namespace NuGetUpdater.Core.Test.Run;
|
10
|
+
|
11
|
+
public class UpdatedDependencyListTests
|
12
|
+
{
|
13
|
+
[Fact]
|
14
|
+
public void GetUpdatedDependencyListFromDiscovery()
|
15
|
+
{
|
16
|
+
var discovery = new WorkspaceDiscoveryResult()
|
17
|
+
{
|
18
|
+
Path = "src",
|
19
|
+
IsSuccess = true,
|
20
|
+
Projects = [
|
21
|
+
new()
|
22
|
+
{
|
23
|
+
FilePath = "project.csproj",
|
24
|
+
Dependencies = [
|
25
|
+
new("Microsoft.Extensions.DependencyModel", "6.0.0", DependencyType.PackageReference, TargetFrameworks: ["net6.0"]),
|
26
|
+
new("System.Text.Json", "6.0.0", DependencyType.Unknown, TargetFrameworks: ["net6.0"], IsTransitive: true),
|
27
|
+
],
|
28
|
+
IsSuccess = true,
|
29
|
+
Properties = [],
|
30
|
+
TargetFrameworks = ["net8.0"],
|
31
|
+
ReferencedProjectPaths = [],
|
32
|
+
}
|
33
|
+
]
|
34
|
+
};
|
35
|
+
var updatedDependencyList = RunWorker.GetUpdatedDependencyListFromDiscovery(discovery);
|
36
|
+
var expectedDependencyList = new UpdatedDependencyList()
|
37
|
+
{
|
38
|
+
Dependencies =
|
39
|
+
[
|
40
|
+
new ReportedDependency()
|
41
|
+
{
|
42
|
+
Name = "Microsoft.Extensions.DependencyModel",
|
43
|
+
Version = "6.0.0",
|
44
|
+
Requirements =
|
45
|
+
[
|
46
|
+
new ReportedRequirement()
|
47
|
+
{
|
48
|
+
Requirement = "6.0.0",
|
49
|
+
File = "/src/project.csproj",
|
50
|
+
Groups = ["dependencies"],
|
51
|
+
}
|
52
|
+
]
|
53
|
+
},
|
54
|
+
new ReportedDependency()
|
55
|
+
{
|
56
|
+
Name = "System.Text.Json",
|
57
|
+
Version = "6.0.0",
|
58
|
+
Requirements = [],
|
59
|
+
}
|
60
|
+
],
|
61
|
+
DependencyFiles = ["/src/project.csproj"],
|
62
|
+
};
|
63
|
+
|
64
|
+
// doing JSON comparison makes this easier; we don't have to define custom record equality and we get an easy diff
|
65
|
+
var actualJson = JsonSerializer.Serialize(updatedDependencyList);
|
66
|
+
var expectedJson = JsonSerializer.Serialize(expectedDependencyList);
|
67
|
+
Assert.Equal(expectedJson, actualJson);
|
68
|
+
}
|
69
|
+
}
|
@@ -257,14 +257,6 @@ public abstract class UpdateWorkerTestBase : TestBase
|
|
257
257
|
package.WriteToDirectory(localFeedPath);
|
258
258
|
}
|
259
259
|
|
260
|
-
// override various nuget locations
|
261
|
-
foreach (var envName in new[] { "NUGET_PACKAGES", "NUGET_HTTP_CACHE_PATH", "NUGET_SCRATCH", "NUGET_PLUGINS_CACHE_PATH" })
|
262
|
-
{
|
263
|
-
string dir = Path.Join(temporaryDirectory, envName);
|
264
|
-
Directory.CreateDirectory(dir);
|
265
|
-
Environment.SetEnvironmentVariable(envName, dir);
|
266
|
-
}
|
267
|
-
|
268
260
|
// ensure only the test feed is used
|
269
261
|
string relativeLocalFeedPath = Path.GetRelativePath(temporaryDirectory, localFeedPath);
|
270
262
|
await File.WriteAllTextAsync(Path.Join(temporaryDirectory, "NuGet.Config"), $"""
|
@@ -278,6 +270,14 @@ public abstract class UpdateWorkerTestBase : TestBase
|
|
278
270
|
"""
|
279
271
|
);
|
280
272
|
}
|
273
|
+
|
274
|
+
// override various nuget locations
|
275
|
+
foreach (var envName in new[] { "NUGET_PACKAGES", "NUGET_HTTP_CACHE_PATH", "NUGET_SCRATCH", "NUGET_PLUGINS_CACHE_PATH" })
|
276
|
+
{
|
277
|
+
string dir = Path.Join(temporaryDirectory, envName);
|
278
|
+
Directory.CreateDirectory(dir);
|
279
|
+
Environment.SetEnvironmentVariable(envName, dir);
|
280
|
+
}
|
281
281
|
}
|
282
282
|
|
283
283
|
protected static async Task<TestFile[]> RunUpdate(TestFile[] files, Func<string, Task> action)
|
@@ -16,6 +16,7 @@ public partial class UpdateWorkerTests
|
|
16
16
|
[InlineData("net472")]
|
17
17
|
[InlineData("net7.0")]
|
18
18
|
[InlineData("net8.0")]
|
19
|
+
[InlineData("net9.0")]
|
19
20
|
public async Task UpdateVersionAttribute_InProjectFile_ForPackageReferenceInclude(string tfm)
|
20
21
|
{
|
21
22
|
// update Some.Package from 9.0.1 to 13.0.1
|
@@ -186,6 +187,7 @@ public partial class UpdateWorkerTests
|
|
186
187
|
projectContents: $"""
|
187
188
|
<Project Sdk="Microsoft.NET.Sdk">
|
188
189
|
<PropertyGroup>
|
190
|
+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
|
189
191
|
<TargetFramework>net8.0</TargetFramework>
|
190
192
|
</PropertyGroup>
|
191
193
|
<ItemGroup>
|
@@ -199,6 +201,7 @@ public partial class UpdateWorkerTests
|
|
199
201
|
(Path: "src/Project/Project.csproj", Content: """
|
200
202
|
<Project Sdk="Microsoft.NET.Sdk">
|
201
203
|
<PropertyGroup>
|
204
|
+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
|
202
205
|
<TargetFramework>net8.0</TargetFramework>
|
203
206
|
</PropertyGroup>
|
204
207
|
<ItemGroup>
|
@@ -211,6 +214,7 @@ public partial class UpdateWorkerTests
|
|
211
214
|
expectedProjectContents: $"""
|
212
215
|
<Project Sdk="Microsoft.NET.Sdk">
|
213
216
|
<PropertyGroup>
|
217
|
+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
|
214
218
|
<TargetFramework>net8.0</TargetFramework>
|
215
219
|
</PropertyGroup>
|
216
220
|
<ItemGroup>
|
@@ -224,6 +228,7 @@ public partial class UpdateWorkerTests
|
|
224
228
|
(Path: "src/Project/Project.csproj", Content: """
|
225
229
|
<Project Sdk="Microsoft.NET.Sdk">
|
226
230
|
<PropertyGroup>
|
231
|
+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
|
227
232
|
<TargetFramework>net8.0</TargetFramework>
|
228
233
|
</PropertyGroup>
|
229
234
|
<ItemGroup>
|
@@ -244,7 +249,7 @@ public partial class UpdateWorkerTests
|
|
244
249
|
MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net8.0"),
|
245
250
|
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net8.0"),
|
246
251
|
// necessary for the `net8.0-windows10.0.19041.0` TFM
|
247
|
-
new("Microsoft.Windows.SDK.NET.Ref", "10.0.19041.
|
252
|
+
new("Microsoft.Windows.SDK.NET.Ref", "10.0.19041.34", Files:
|
248
253
|
[
|
249
254
|
("data/FrameworkList.xml", Encoding.UTF8.GetBytes("""
|
250
255
|
<FileList Name="Windows SDK .NET 6.0">
|
@@ -548,6 +553,7 @@ public partial class UpdateWorkerTests
|
|
548
553
|
<Project Sdk="Microsoft.NET.Sdk">
|
549
554
|
|
550
555
|
<PropertyGroup>
|
556
|
+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
|
551
557
|
<TargetFramework>net8.0</TargetFramework>
|
552
558
|
</PropertyGroup>
|
553
559
|
|
@@ -562,6 +568,7 @@ public partial class UpdateWorkerTests
|
|
562
568
|
<Project Sdk="Microsoft.NET.Sdk">
|
563
569
|
|
564
570
|
<PropertyGroup>
|
571
|
+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
|
565
572
|
<TargetFramework>net8.0</TargetFramework>
|
566
573
|
</PropertyGroup>
|
567
574
|
|
@@ -588,6 +595,7 @@ public partial class UpdateWorkerTests
|
|
588
595
|
projectContents: """
|
589
596
|
<Project Sdk="Microsoft.NET.Sdk">
|
590
597
|
<PropertyGroup>
|
598
|
+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
|
591
599
|
<TargetFramework>net8.0</TargetFramework>
|
592
600
|
</PropertyGroup>
|
593
601
|
<ItemGroup>
|
@@ -608,6 +616,7 @@ public partial class UpdateWorkerTests
|
|
608
616
|
expectedProjectContents: """
|
609
617
|
<Project Sdk="Microsoft.NET.Sdk">
|
610
618
|
<PropertyGroup>
|
619
|
+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
|
611
620
|
<TargetFramework>net8.0</TargetFramework>
|
612
621
|
</PropertyGroup>
|
613
622
|
<ItemGroup>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
using Xunit;
|
2
|
+
|
3
|
+
namespace NuGetUpdater.Core.Test.Utilities;
|
4
|
+
|
5
|
+
public class PathHelperTests
|
6
|
+
{
|
7
|
+
[Theory]
|
8
|
+
[InlineData("a/b/c", "a/b/c")]
|
9
|
+
[InlineData("a/b/../c", "a/c")]
|
10
|
+
[InlineData("a/..//c", "c")]
|
11
|
+
[InlineData("/a/b/c", "/a/b/c")]
|
12
|
+
[InlineData("/a/b/../c", "/a/c")]
|
13
|
+
[InlineData("/a/..//c", "/c")]
|
14
|
+
[InlineData("a/b/./c", "a/b/c")]
|
15
|
+
[InlineData("a/../../b", "b")]
|
16
|
+
[InlineData("../../../a/b", "a/b")]
|
17
|
+
public void VerifyNormalizeUnixPathParts(string input, string expected)
|
18
|
+
{
|
19
|
+
var actual = input.NormalizeUnixPathParts();
|
20
|
+
Assert.Equal(expected, actual);
|
21
|
+
}
|
22
|
+
}
|
@@ -52,6 +52,7 @@ module Dependabot
|
|
52
52
|
@nuget_config_files = T.let(nil, T.nilable(T::Array[Dependabot::DependencyFile]))
|
53
53
|
@packages_config_files = T.let(nil, T.nilable(T::Array[Dependabot::DependencyFile]))
|
54
54
|
@assembly_binding_redirect_config_files = T.let(nil, T.nilable(T::Array[Dependabot::DependencyFile]))
|
55
|
+
@packages_lock_files = T.let(nil, T.nilable(T::Array[Dependabot::DependencyFile]))
|
55
56
|
end
|
56
57
|
|
57
58
|
sig { override.returns(T::Array[DependencyFile]) }
|
@@ -63,6 +64,7 @@ module Dependabot
|
|
63
64
|
*packages_config_files,
|
64
65
|
*assembly_binding_redirect_config_files,
|
65
66
|
*nuget_config_files,
|
67
|
+
*packages_lock_files,
|
66
68
|
global_json,
|
67
69
|
dotnet_tools_json,
|
68
70
|
packages_props
|
@@ -266,6 +268,21 @@ module Dependabot
|
|
266
268
|
@nuget_config_files
|
267
269
|
end
|
268
270
|
|
271
|
+
sig { returns(T::Array[Dependabot::DependencyFile]) }
|
272
|
+
def packages_lock_files
|
273
|
+
return @packages_lock_files if @packages_lock_files
|
274
|
+
|
275
|
+
candidate_paths =
|
276
|
+
[*project_files.map { |f| File.dirname(f.name) }, "."].uniq
|
277
|
+
|
278
|
+
@packages_lock_files =
|
279
|
+
candidate_paths.filter_map do |dir|
|
280
|
+
file = repo_contents(dir: dir)
|
281
|
+
.find { |f| f.name.casecmp("packages.lock.json").zero? }
|
282
|
+
fetch_file_from_host(File.join(dir, file.name)) if file
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
269
286
|
sig do
|
270
287
|
params(
|
271
288
|
project_file: Dependabot::DependencyFile,
|
@@ -51,7 +51,7 @@ module Dependabot
|
|
51
51
|
sig { override.returns(T::Array[Dependabot::DependencyFile]) }
|
52
52
|
def updated_dependency_files
|
53
53
|
base_dir = "/"
|
54
|
-
SharedHelpers.in_a_temporary_repo_directory(base_dir, repo_contents_path) do
|
54
|
+
all_updated_files = SharedHelpers.in_a_temporary_repo_directory(base_dir, repo_contents_path) do
|
55
55
|
dependencies.each do |dependency|
|
56
56
|
try_update_projects(dependency) || try_update_json(dependency)
|
57
57
|
end
|
@@ -70,6 +70,10 @@ module Dependabot
|
|
70
70
|
end
|
71
71
|
updated_files
|
72
72
|
end
|
73
|
+
|
74
|
+
raise UpdateNotPossible, dependencies.map(&:name) if all_updated_files.empty?
|
75
|
+
|
76
|
+
all_updated_files
|
73
77
|
end
|
74
78
|
|
75
79
|
private
|
@@ -242,8 +242,11 @@ module Dependabot
|
|
242
242
|
puts "running NuGet updater:\n" + command
|
243
243
|
|
244
244
|
NuGetConfigCredentialHelpers.patch_nuget_config_for_action(credentials) do
|
245
|
+
# default to UseNewNugetPackageResolved _unless_ nuget_legacy_dependency_solver is enabled
|
245
246
|
env = {}
|
246
|
-
|
247
|
+
unless Dependabot::Experiments.enabled?(:nuget_legacy_dependency_solver)
|
248
|
+
env["UseNewNugetPackageResolver"] = "true"
|
249
|
+
end
|
247
250
|
output = SharedHelpers.run_shell_command(command,
|
248
251
|
allow_unsafe_shell_command: true,
|
249
252
|
fingerprint: fingerprint,
|
@@ -13,6 +13,7 @@ require "dependabot/nuget/http_response_helpers"
|
|
13
13
|
|
14
14
|
module Dependabot
|
15
15
|
module Nuget
|
16
|
+
# rubocop:disable Metrics/ClassLength
|
16
17
|
class RepositoryFinder
|
17
18
|
extend T::Sig
|
18
19
|
|
@@ -48,7 +49,15 @@ module Dependabot
|
|
48
49
|
@known_repositories << { url: DEFAULT_REPOSITORY_URL, token: nil } if @known_repositories.empty?
|
49
50
|
|
50
51
|
@known_repositories = @known_repositories.map do |repo|
|
51
|
-
|
52
|
+
url = repo[:url]
|
53
|
+
begin
|
54
|
+
url = URI::DEFAULT_PARSER.parse(url).to_s
|
55
|
+
rescue URI::InvalidURIError
|
56
|
+
# e.g., the url has spaces or unacceptable symbols
|
57
|
+
url = URI::DEFAULT_PARSER.escape(url)
|
58
|
+
end
|
59
|
+
|
60
|
+
{ url: url, token: repo[:token] }
|
52
61
|
end
|
53
62
|
@known_repositories.uniq
|
54
63
|
end
|
@@ -68,6 +77,20 @@ module Dependabot
|
|
68
77
|
}
|
69
78
|
end
|
70
79
|
|
80
|
+
sig { params(source_name: String).returns(String) }
|
81
|
+
def self.escape_source_name_to_element_name(source_name)
|
82
|
+
source_name.chars.map do |c|
|
83
|
+
case c
|
84
|
+
when /[A-Za-z0-9\-_.]/
|
85
|
+
# letters, digits, hyphens, underscores, and periods are all directly allowed
|
86
|
+
c
|
87
|
+
else
|
88
|
+
# otherwise it needs to be escaped as a 4 digit hex value
|
89
|
+
"_x#{c.ord.to_s(16).rjust(4, '0')}_"
|
90
|
+
end
|
91
|
+
end.join
|
92
|
+
end
|
93
|
+
|
71
94
|
private
|
72
95
|
|
73
96
|
sig { returns(Dependabot::Dependency) }
|
@@ -376,7 +399,7 @@ module Dependabot
|
|
376
399
|
next source_details[:token] = nil unless key
|
377
400
|
next source_details[:token] = nil if key.match?(/^\d/)
|
378
401
|
|
379
|
-
tag =
|
402
|
+
tag = RepositoryFinder.escape_source_name_to_element_name(key)
|
380
403
|
creds_nodes = doc.css("configuration > packageSourceCredentials " \
|
381
404
|
"> #{tag} > add")
|
382
405
|
|
@@ -438,5 +461,6 @@ module Dependabot
|
|
438
461
|
end
|
439
462
|
end
|
440
463
|
end
|
464
|
+
# rubocop:enable Metrics/ClassLength
|
441
465
|
end
|
442
466
|
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.279.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-10-03 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.279.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.279.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubyzip
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -293,11 +293,13 @@ files:
|
|
293
293
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Analyze.cs
|
294
294
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Discover.cs
|
295
295
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.FrameworkCheck.cs
|
296
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Run.cs
|
296
297
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs
|
297
298
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/NuGetUpdater.Cli.Test.csproj
|
298
299
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/AnalyzeCommand.cs
|
299
300
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/DiscoverCommand.cs
|
300
301
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/FrameworkCheckCommand.cs
|
302
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/RunCommand.cs
|
301
303
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/UpdateCommand.cs
|
302
304
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/NuGetUpdater.Cli.csproj
|
303
305
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Program.cs
|
@@ -325,6 +327,10 @@ files:
|
|
325
327
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/FrameworkChecker/SupportedFrameworkFacts.cs
|
326
328
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs
|
327
329
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/NuGetUpdater.Core.Test.csproj
|
330
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs
|
331
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs
|
332
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/TestApiHandler.cs
|
333
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdatedDependencyListTests.cs
|
328
334
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryDirectory.cs
|
329
335
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TemporaryEnvironment.cs
|
330
336
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestBase.cs
|
@@ -342,6 +348,7 @@ files:
|
|
342
348
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/DiffUtil.cs
|
343
349
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/JsonHelperTests.cs
|
344
350
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs
|
351
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/PathHelperTests.cs
|
345
352
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/SdkPackageUpdaterHelperTests.cs
|
346
353
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalysisResult.cs
|
347
354
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs
|
@@ -388,11 +395,32 @@ files:
|
|
388
395
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/NativeResult.cs
|
389
396
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/NuGetUpdater.Core.csproj
|
390
397
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Property.cs
|
398
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/AllowedUpdate.cs
|
399
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/CreatePullRequest.cs
|
400
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyFile.cs
|
401
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/DependencyFileNotFound.cs
|
402
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/IncrementMetric.cs
|
403
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Job.cs
|
404
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobErrorBase.cs
|
405
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobFile.cs
|
406
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobSource.cs
|
407
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/MarkAsProcessed.cs
|
408
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/PrivateSourceAuthenticationFailure.cs
|
409
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/ReportedDependency.cs
|
410
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/ReportedRequirement.cs
|
411
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/RequirementSource.cs
|
412
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/UnknownError.cs
|
413
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/UpdatedDependencyList.cs
|
414
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/HttpApiHandler.cs
|
415
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/IApiHandler.cs
|
416
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunResult.cs
|
417
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs
|
391
418
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectManager.cs
|
392
419
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/BindingRedirectResolver.cs
|
393
420
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/ConfigurationFile.cs
|
394
421
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/DotNetToolsJsonUpdater.cs
|
395
422
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/GlobalJsonUpdater.cs
|
423
|
+
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/LockFileUpdater.cs
|
396
424
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs
|
397
425
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/SdkPackageUpdater.cs
|
398
426
|
- helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdateOperationResult.cs
|
@@ -463,7 +491,7 @@ licenses:
|
|
463
491
|
- MIT
|
464
492
|
metadata:
|
465
493
|
bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
|
466
|
-
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.
|
494
|
+
changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.279.0
|
467
495
|
post_install_message:
|
468
496
|
rdoc_options: []
|
469
497
|
require_paths:
|