Skip to content

Commit

Permalink
SarifLogger now emits an artifacts table entry if `artifactLocation…
Browse files Browse the repository at this point in the history
…` is not null for tool configuration and tool execution notifications. (#2437)

* Fixing artifacts generation when logging notifications

* Updating release history.

* Updating ReleaseHistory
  • Loading branch information
eddynaka authored Feb 1, 2022
1 parent 6263379 commit 51b3eec
Show file tree
Hide file tree
Showing 3 changed files with 186 additions and 193 deletions.
1 change: 1 addition & 0 deletions src/ReleaseHistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* BREAKING: `AnalyzeCommandBase` previously persisted all scan target artifacts to SARIF logs rather than only persisting artifacts referenced by an analysis result, when an option to persist hashes, text file or binary information was set. `MultithreadedAnalyzeCommandBase` previously persisted all scan targets artifacts to SARIF logs in cases when hash insertion was eenabled rather than only persisting artifacts referenced by an analysis result. [#2433](https://github.com/microsoft/sarif-sdk/pull/2433)
* BUGFIX: Adjust Json Serialization field order for ReportingDescriptor and skip emit empty AutomationDetails node. [#2420](https://github.com/microsoft/sarif-sdk/pull/2420)
* BREAKING: Fix `InvalidOperationException` when using PropertiesDictionary in a multithreaded application, and remove `[Serializable]` from it. Now use of BinaryFormatter on it will result in `SerializationException`: Type `PropertiesDictionary` is not marked as serializable. [#2415](https://github.com/microsoft/sarif-sdk/pull/2415)
* BREAKING: `SarifLogger` now emits an artifacts table entry if `artifactLocation` is not null for tool configuration and tool execution notifications. [#2437](https://github.com/microsoft/sarif-sdk/pull/2437)

## **v2.4.12** [Sdk](https://www.nuget.org/packages/Sarif.Sdk/2.4.12) | [Driver](https://www.nuget.org/packages/Sarif.Driver/2.4.12) | [Converters](https://www.nuget.org/packages/Sarif.Converters/2.4.12) | [Multitool](https://www.nuget.org/packages/Sarif.Multitool/2.4.12) | [Multitool Library](https://www.nuget.org/packages/Sarif.Multitool.Library/2.4.12)

Expand Down
18 changes: 18 additions & 0 deletions src/Sarif/Writers/SarifLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,8 @@ public void LogToolNotification(Notification notification)
_run.Invocations[0].ToolExecutionNotifications = _run.Invocations[0].ToolExecutionNotifications ?? new List<Notification>();
_run.Invocations[0].ToolExecutionNotifications.Add(notification);
_run.Invocations[0].ExecutionSuccessful &= notification.Level != FailureLevel.Error;

CaptureFilesInNotification(notification);
}

public void LogConfigurationNotification(Notification notification)
Expand All @@ -493,6 +495,22 @@ public void LogConfigurationNotification(Notification notification)
_run.Invocations[0].ToolConfigurationNotifications = _run.Invocations[0].ToolConfigurationNotifications ?? new List<Notification>();
_run.Invocations[0].ToolConfigurationNotifications.Add(notification);
_run.Invocations[0].ExecutionSuccessful &= notification.Level != FailureLevel.Error;

CaptureFilesInNotification(notification);
}

private void CaptureFilesInNotification(Notification notification)
{
if (notification.Locations != null)
{
foreach (Location location in notification.Locations)
{
if (location.PhysicalLocation != null)
{
CaptureArtifact(location.PhysicalLocation.ArtifactLocation);
}
}
}
}

private static string Redact(string text, IEnumerable<string> tokensToRedact)
Expand Down
Loading

0 comments on commit 51b3eec

Please sign in to comment.