-
Notifications
You must be signed in to change notification settings - Fork 39
Update docker-creds-provider to address vulnerable system.text.json dependency. #434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props, $(MSBuildThisFileDirectory)..))" /> | ||
|
||
<PropertyGroup> | ||
<!-- Build all tasks as AnyCPU to match NuGet DLLs in the SDK: avoid warnings. --> | ||
<Platform>AnyCPU</Platform> | ||
<!-- | ||
Do not import the Arcade SDK for the local tooling projects. This lets us | ||
build them with just the .NET SDK, simplifying the build. | ||
--> | ||
<SkipArcadeSdkImport>true</SkipArcadeSdkImport> | ||
</PropertyGroup> | ||
|
||
<!-- | ||
Use some assemblies from the SDK, instead of package references. This ensures they match what's | ||
found when the task is loaded by the SDK's MSBuild. | ||
--> | ||
<ItemGroup> | ||
<SdkAssembly Include="$(SdkReferenceDir)Newtonsoft.Json.dll" /> | ||
|
||
<SdkAssemblyReference | ||
Include="@(SdkAssembly -> '%(FileName)')" | ||
HintPath="$(SdkReferenceDir)%(Identity).dll" /> | ||
</ItemGroup> | ||
|
||
</Project> |
26 changes: 26 additions & 0 deletions
26
.../Microsoft.DotNet.SourceBuild.Tasks.XPlat/Microsoft.DotNet.SourceBuild.Tasks.XPlat.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<OutputPath>$(XPlatTasksBinDir)</OutputPath> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<!-- Default assembly version causes CS7034. Assembly info is not necessary given this | ||
msbuild task assembly is for build only purposes. --> | ||
<GenerateAssemblyInfo>False</GenerateAssemblyInfo> | ||
<Deterministic>False</Deterministic> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Build" Version="$(MicrosoftBuildVersion)" /> | ||
<PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildVersion)" /> | ||
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildVersion)" /> | ||
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildVersion)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="@(SdkAssemblyReference)" /> | ||
</ItemGroup> | ||
|
||
</Project> |
69 changes: 69 additions & 0 deletions
69
eng/tasks/Microsoft.DotNet.SourceBuild.Tasks.XPlat/UpdateJson.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Utilities; | ||
|
||
namespace Microsoft.DotNet.Build.Tasks | ||
{ | ||
// Takes a path to a path to a json file and a | ||
// string that represents a dotted path to an attribute | ||
// and updates that attribute with the new value provided. | ||
public class UpdateJson : Task | ||
{ | ||
[Required] | ||
public string JsonFilePath { get; set; } | ||
|
||
[Required] | ||
public string PathToAttribute { get; set; } | ||
|
||
[Required] | ||
public string NewAttributeValue { get; set; } | ||
|
||
public bool SkipUpdateIfMissingKey { get; set; } | ||
|
||
public override bool Execute() | ||
{ | ||
JObject jsonObj = JObject.Parse(File.ReadAllText(JsonFilePath)); | ||
|
||
string[] escapedPathToAttributeParts = PathToAttribute.Replace("\\.", "\x1F").Split('.'); | ||
for (int i = 0; i < escapedPathToAttributeParts.Length; ++i) | ||
{ | ||
escapedPathToAttributeParts[i] = escapedPathToAttributeParts[i].Replace("\x1F", "."); | ||
} | ||
UpdateAttribute(jsonObj, escapedPathToAttributeParts, NewAttributeValue); | ||
|
||
File.WriteAllText(JsonFilePath, jsonObj.ToString()); | ||
return true; | ||
} | ||
|
||
private void UpdateAttribute(JToken jsonObj, string[] path, string newValue) | ||
{ | ||
string pathItem = path[0]; | ||
if (jsonObj[pathItem] == null) | ||
{ | ||
string message = $"Path item [{nameof(PathToAttribute)}] not found in json file."; | ||
if (SkipUpdateIfMissingKey) | ||
{ | ||
Log.LogMessage(MessageImportance.Low, $"Skipping update: {message} {pathItem}"); | ||
return; | ||
} | ||
throw new ArgumentException(message, pathItem); | ||
} | ||
|
||
if (path.Length == 1) | ||
{ | ||
jsonObj[pathItem] = newValue; | ||
return; | ||
} | ||
|
||
UpdateAttribute(jsonObj[pathItem], path.Skip(1).ToArray(), newValue); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...projects/docker-creds-provider-2.2.0.proj → repo-projects/docker-creds-provider.proj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule docker-creds-provider
added at
6e1ecd
Submodule docker-creds-provider-2.2.0
deleted from
5701f6
Submodule docker-creds-provider-2.2.1
deleted from
b381ea
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this task get called from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The consuming target already existed but failed when invoked...
https://github.com/dotnet/source-build-externals/pull/434/files#diff-c4c7386806d2707bdf65085bbf28501450a36181d035aa9a306cae52afd6f2f0L124