Skip to content

Commit

Permalink
[#6825] Update Microsoft.Extensions and fix CS1061 issues (#6832)
Browse files Browse the repository at this point in the history
* Update Microsoft.Extensions and fix CS1061 issues

* Fix CVE-2024-30105 security issue
  • Loading branch information
sw-joelmut authored Aug 5, 2024
1 parent 5c5cf2b commit c7ab0d3
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<!-- Force System.Text.Json to a safe version. -->
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.Azure.CognitiveServices.Language.LUIS.Runtime" Version="2.1.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<!-- Force Microsoft.AspNetCore.Http to a safe version. -->
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs.Adaptive" Condition=" '$(ReleasePackageVersion)' == '' " Version="$(LocalPackageVersion)" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs.Adaptive" Condition=" '$(ReleasePackageVersion)' != '' " Version="$(ReleasePackageVersion)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<PackageReference Include="Microsoft.Bot.Builder" Condition=" '$(ReleasePackageVersion)' != '' " Version="$(ReleasePackageVersion)" />
<PackageReference Include="Microsoft.Recognizers.Text.Choice" Version="1.3.2" />
<PackageReference Include="Microsoft.Recognizers.Text.DateTime" Version="1.3.2" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<PackageReference Include="Microsoft.Bot.Connector" Condition=" '$(ReleasePackageVersion)' == '' " Version="$(LocalPackageVersion)" />
<PackageReference Include="Microsoft.Bot.Connector" Condition=" '$(ReleasePackageVersion)' != '' " Version="$(ReleasePackageVersion)" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.IO.Pipelines" Version="8.0.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.61.3" />
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="7.6.3" />
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.24" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Net.Http.Headers" Version="2.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<ItemGroup>
<!-- Force System.Text.Json to a safe version. -->
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageReference Include="Microsoft.Bot.Builder" Condition=" '$(ReleasePackageVersion)' == '' " Version="$(LocalPackageVersion)" />
<PackageReference Include="Microsoft.Bot.Builder" Condition=" '$(ReleasePackageVersion)' != '' " Version="$(ReleasePackageVersion)" />
<PackageReference Include="Microsoft.Bot.Builder.ApplicationInsights" Condition=" '$(ReleasePackageVersion)' == '' " Version="$(LocalPackageVersion)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<!-- Force Microsoft.AspNetCore.Http to a safe version. -->
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<!-- Force System.Text.Json to a safe version. -->
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageReference Include="Microsoft.Bot.Connector.Streaming" Condition=" '$(ReleasePackageVersion)' == '' " Version="$(LocalPackageVersion)" />
<PackageReference Include="Microsoft.Bot.Connector.Streaming" Condition=" '$(ReleasePackageVersion)' != '' " Version="$(ReleasePackageVersion)" />
<PackageReference Include="Microsoft.Bot.Streaming" Condition=" '$(ReleasePackageVersion)' == '' " Version="$(LocalPackageVersion)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public JavascriptAction([CallerFilePath] string sourceFilePath = "", [CallerLine

var result = engine.Execute(this.script)
.GetValue("doAction")
.Invoke(Jint.Native.JsValue.FromObject(engine, boundOptions ?? new object()))
.Call(Jint.Native.JsValue.FromObject(engine, boundOptions ?? new object()))
.ToObject();

if (this.ResultProperty != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Jint" Version="2.11.58" />
<PackageReference Include="Jint" Version="3.1.5" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.7" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.10.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
<!-- Force System.Text.Json to a newer version. Since Microsoft.Extensions.Logging.Console has 8.0.0 version, which causes CVE-2024-30105 security issue. -->
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ public GetConfigurationAsyncTests()
}

[Fact]
public void NullAddressParameterShouldThrow()
public async void NullAddressParameterShouldThrow()
{
Func<Task> action = async () => await _endorsementsRetriever.GetConfigurationAsync(null, _mockDocumentRetriever.Object, CancellationToken.None);

action.Should().Throw<ArgumentNullException>().And.ParamName.Should().Be("address");
(await action.Should().ThrowAsync<ArgumentNullException>()).And.ParamName.Should().Be("address");
}

[Fact]
public void NullDocumentRetrieverParameterShouldThrow()
public async void NullDocumentRetrieverParameterShouldThrow()
{
Func<Task> action = async () => await _endorsementsRetriever.GetConfigurationAsync(FakeDocumentAddress, null, CancellationToken.None);

action.Should().Throw<ArgumentNullException>().And.ParamName.Should().Be("retriever");
(await action.Should().ThrowAsync<ArgumentNullException>()).And.ParamName.Should().Be("retriever");
}

[Fact]
Expand Down Expand Up @@ -134,14 +134,14 @@ public async Task ReturnsEmptyValues_MultipleKeysWithNoEndorsements()
}

[Fact]
public void ThrowsIfDocumentRetrieverThrows()
public async void ThrowsIfDocumentRetrieverThrows()
{
_mockDocumentRetriever.Setup(dr => dr.GetDocumentAsync(FakeDocumentAddress, It.IsAny<CancellationToken>()))
.ThrowsAsync(new Exception(nameof(ThrowsIfDocumentRetrieverThrows)));

Func<Task> action = async () => await _endorsementsRetriever.GetConfigurationAsync(FakeDocumentAddress, _mockDocumentRetriever.Object, CancellationToken.None);

action.Should().Throw<Exception>().And.Message.Should().Be(nameof(ThrowsIfDocumentRetrieverThrows));
(await action.Should().ThrowAsync<Exception>()).And.Message.Should().Be(nameof(ThrowsIfDocumentRetrieverThrows));
}
}

Expand All @@ -160,26 +160,26 @@ public GetDocumentAsyncTests()
}

[Fact]
public void NullAddressParameterShouldThrow()
public async void NullAddressParameterShouldThrow()
{
Func<Task> action = async () => await _endorsementsRetriever.GetDocumentAsync(null, CancellationToken.None);

action.Should().Throw<ArgumentNullException>().And.ParamName.Should().Be("address");
(await action.Should().ThrowAsync<ArgumentNullException>()).And.ParamName.Should().Be("address");
}

[Fact]
public void NonSuccessHttpStatusResponseForEndorsementsDocumentShouldThrow()
public async void NonSuccessHttpStatusResponseForEndorsementsDocumentShouldThrow()
{
_mockHttpMessageHandler.When(FakeDocumentAddress)
.Respond(HttpStatusCode.NotFound);

Func<Task> action = async () => await _endorsementsRetriever.GetDocumentAsync(FakeDocumentAddress, CancellationToken.None);

action.Should().Throw<Exception>();
await action.Should().ThrowAsync<Exception>();
}

[Fact]
public void NonSuccessHttpStatusResponseForWebKeySetDocumentShouldThrow()
public async void NonSuccessHttpStatusResponseForWebKeySetDocumentShouldThrow()
{
_mockHttpMessageHandler.When(FakeDocumentAddress)
.Respond(new StringContent($@"{{ ""{EndorsementsRetriever.JsonWebKeySetUri}"": ""{FakeKeysAddressUrl}"" }}"));
Expand All @@ -189,7 +189,7 @@ public void NonSuccessHttpStatusResponseForWebKeySetDocumentShouldThrow()

Func<Task> action = async () => await _endorsementsRetriever.GetDocumentAsync(FakeDocumentAddress, CancellationToken.None);

action.Should().Throw<Exception>();
await action.Should().ThrowAsync<Exception>();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.7.0" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.Azure.Test.HttpRecorder" Version="1.13.3" />
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="7.6.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="FluentAssertions" Version="5.7.0" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.4.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions">
<Version>5.7.0</Version>
<Version>6.12.0</Version>
</PackageReference>
<PackageReference Include="Moq">
<Version>4.13.1</Version>
Expand Down

0 comments on commit c7ab0d3

Please sign in to comment.