Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Cli/AttackSurfaceAnalyzerClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,6 @@ private static ASA_ERROR RunExportCollectCommand(ExportCollectCommandOptions opt

internal static ASA_ERROR ExportCompareResults(ConcurrentDictionary<(RESULT_TYPE, CHANGE_TYPE), ConcurrentBag<CompareResult>> resultsIn, ExportOptions opts, string baseFileName, string analysesHash, IEnumerable<AsaRule> rules)
{
var results = resultsIn.Select(x => new KeyValuePair<string, object>($"{x.Key.Item1}_{x.Key.Item2}", x.Value)).ToDictionary(x => x.Key, x => x.Value);
if (opts.DisableImplicitFindings)
{
var resultKeys = resultsIn.Keys;
Expand All @@ -724,6 +723,7 @@ internal static ASA_ERROR ExportCompareResults(ConcurrentDictionary<(RESULT_TYPE
resultsIn[key] = newBag;
}
}
var results = resultsIn.Select(x => new KeyValuePair<string, object>($"{x.Key.Item1}_{x.Key.Item2}", x.Value)).ToDictionary(x => x.Key, x => x.Value);
JsonSerializer serializer = JsonSerializer.Create(new JsonSerializerSettings()
{
Formatting = Formatting.Indented,
Expand All @@ -747,10 +747,13 @@ internal static ASA_ERROR ExportCompareResults(ConcurrentDictionary<(RESULT_TYPE
Directory.CreateDirectory(path);
foreach (var key in results.Keys)
{
string filePath = Path.Combine(path, AsaHelpers.MakeValidFileName(key));
string filePath = Path.Combine(path, $"{AsaHelpers.MakeValidFileName(key)}.sarif");
if (opts.OutputSarif)
{
WriteSarifLog(new Dictionary<string, object>() { { key, results[key] } }, rules, filePath, opts.DisableImplicitFindings);
if (key != "metadata")
{
WriteSarifLog(new Dictionary<string, object>() { { "metadata", metadata }, { "results", new Dictionary<string, object>() { { key, results[key] } } } }, rules, filePath, opts.DisableImplicitFindings);
}
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion Lib/Objects/CommandOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public class ExportOptions : CommandOptions
[Option(HelpText = "Set to Disable Analysis.")]
public bool DisableAnalysis { get; set; }

[Option(HelpText = "Exploded output")]
[Option(HelpText = "Output Each Result Type in a Separate File")]
public bool ExplodedOutput { get; set; }

[Option(HelpText = "Directory to output to")]
Expand Down