Skip to content

Commit acb21da

Browse files
authored
Update Dependencies (#705)
* Fix CodeQL Issues * Update dependencies * Small cleanup
1 parent 2fddf88 commit acb21da

9 files changed

+53
-40
lines changed

Benchmarks/Benchmarks.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="BenchmarkDotNet" Version="0.13.5" />
13-
<PackageReference Include="System.Data.SQLite" Version="1.0.117" />
12+
<PackageReference Include="BenchmarkDotNet" Version="0.13.9" />
13+
<PackageReference Include="System.Data.SQLite" Version="1.0.118" />
1414
<PackageReference Include="murmurhash" Version="1.0.3" />
1515
</ItemGroup>
1616

Benchmarks/InsertTestsWithIntermittentTransactions.cs

-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ public InsertTestsWithIntermittentTransactions()
4646
[Params(0)]
4747
public int StartingSize { get; set; }
4848

49-
// Bag of reusable objects to write to the database.
50-
5149
public static void Insert_X_Objects(int X, int ObjectPadding = 0, string runName = "Insert_X_Objects")
5250
{
5351
dbManager.BeginTransaction();

Cli/AttackSurfaceAnalyzerClient.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ private static ASA_ERROR RunExportCollectCommand(ExportCollectCommandOptions opt
673673
foreach (RESULT_TYPE resultType in Enum.GetValues(typeof(RESULT_TYPE)))
674674
{
675675
var resultsForType =
676-
DatabaseManager.GetComparisonResults(opts.FirstRunId, opts.SecondRunId, analysesHash,
676+
DatabaseManager.GetComparisonResults(opts.FirstRunId ?? string.Empty, opts.SecondRunId, analysesHash,
677677
resultType);
678678
foreach (var result in resultsForType)
679679
{

Cli/Cli.csproj

+6-6
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737
</ItemGroup>
3838

3939
<ItemGroup>
40-
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.6.0" />
41-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.6.0" />
42-
<PackageReference Include="Microsoft.CST.OAT.Blazor.Components" Version="1.2.45" />
43-
<PackageReference Include="Microsoft.CST.OAT.Scripting" Version="1.2.45" />
44-
<PackageReference Include="Sarif.Sdk" Version="4.1.0" />
45-
<PackageReference Include="Tewr.Blazor.FileReader" Version="3.3.1.21360" />
40+
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.7.0" />
41+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" />
42+
<PackageReference Include="Microsoft.CST.OAT.Blazor.Components" Version="1.2.54" />
43+
<PackageReference Include="Microsoft.CST.OAT.Scripting" Version="1.2.54" />
44+
<PackageReference Include="Sarif.Sdk" Version="4.3.4" />
45+
<PackageReference Include="Tewr.Blazor.FileReader" Version="3.3.2.23201" />
4646
</ItemGroup>
4747
</Project>

Lib/Collectors/RegistryMonitor.cs

+27-14
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ public class RegistryMonitor : BaseMonitor, IDisposable
1212
{
1313
public RegistryMonitor()
1414
{
15+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
16+
{
17+
log = new("System");
18+
}
1519
}
1620

1721
public override bool CanRunOnPlatform()
@@ -43,15 +47,18 @@ public override void StartRun()
4347
{
4448
throw new PlatformNotSupportedException("ExecuteWindows is only supported on Windows platforms.");
4549
}
46-
// backup the current auditpolicy
47-
ExternalCommandRunner.RunExternalCommand("auditpol", $"/backup /file:{tmpFileName}");
50+
if (log is { })
51+
{
52+
// backup the current auditpolicy
53+
ExternalCommandRunner.RunExternalCommand("auditpol", $"/backup /file:{tmpFileName}");
4854

49-
// start listening to the event log
50-
log.EntryWritten += new EntryWrittenEventHandler(MyOnEntryWritten);
51-
log.EnableRaisingEvents = true;
55+
// start listening to the event log
56+
log.EntryWritten += new EntryWrittenEventHandler(MyOnEntryWritten);
57+
log.EnableRaisingEvents = true;
5258

53-
// Enable auditing for registry events GUID for Registry subcategory of audit policy https://msdn.microsoft.com/en-us/library/dd973928.aspx
54-
ExternalCommandRunner.RunExternalCommand("auditpol", "/set /subcategory:{0CCE921E-69AE-11D9-BED3-505054503030} /success:enable /failure:enable");
59+
// Enable auditing for registry events GUID for Registry subcategory of audit policy https://msdn.microsoft.com/en-us/library/dd973928.aspx
60+
ExternalCommandRunner.RunExternalCommand("auditpol", "/set /subcategory:{0CCE921E-69AE-11D9-BED3-505054503030} /success:enable /failure:enable");
61+
}
5562
}
5663

5764
public override void StopRun()
@@ -60,24 +67,30 @@ public override void StopRun()
6067
{
6168
throw new PlatformNotSupportedException("ExecuteWindows is only supported on Windows platforms.");
6269
}
63-
// restore the old auditpolicy
64-
ExternalCommandRunner.RunExternalCommand("auditpol", $"/restore /file:{tmpFileName}");
70+
if (log is { })
71+
{
72+
// restore the old auditpolicy
73+
ExternalCommandRunner.RunExternalCommand("auditpol", $"/restore /file:{tmpFileName}");
6574

66-
//delete temporary file
67-
ExternalCommandRunner.RunExternalCommand("del", tmpFileName);
75+
//delete temporary file
76+
ExternalCommandRunner.RunExternalCommand("del", tmpFileName);
6877

69-
log.EnableRaisingEvents = false;
78+
log.EnableRaisingEvents = false;
79+
}
7080
}
7181

7282
protected virtual void Dispose(bool disposing)
7383
{
7484
if (disposing)
7585
{
76-
log.Dispose();
86+
if (log is { })
87+
{
88+
log.Dispose();
89+
}
7790
}
7891
}
7992

80-
private readonly EventLog log = new("System");
93+
private readonly EventLog? log;
8194

8295
private readonly string tmpFileName = Path.GetTempFileName();
8396
}

Lib/Lib.csproj

+9-9
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,20 @@
3535

3636
<ItemGroup>
3737
<PackageReference Include="MedallionShell" Version="1.6.2" />
38-
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.6.0" />
39-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.6.0" />
40-
<PackageReference Include="Microsoft.CST.OAT" Version="1.2.45" />
41-
<PackageReference Include="Microsoft.CST.RecursiveExtractor" Version="1.2.13" />
38+
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.7.0" />
39+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.7.0" />
40+
<PackageReference Include="Microsoft.CST.OAT" Version="1.2.54" />
41+
<PackageReference Include="Microsoft.CST.RecursiveExtractor" Version="1.2.20" />
4242
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
43-
<PackageReference Include="Microsoft.Data.Sqlite" Version="7.0.5" />
43+
<PackageReference Include="Microsoft.Data.Sqlite" Version="7.0.12" />
4444
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
45-
<PackageReference Include="Microsoft.Windows.Compatibility" Version="7.0.1" />
45+
<PackageReference Include="Microsoft.Windows.Compatibility" Version="7.0.5" />
4646
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
47-
<PackageReference Include="Serilog" Version="2.12.0" />
47+
<PackageReference Include="Serilog" Version="3.0.1" />
4848
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
4949
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
5050
<PackageReference Include="System.Diagnostics.Process" Version="4.3.0" />
51-
<PackageReference Include="System.Management" Version="7.0.1" />
51+
<PackageReference Include="System.Management" Version="7.0.2" />
5252
<PackageReference Include="System.Net.NetworkInformation" Version="4.3.0" />
5353
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
5454
<PackageReference Include="Microsoft.Win32.Registry.AccessControl" Version="7.0.0" />
@@ -61,7 +61,7 @@
6161
<PackageReference Include="CommandLineParser" Version="2.9.1" />
6262
<PackageReference Include="sqlite" Version="3.13.0" />
6363
<PackageReference Include="Microsoft.TSS" Version="2.1.1" />
64-
<PackageReference Include="PeNet" Version="3.0.0" />
64+
<PackageReference Include="PeNet" Version="4.0.2" />
6565
</ItemGroup>
6666
<ItemGroup>
6767
<EmbeddedResource Include="..\analyses.json" Link="analyses.json" />

Lib/Utils/SqliteDatabaseManager.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ public override void InsertRun(AsaRun run)
799799
}
800800
catch (SqliteException e)
801801
{
802-
Log.Warning(e.StackTrace);
802+
Log.Warning(e.StackTrace ?? string.Empty);
803803
Log.Warning(e.Message);
804804
}
805805
}

Tests/DiffTests.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
using System.Linq;
33
using Microsoft.CST.AttackSurfaceAnalyzer.Collectors;
44
using Microsoft.CST.AttackSurfaceAnalyzer.Objects;
5-
using Microsoft.CST.AttackSurfaceAnalyzer.Types;
65
using Microsoft.VisualStudio.TestTools.UnitTesting;
76
using Microsoft.Win32;
87

9-
namespace Tests;
8+
namespace Microsoft.CST.AttackSurfaceAnalyzer.Tests;
109

10+
/// <summary>
11+
/// Test that the compare logic generates the correct diffs for various object configurations
12+
/// </summary>
1113
[TestClass]
1214
public class DiffTests
1315
{

Tests/Tests.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
</ItemGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0" />
17-
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
18-
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
16+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
17+
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
18+
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
1919
</ItemGroup>
2020

2121
<ItemGroup>

0 commit comments

Comments
 (0)