Skip to content

Commit

Permalink
New Build 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DanMolz committed Jan 7, 2025
1 parent 6ae4814 commit 0900f5e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions internal/collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ func buildDataSource(cloudPlatform, providerID string, finding semgrep.Finding)
LineNumbers: fmt.Sprintf("%d-%d", finding.Location.Line, finding.Location.Column),
},
ID: fmt.Sprint(finding.ID),
Name: splitRuleName(finding.RuleName),
Name: splitCWEName(finding.Rule.CWE[0]),
DetailedName: splitRuleName(finding.Rule.Name),
Severity: utils.CapitalizeFirstChar(finding.Severity),
ExternalFindingLink: finding.LineOfCodeURL,
Source: "Semgrep",
Expand All @@ -297,10 +298,25 @@ func getCloudPlatformAndProviderId(finding semgrep.Finding) (string, string) {
return "GitLab", fmt.Sprintf("gitlab.com##%s##%s", finding.Repository.Name, strings.Split(finding.Ref, "refs/heads/")[1])
}

func splitCWEName(input string) string {
// Find the last occurrence of a colon (:)
if lastColonIndex := strings.LastIndex(input, ":"); lastColonIndex != -1 {
// Return the substring before the last colon
result := input[:lastColonIndex]
return result
}
// If no colon is found, return the whole input
return input
}

func splitRuleName(input string) string {
// Find the last occurrence of a dot (.)
if lastDotIndex := strings.LastIndex(input, "."); lastDotIndex != -1 {
return input[:lastDotIndex]
// Return the substring after the last dot
result := input[lastDotIndex+1:]
return result
}
// If no dot is found, return the whole input
return input
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/dev.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.0
1.5.0

0 comments on commit 0900f5e

Please sign in to comment.