Skip to content

Commit

Permalink
correct link for results (#622)
Browse files Browse the repository at this point in the history
* correct link for results

* fixing linter

* correct build of constant

* fix urls

* updating links and identifiers

---------

Co-authored-by: Pedro Lopes <[email protected]>
  • Loading branch information
tiagobcx and pedrompflopes authored Nov 28, 2023
1 parent 394630b commit 8f085fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
18 changes: 8 additions & 10 deletions internal/commands/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -985,8 +985,7 @@ func exportGlSastResults(targetFile string, results *wrappers.ScanResultsCollect
if err != nil {
return errors.Wrapf(err, "%s: failed to add scan to gl sast report", failedListingResults)
}
convertCxResultToGlVulnerability(results, glSast)

convertCxResultToGlVulnerability(results, glSast, summary.BaseURI)
resultsJSON, err := json.Marshal(glSast)
if err != nil {
return errors.Wrapf(err, "%s: failed to serialize gl sast report ", failedListingResults)
Expand All @@ -1006,7 +1005,7 @@ func addScanToGlSastReport(summary *wrappers.ResultSummary, glSast *wrappers.GlS
}

glSast.Scan = wrappers.ScanGlReport{}
glSast.Schema = "https://gitlab.com/gitlab-org/gitlab/-/raw/master/lib/gitlab/ci/parsers/security/validators/schemas/15.0.0/sast-report-format.jsonn"
glSast.Schema = "https://gitlab.com/gitlab-org/gitlab/-/raw/master/lib/gitlab/ci/parsers/security/validators/schemas/15.0.0/sast-report-format.json"
glSast.Version = "15.0.0"
glSast.Scan.Analyzer.URL = wrappers.AnalyzerURL
glSast.Scan.Analyzer.Name = wrappers.VendorName
Expand Down Expand Up @@ -1252,15 +1251,15 @@ func convertCxResultsToSarif(results *wrappers.ScanResultsCollection) *wrappers.
return sarif
}

func convertCxResultToGlVulnerability(results *wrappers.ScanResultsCollection, glSast *wrappers.GlSastResultsCollection) {
func convertCxResultToGlVulnerability(results *wrappers.ScanResultsCollection, glSast *wrappers.GlSastResultsCollection, summaryBaseURI string) {
for _, result := range results.Results {
if strings.TrimSpace(result.Type) == commonParams.SastType {
glSast = parseGlSastVulnerability(result, glSast)
glSast = parseGlSastVulnerability(result, glSast, summaryBaseURI)
}
}
}

func parseGlSastVulnerability(result *wrappers.ScanResult, glSast *wrappers.GlSastResultsCollection) *wrappers.GlSastResultsCollection {
func parseGlSastVulnerability(result *wrappers.ScanResult, glSast *wrappers.GlSastResultsCollection, summaryBaseURI string) *wrappers.GlSastResultsCollection {
queryName := result.ScanResultData.QueryName
fileName := result.ScanResultData.Nodes[0].FileName
lineNumber := strconv.FormatUint(uint64(result.ScanResultData.Nodes[0].Line), 10)
Expand All @@ -1287,9 +1286,9 @@ func parseGlSastVulnerability(result *wrappers.ScanResult, glSast *wrappers.GlSa
},
Identifiers: []wrappers.Identifier{
{
Type: "similarityId",
Name: "Similarity Id ",
URL: wrappers.AnalyzerURL,
Type: "cxOneScan",
Name: "CxOne Scan",
URL: summaryBaseURI,
Value: result.ID,
},
},
Expand All @@ -1310,7 +1309,6 @@ func parseGlSastVulnerability(result *wrappers.ScanResult, glSast *wrappers.GlSa
File: fileName,
StartLine: startLine,
EndLine: endLine,
Class: fileName,
},
})
return glSast
Expand Down
2 changes: 1 addition & 1 deletion internal/wrappers/results-gl-sast.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package wrappers
const (
AnalyzerName = "CxOne"
AnalyzerID = AnalyzerName + "-SAST"
AnalyzerURL = "https://checkmarx.company.com/"
AnalyzerURL = "https://checkmarx.com/"
VendorName = "Checkmarx"
)

Expand Down

0 comments on commit 8f085fa

Please sign in to comment.