Skip to content

Commit

Permalink
Add vulnerability namespace in vulnerability report
Browse files Browse the repository at this point in the history
  • Loading branch information
ramanan-ravi committed Aug 7, 2024
1 parent 2bb73bf commit d89caea
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ require (
github.com/Jeffail/tunny v0.1.4
github.com/aws/aws-sdk-go v1.49.16
github.com/deepfence/agent-plugins-grpc v0.0.0-00010101000000-000000000000
github.com/deepfence/golang_deepfence_sdk/client v0.0.0-20231201173641-092afefd00a2
github.com/deepfence/golang_deepfence_sdk/utils v0.0.0-20231201173641-092afefd00a2
github.com/deepfence/golang_deepfence_sdk/client v0.0.0-20240807105002-4943c14781c5
github.com/deepfence/golang_deepfence_sdk/utils v0.0.0-20240807105002-4943c14781c5
github.com/deepfence/vessel v0.12.3
github.com/gin-gonic/gin v1.9.1
github.com/google/uuid v1.6.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ github.com/containerd/typeurl/v2 v2.1.1/go.mod h1:IDp2JFvbwZ31H8dQbEIY7sDl2L3o3H
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/deepfence/golang_deepfence_sdk/client v0.0.0-20231201173641-092afefd00a2 h1:yJYaf8azyF43KJiXp75IZBS7uYsQIg/FgzhNir8EMKw=
github.com/deepfence/golang_deepfence_sdk/client v0.0.0-20231201173641-092afefd00a2/go.mod h1:+rchMc4YNjCoHo0YAwKsT+DRBNr1hdDG0WrvAOOCc5k=
github.com/deepfence/golang_deepfence_sdk/utils v0.0.0-20231201173641-092afefd00a2 h1:b7PmvEUzF2b+XJ5XxZJNt+gkInw85cxryfoOfCkLL3c=
github.com/deepfence/golang_deepfence_sdk/utils v0.0.0-20231201173641-092afefd00a2/go.mod h1:jHS6Adf3VrxnKZZ3RY10BirtFlwWj99Zd4JBAhP9SqM=
github.com/deepfence/golang_deepfence_sdk/client v0.0.0-20240807105002-4943c14781c5 h1:Cn15C8hpx1ibMEx7ReitFQUQw1g3X5s3dfKG4AsX5Us=
github.com/deepfence/golang_deepfence_sdk/client v0.0.0-20240807105002-4943c14781c5/go.mod h1:+rchMc4YNjCoHo0YAwKsT+DRBNr1hdDG0WrvAOOCc5k=
github.com/deepfence/golang_deepfence_sdk/utils v0.0.0-20240807105002-4943c14781c5 h1:AfmfkTBWHHdSRj4FzYJEv48Lm8JSDzfsxhehPT5whiI=
github.com/deepfence/golang_deepfence_sdk/utils v0.0.0-20240807105002-4943c14781c5/go.mod h1:jHS6Adf3VrxnKZZ3RY10BirtFlwWj99Zd4JBAhP9SqM=
github.com/deepfence/vessel v0.12.3 h1:C34t+sV+JoFdfYhg+uyS+YOEDAFIYjBKHShD3emDISA=
github.com/deepfence/vessel v0.12.3/go.mod h1:bY97YUKMm0Oxasz/9o7Te60FjWCQWUYpgiWNC1E00xo=
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
Expand Down
1 change: 1 addition & 0 deletions output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ func (p *Publisher) SendScanResultToConsole(vulnerabilities []scanner.Vulnerabil
n.SetInitExploitabilityScore(int32(v.InitExploitabilityScore))
n.SetParsedAttackVector(v.ParsedAttackVector)
n.SetUrls(v.URLs)
n.SetNamespace(v.Namespace)

data = append(data, *n)
}
Expand Down
2 changes: 1 addition & 1 deletion scanner/grype/grype.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ func PopulateFinalReport(vulnerabilities []byte, cfg utils.Config) ([]scanner.Vu
metasploitURL, urls := utils.ExtractExploitPocURL(match.Vulnerability.URLs)

report := scanner.VulnerabilityScanReport{
Type: "cve",
Masked: utils.Contains(maskCveIds, match.Vulnerability.ID),
ScanID: cfg.ScanID,
CveID: match.Vulnerability.ID,
Expand All @@ -124,6 +123,7 @@ func PopulateFinalReport(vulnerabilities []byte, cfg utils.Config) ([]scanner.Vu
URLs: urls,
ExploitPOC: metasploitURL,
ParsedAttackVector: "",
Namespace: match.Vulnerability.Namespace,
}

if report.CveType == "base" {
Expand Down
5 changes: 1 addition & 4 deletions scanner/types.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
package scanner

type VulnerabilityScanReport struct {
Type string `json:"type"`
Masked bool `json:"masked"`
ScanID string `json:"scan_id"`
CveID string `json:"cve_id"`
CveType string `json:"cve_type"`
CveContainerImage string `json:"cve_container_image"`
CveContainerImageID string `json:"cve_container_image_id"`
CveContainerName string `json:"cve_container_name"`
CveSeverity string `json:"cve_severity"`
CveCausedByPackage string `json:"cve_caused_by_package"`
CveCausedByPackagePath string `json:"cve_caused_by_package_path"`
CveContainerLayer string `json:"cve_container_layer"`
CveFixedIn string `json:"cve_fixed_in"`
CveLink string `json:"cve_link"`
Namespace string `json:"namespace"`
CveDescription string `json:"cve_description"`
CveCvssScore float64 `json:"cve_cvss_score"`
CveOverallScore float64 `json:"cve_overall_score"`
Expand Down

0 comments on commit d89caea

Please sign in to comment.