Skip to content

Commit

Permalink
HdfConverter: Add location, address GitHub validation error (#2694)
Browse files Browse the repository at this point in the history
Per https://sarifweb.azurewebsites.net/Validation
> Each result location must provide the property 'physicalLocation.artifactLocation.uri'.
> GitHub Advanced Security code scanning will not display a result whose location does not provide the URI of the artifact that contains the result.

Signed-off-by: Craig Andrews <[email protected]>
  • Loading branch information
candrews committed Jul 24, 2023
1 parent 5b72930 commit b464653
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/Sarif.Converters/HdfConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ public override void Convert(Stream input, IResultLogWriter output, OptionallyEm
SupportedTaxonomies = new List<ToolComponentReference>() { new ToolComponentReference() { Name = "NIST SP800-53 v5", Guid = Guid.Parse("AAFBAB93-5201-419E-8443-D4925C542398") } }
}
},
OriginalUriBaseIds = new Dictionary<string, ArtifactLocation>()
{
{
"ROOTPATH", new ArtifactLocation {
Uri = new Uri("file:///")
}
}
},
ExternalPropertyFileReferences = new ExternalPropertyFileReferences()
{
Taxonomies = new List<ExternalPropertyFileReference>()
Expand Down Expand Up @@ -141,6 +149,26 @@ private static (ReportingDescriptor, IList<Result>) SarifRuleAndResultFromHdfCon
Kind = kind,
Level = level,
Rank = rank,
Locations = new List<Location>
{
new Location {
PhysicalLocation = new PhysicalLocation
{
ArtifactLocation = new ArtifactLocation
{
Uri = new Uri(".", UriKind.Relative),
UriBaseId = "ROOTPATH",
},
Region = new Region
{
StartLine = 1,
StartColumn = 1,
EndLine = 1,
EndColumn = 1,
}
}
}
}
};
results.Add(result);
}
Expand Down

0 comments on commit b464653

Please sign in to comment.