Skip to content

Commit 3c24a67

Browse files
authored
User/snamilikonda/codeql sha (#582)
* Update MD5 to SHA256 * Update MD5 to SHA256
1 parent 1ab2d98 commit 3c24a67

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/Microsoft.PowerApps.TestEngine/TestInfra/MicrosoftEntraNetworkMonitor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public async Task LogCookies(string desiredUrl)
105105
private async Task _browserContext_RequestFinished(object sender, IRequest e, string requestUrl)
106106
{
107107
var requestHost = new Uri(e.Url).Host;
108-
var requestHash = CreateMD5(e.Url);
108+
var requestHash = CreateSHA256(e.Url);
109109
// Only listen for login services
110110
if (_loginServices.Any(service => requestHost.Contains(service)) || new Uri(requestUrl).Host == requestHost)
111111
{
@@ -140,12 +140,12 @@ private async Task _browserContext_RequestFinished(object sender, IRequest e, st
140140
}
141141
}
142142

143-
public static string CreateMD5(string input)
143+
public static string CreateSHA256(string input)
144144
{
145-
using (MD5 md5 = MD5.Create())
145+
using (var sha256 = SHA256.Create())
146146
{
147147
byte[] inputBytes = Encoding.ASCII.GetBytes(input);
148-
byte[] hashBytes = md5.ComputeHash(inputBytes);
148+
byte[] hashBytes = sha256.ComputeHash(inputBytes);
149149

150150
// Convert the byte array to a hexadecimal string
151151
StringBuilder sb = new StringBuilder();

src/testengine.module.simulation/SimulateDataverseFunction.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,9 @@ private string GenerateETag(object jsonObject)
384384
string jsonString = JsonConvert.SerializeObject(jsonObject);
385385

386386
// Compute the hash of the JSON string
387-
using (var md5 = MD5.Create())
387+
using (var sha256 = SHA256.Create())
388388
{
389-
byte[] hash = md5.ComputeHash(Encoding.UTF8.GetBytes(jsonString));
389+
byte[] hash = sha256.ComputeHash(Encoding.UTF8.GetBytes(jsonString));
390390
return Convert.ToBase64String(hash);
391391
}
392392
}

0 commit comments

Comments
 (0)