Skip to content

Commit b5ca362

Browse files
Return error for 500 errors from server (AST-000)
1 parent ce7ffa4 commit b5ca362

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ require (
2828
golang.org/x/text v0.22.0
2929
google.golang.org/grpc v1.67.3
3030
google.golang.org/protobuf v1.36.3
31-
gopkg.in/yaml.v2 v2.4.0
3231
gopkg.in/yaml.v3 v3.0.1
3332
gotest.tools v2.2.0+incompatible
3433
)
@@ -286,6 +285,7 @@ require (
286285
gopkg.in/inf.v0 v0.9.1 // indirect
287286
gopkg.in/ini.v1 v1.67.0 // indirect
288287
gopkg.in/warnings.v0 v0.1.2 // indirect
288+
gopkg.in/yaml.v2 v2.4.0 // indirect
289289
helm.sh/helm/v3 v3.17.0 // indirect
290290
k8s.io/api v0.32.0 // indirect
291291
k8s.io/apiextensions-apiserver v0.32.0 // indirect

internal/wrappers/mock/risk-management-mock.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ type RiskManagementMockWrapper struct{}
88

99
func (r *RiskManagementMockWrapper) GetTopVulnerabilitiesByProjectID(projectID string) (*wrappers.ASPMResult, *wrappers.WebError, error) {
1010
mockResults := []wrappers.RiskManagementResult{
11-
{ID: "1", Name: "Vuln1", Severity: "High"},
12-
{ID: "2", Name: "Vuln2", Severity: "Medium"},
11+
{ID: "1", Name: "Vuln1", Severity: "High", Traits: map[string]string{wrappers.ExplPathKey: wrappers.ExplPathValue}},
12+
{ID: "2", Name: "Vuln2", Severity: "Medium", Traits: map[string]string{wrappers.SuspMalwareKey: wrappers.SuspMalwareValue}},
1313
}
1414

1515
mockASPMResult := &wrappers.ASPMResult{

internal/wrappers/risk-management.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ package wrappers
22

33
import "time"
44

5+
const (
6+
SuspMalwareKey = "suspMalware"
7+
ExplPathKey = "explPath"
8+
PubExposedKey = "pubExposed"
9+
RuntimeKey = "runtime"
10+
11+
SuspMalwareValue = "Suspected Malware"
12+
ExplPathValue = "Exploitable Path"
13+
PubExposedValue = "Public Exposed"
14+
RuntimeValue = "Runtime"
15+
)
16+
517
type RiskManagementWrapper interface {
618
GetTopVulnerabilitiesByProjectID(projectID string) (*ASPMResult, *WebError, error)
719
}
@@ -27,6 +39,7 @@ type RiskManagementResult struct {
2739
Severity string `json:"severity"`
2840
RiskScore float64 `json:"riskScore"`
2941
EnrichmentSources map[string]string `json:"enrichmentSources"`
42+
Traits map[string]string `json:"traits"`
3043
CreatedAt time.Time `json:"createdAt"`
3144
ApplicationsScores []ApplicationScore `json:"applicationsScores"`
3245
}

0 commit comments

Comments
 (0)