Skip to content

Commit

Permalink
Upgrade Azure.Idenntity to 1.12.0 For CVE (Azure#25318)
Browse files Browse the repository at this point in the history
* Upgrade Azure.Identity for CVE

* Integrate new MSAL runtime to fix WAM popup window issue

* Update the reference of Authentication.csproj and ChangeLog.md

* Fix Azure.Core.AccessToken used before assigned issue

* Address review comments

* Update src/Accounts/Accounts/ChangeLog.md

Co-authored-by: Yeming Liu <[email protected]>

---------

Co-authored-by: Yeming Liu <[email protected]>
  • Loading branch information
msJinLei and isra-fel authored Jun 25, 2024
1 parent c75fd83 commit 5a245ca
Show file tree
Hide file tree
Showing 19 changed files with 64 additions and 46 deletions.
2 changes: 2 additions & 0 deletions src/Accounts/Accounts/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
-->

## Upcoming Release
* Fixed [CVE-2024-35255](https://github.com/advisories/GHSA-m5vv-6r4h-3vj9)
* Updated `Microsoft.Identity.Client.NativeInterop` to fix the WAM pop window issue in elevated mode [#24967]
* Updated the reference of Azure PowerShell Common to 1.3.98-preview.
* Limited promotional message to interactive scenarios only

Expand Down
12 changes: 6 additions & 6 deletions src/Accounts/AssemblyLoading/ConditionalAssemblyProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ public static void Initialize(string rootPath, IConditionalAssemblyContext conte
// todo: add a tool to update assembly versions after replacing the assemblies. (Can it support newly introduced assemblies?)
// todo: consider moving the list to a standalone config file
#region AssemblyList
CreateAssembly("netstandard2.0", "Azure.Core", "1.38.0.0"),
CreateAssembly("netstandard2.0", "Azure.Identity", "1.11.2.0"),
CreateAssembly("netstandard2.0", "Azure.Core", "1.40.0.0"),
CreateAssembly("netstandard2.0", "Azure.Identity", "1.12.0.0"),
CreateAssembly("netstandard2.0", "Azure.Identity.Broker", "1.1.0.0"),
CreateAssembly("netstandard2.0", "Microsoft.Bcl.AsyncInterfaces", "1.0.0.0"),
CreateAssembly("netstandard2.0", "Microsoft.Identity.Client", "4.60.3.0"),
CreateAssembly("netstandard2.0", "Microsoft.Identity.Client.Extensions.Msal", "4.60.3.0"),
CreateAssembly("netstandard2.0", "Microsoft.Identity.Client.Broker", "4.60.3.0"),
CreateAssembly("netstandard2.0", "Microsoft.Identity.Client.NativeInterop", "0.16.0.0"),
CreateAssembly("netstandard2.0", "Microsoft.Identity.Client", "4.61.3.0"),
CreateAssembly("netstandard2.0", "Microsoft.Identity.Client.Extensions.Msal", "4.61.3.0"),
CreateAssembly("netstandard2.0", "Microsoft.Identity.Client.Broker", "4.61.3.0"),
CreateAssembly("netstandard2.0", "Microsoft.Identity.Client.NativeInterop", "0.16.2.0"),
CreateAssembly("netstandard2.0", "Microsoft.IdentityModel.Abstractions", "6.35.0.0"),
CreateAssembly("netstandard2.0", "System.ClientModel", "1.0.0.0"),
CreateAssembly("netstandard2.0", "System.Memory.Data", "1.0.2.0"),
Expand Down
8 changes: 4 additions & 4 deletions src/Accounts/Authentication/Authentication.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.11.2" />
<PackageReference Include="Azure.Identity" Version="1.12.0" />
<PackageReference Include="Azure.Identity.Broker" Version="1.1.0" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.60.3" />
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.60.3" />
<PackageReference Include="Microsoft.Identity.Client.Broker" Version="4.60.3"/>
<PackageReference Include="Microsoft.Identity.Client" Version="4.61.3" />
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="4.61.3" />
<PackageReference Include="Microsoft.Identity.Client.Broker" Version="4.61.3"/>
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/CosmosDB/CosmosDB/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
-->

## Upcoming Release
* Fixed the issue that Azure.Core.AccessToken is used before assigned.

## Version 1.14.3
* Removed the out-of-date breaking change message for `Get-AzCosmosDBAccountKey`.
Expand Down
20 changes: 12 additions & 8 deletions src/CosmosDB/CosmosDB/Helpers/CosmosDBSessionCredential.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,28 @@ public CosmosDBSessionCredential(IAzureContext defaultContext, string endPointRe

public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken)
{
AccessToken token;
this.accessToken.AuthorizeRequest((tokenType, tokenValue) =>
DateTimeOffset expiresOn;
string token = string.Empty;
accessToken.AuthorizeRequest((tokenType, tokenValue) =>
{
token = new AccessToken(tokenValue, DateTimeOffset.UtcNow);
token = tokenValue;
expiresOn = DateTimeOffset.UtcNow;
});

return token;
return new AccessToken(token, expiresOn);
}

public override ValueTask<AccessToken> GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken)
{
AccessToken token;
this.accessToken.AuthorizeRequest((tokenType, tokenValue) =>
DateTimeOffset expiresOn;
string token = string.Empty;
accessToken.AuthorizeRequest((tokenType, tokenValue) =>
{
token = new AccessToken(tokenValue, DateTimeOffset.UtcNow);
token = tokenValue;
expiresOn = DateTimeOffset.UtcNow;
});

return new ValueTask<AccessToken>(token);
return new ValueTask<AccessToken>(new AccessToken(token, expiresOn));
}
}
}
1 change: 1 addition & 0 deletions src/Storage/Storage.Management/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Fixed the issue that Azure.Core.AccessToken is used before assigned.
* Supported TLS1_3 when creating and updating a storage account
- `New-AzStorageAccount`
- `Set-AzStorageAccount`
Expand Down
32 changes: 18 additions & 14 deletions src/Storage/Storage/Common/AzureSessionCredential.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Core;

using Microsoft.Azure.Commands.Common.Authentication;
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;

using System;
using System.Threading;
using System.Threading.Tasks;

namespace Microsoft.WindowsAzure.Commands.Storage.Common
{
public delegate void DebugLogWriter(string log);
Expand Down Expand Up @@ -51,33 +51,37 @@ public AzureSessionCredential(IAzureContext DefaultContext, DebugLogWriter logWr

public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken)
{
AccessToken token;
DateTimeOffset expiresOn;
string token = string.Empty;
accessToken.AuthorizeRequest((tokenType, tokenValue) =>
{
token = new AccessToken(tokenValue, DateTimeOffset.UtcNow);
token = tokenValue;
expiresOn = DateTimeOffset.UtcNow;
});
#if DEBUG
if (this.debugLogWriter != null)
{
this.debugLogWriter("[" + DateTime.Now.ToString() + "] GetToken: " + token.Token);
this.debugLogWriter("[" + DateTime.Now.ToString() + "] GetToken: " + token);
}
#endif
return token;
return new AccessToken(token, expiresOn);
}

public override ValueTask<AccessToken> GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken)
{
AccessToken token;
DateTimeOffset expiresOn;
string token = string.Empty;
accessToken.AuthorizeRequest((tokenType, tokenValue) =>
{
token = new AccessToken(tokenValue, DateTimeOffset.UtcNow);
token = tokenValue;
expiresOn = DateTimeOffset.UtcNow;
});

if (this.debugLogWriter != null)
{
this.debugLogWriter("[" + DateTime.Now.ToString() + "] GetTokenAsync: " + token.Token);
this.debugLogWriter("[" + DateTime.Now.ToString() + "] GetTokenAsync: " + token);
}
return new ValueTask<AccessToken>(token);
return new ValueTask<AccessToken>(new AccessToken(token, expiresOn));
}

private IAzureEnvironment EnsureStorageOAuthAudienceSet(IAzureEnvironment environment)
Expand Down
1 change: 1 addition & 0 deletions src/Synapse/Synapse/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
-->

## Upcoming Release
* Fixed the issue that Azure.Core.AccessToken is used before assigned.

## Version 3.0.8
* Upgraded `Microsoft.DataTransfer.Gateway.Encryption` to `5.29.8499.2`
Expand Down
31 changes: 18 additions & 13 deletions src/Synapse/Synapse/Common/AzureSessionCredential.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Azure.Core;

using Microsoft.Azure.Commands.Common.Authentication;
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
using Microsoft.Azure.Commands.ResourceManager.Common.Properties;

using System;
using System.Threading;
using System.Threading.Tasks;

namespace Microsoft.Azure.Commands.Synapse.Common
{
public delegate void DebugLogWriter(string log);
Expand Down Expand Up @@ -51,31 +51,36 @@ public AzureSessionCredential(IAzureContext DefaultContext, DebugLogWriter logWr

public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken)
{
AccessToken token;
DateTimeOffset expiresOn;
string token = string.Empty;
accessToken.AuthorizeRequest((tokenType, tokenValue) =>
{
token = new AccessToken(tokenValue, DateTimeOffset.UtcNow);
token = tokenValue;
expiresOn = DateTimeOffset.UtcNow;
});

if (this.debugLogWriter != null)
{
this.debugLogWriter("[" + DateTime.Now.ToString() + "] GetToken: " + token.Token);
this.debugLogWriter("[" + DateTime.Now.ToString() + "] GetToken: " + token);
}
return token;
return new AccessToken(token, expiresOn);
}

public override ValueTask<AccessToken> GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken)
{
AccessToken token;
DateTimeOffset expiresOn;
string token = string.Empty;
accessToken.AuthorizeRequest((tokenType, tokenValue) =>
{
token = new AccessToken(tokenValue, DateTimeOffset.UtcNow);
token = tokenValue;
expiresOn = DateTimeOffset.UtcNow;
});

if (this.debugLogWriter != null)
{
this.debugLogWriter("[" + DateTime.Now.ToString() + "] GetTokenAsync: " + token.Token);
this.debugLogWriter("[" + DateTime.Now.ToString() + "] GetTokenAsync: " + token);
}
return new ValueTask<AccessToken>(token);
return new ValueTask<AccessToken>(new AccessToken(token, expiresOn));
}

private IAccessToken accessToken;
Expand Down
Binary file modified src/lib/netstandard2.0/Azure.Core.dll
Binary file not shown.
Binary file modified src/lib/netstandard2.0/Azure.Identity.dll
Binary file not shown.
Binary file modified src/lib/netstandard2.0/Microsoft.Identity.Client.Broker.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified src/lib/netstandard2.0/Microsoft.Identity.Client.dll
Binary file not shown.
Binary file modified src/lib/netstandard2.0/msalruntime.dll
Binary file not shown.
Binary file modified src/lib/netstandard2.0/msalruntime_arm64.dll
Binary file not shown.
Binary file modified src/lib/netstandard2.0/msalruntime_x86.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion tools/Common.Netcore.Dependencies.targets
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Azure.Core" Version="1.38.0"/>
<PackageReference Include="Azure.Core" Version="1.40.0"/>
</ItemGroup>
<ItemGroup Condition="'$(IsTestProject)' != 'true'">
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.18.0">
Expand Down

0 comments on commit 5a245ca

Please sign in to comment.