Skip to content

Commit

Permalink
Merge branch 'master' into kics-987
Browse files Browse the repository at this point in the history
  • Loading branch information
asofsilva authored Feb 21, 2024
2 parents 937d5f2 + 3eba9f6 commit ebf8420
Show file tree
Hide file tree
Showing 46 changed files with 684 additions and 9,243 deletions.
3 changes: 3 additions & 0 deletions e2e/fixtures/schemas/result-asff.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@
}
}
},
"CWE":{
"type":"string"
},
"Title": {
"type": "string",
"minLength": 1
Expand Down
4 changes: 4 additions & 0 deletions e2e/fixtures/schemas/result-codeclimate.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
"type": "string",
"minLength": 1
},
"cwe":{
"type": "string",
"minimum": 0
},
"description": {
"type": "string",
"minLength": 1
Expand Down
6 changes: 5 additions & 1 deletion e2e/fixtures/schemas/result-csv.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"items": {
"type": "object",
"additionalProperties": false,
"additionalProperties": true,
"required": [
"QueryName",
"QueryID",
Expand Down Expand Up @@ -94,6 +94,10 @@
"Terraform"
]
},
"CWE": {
"type": "string",
"minLength": 0
},
"CloudProvider": {
"type": "string",
"minLength": 1
Expand Down
4 changes: 4 additions & 0 deletions e2e/fixtures/schemas/result-cyclonedx.json
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@
}
}
}
},
"CWE": {
"type": "string",
"minLength": 0
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions e2e/fixtures/schemas/result-gl-sast.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@
"minLength": 1,
"maxLength": 255
},
"cwe":{
"type": "string",
"minLength": 0
},
"links": {
"type": "array",
"items": {
Expand Down
4 changes: 4 additions & 0 deletions e2e/fixtures/schemas/result-junit.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@
}
}
}
},
"CWE":{
"type": "string",
"minLength": 0
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions e2e/fixtures/schemas/result-sonarqube.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
"CRITICAL"
]
},
"cwe": {
"type": "string",
"minLength": 0
},
"type": {
"type": "string",
"enum": [
Expand Down
4 changes: 4 additions & 0 deletions e2e/fixtures/schemas/result.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@
"Terraform"
]
},
"cwe": {
"type": "string",
"minLength": 0
},
"files": {
"type": "array",
"items": {
Expand Down
34 changes: 18 additions & 16 deletions e2e/utils/csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,33 @@ func CSVToJSON(t *testing.T, filename string) []byte {
var csvItems []csvSchema

for _, row := range csvData[1:] {
line, lineErr := strconv.Atoi(row[14])
line, lineErr := strconv.Atoi(row[15])
require.NoError(t, lineErr, "Error when converting CSV: %s", fullPath)
searchLine, searchErr := strconv.Atoi(row[17])
searchLine, searchErr := strconv.Atoi(row[18])
require.NoError(t, searchErr, "Error when converting CSV: %s", fullPath)

csvStruct.QueryName = row[0]
csvStruct.QueryID = row[1]
csvStruct.QueryURI = row[2]
csvStruct.Severity = row[3]
csvStruct.Platform = row[4]
csvStruct.CloudProvider = row[5]
csvStruct.Category = row[6]
csvStruct.DescriptionID = row[7]
csvStruct.Description = row[8]
csvStruct.CISDescriptionIDFormatted = row[9]
csvStruct.CISDescriptionTitle = row[10]
csvStruct.CISDescriptionTextFormatted = row[11]
csvStruct.FileName = row[12]
csvStruct.SimilarityID = row[13]
csvStruct.Cwe = row[5]
csvStruct.CloudProvider = row[6]
csvStruct.Category = row[7]
csvStruct.DescriptionID = row[8]
csvStruct.Description = row[9]
csvStruct.CISDescriptionIDFormatted = row[10]
csvStruct.CISDescriptionTitle = row[11]
csvStruct.CISDescriptionTextFormatted = row[12]
csvStruct.FileName = row[13]
csvStruct.SimilarityID = row[14]
csvStruct.Line = line
csvStruct.IssueType = row[15]
csvStruct.SearchKey = row[16]
csvStruct.IssueType = row[16]
csvStruct.SearchKey = row[17]
csvStruct.SearchLine = searchLine
csvStruct.SearchValue = row[18]
csvStruct.ExpectedValue = row[19]
csvStruct.ActualValue = row[20]
csvStruct.SearchValue = row[19]
csvStruct.ExpectedValue = row[20]
csvStruct.ActualValue = row[21]
csvItems = append(csvItems, csvStruct)
}

Expand All @@ -73,6 +74,7 @@ type csvSchema struct {
QueryURI string
Severity string
Platform string
Cwe string
CloudProvider string
Category string
DescriptionID string
Expand Down
1 change: 1 addition & 0 deletions e2e/utils/xml.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type CycloneSchema struct {
Vulnerabilities []struct {
Ref string `xml:"ref,attr"`
ID string `xml:"id"`
CWE string `xml:"cwe"`
Source struct {
Name string `xml:"name"`
URL string `xml:"url"`
Expand Down
Loading

0 comments on commit ebf8420

Please sign in to comment.