Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: right fields on SARIF output #149

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Changes from all commits
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
10 changes: 5 additions & 5 deletions reporting/sarif.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ func hasNoResults(report Report) bool {
return len(report.Results) == 0
}

func messageText(secret Secret) string {
return fmt.Sprintf("%s has detected secret for file %s.", secret.Source, secret.ID)
func messageText(ruleName string, filePath string) string {
return fmt.Sprintf("%s has detected secret for file %s.", ruleName, filePath)
}

func getResults(report Report) []Results {
Expand All @@ -64,9 +64,9 @@ func getResults(report Report) []Results {
for _, secret := range secrets {
r := Results{
Message: Message{
Text: messageText(secret),
Text: messageText(secret.ID, secret.Source),
},
RuleId: secret.Source,
RuleId: secret.ID,
Locations: getLocation(secret),
}
results = append(results, r)
Expand All @@ -80,7 +80,7 @@ func getLocation(secret Secret) []Locations {
{
PhysicalLocation: PhysicalLocation{
ArtifactLocation: ArtifactLocation{
URI: secret.ID,
URI: secret.Source,
},
Region: Region{
StartLine: secret.StartLine,
Expand Down