From a7951b727c02a534a4c2e049773f48bc30b38809 Mon Sep 17 00:00:00 2001 From: Kota Kanbe Date: Sat, 3 Jun 2017 14:08:11 +0900 Subject: [PATCH] Remove commented out code --- .../owasp-dependency-check/parser/parser.go | 2 - models/cvecontents.go | 1 - report/cve_client.go | 7 -- report/report.go | 7 -- report/util.go | 85 ------------------- util/util.go | 18 ---- 6 files changed, 120 deletions(-) diff --git a/contrib/owasp-dependency-check/parser/parser.go b/contrib/owasp-dependency-check/parser/parser.go index b39dec94..90857a09 100644 --- a/contrib/owasp-dependency-check/parser/parser.go +++ b/contrib/owasp-dependency-check/parser/parser.go @@ -58,7 +58,5 @@ func Parse(path string) ([]string, error) { } } } - //TODO remove - // sort.Strings(cpes) return cpes, nil } diff --git a/models/cvecontents.go b/models/cvecontents.go index 573a666e..f86607d2 100644 --- a/models/cvecontents.go +++ b/models/cvecontents.go @@ -131,7 +131,6 @@ func (v CveContents) Cvss2Scores() (values []CveContentCvss) { // MaxCvss2Score returns Max CVSS V2 Score func (v CveContents) MaxCvss2Score() CveContentCvss { - //TODO Severity Ubuntu, Debian... order := []CveContentType{NVD, RedHat, JVN} max := 0.0 value := CveContentCvss{ diff --git a/report/cve_client.go b/report/cve_client.go index fad79470..3178636e 100644 --- a/report/cve_client.go +++ b/report/cve_client.go @@ -127,9 +127,6 @@ func (api cvedictClient) FetchCveDetails(cveIDs []string) (cveDetails cve.CveDet return []cve.CveDetail{}, fmt.Errorf("Failed to fetch CVE. err: %v", errs) } - - //TODO - // sort.Sort(cveDetails) return } @@ -156,10 +153,6 @@ func (api cvedictClient) FetchCveDetailsFromCveDB(cveIDs []string) (cveDetails c cveDetails = append(cveDetails, cveDetail) } } - - //TODO - // order by CVE ID desc - // sort.Sort(cveDetails) return } diff --git a/report/report.go b/report/report.go index 1b05770c..7cdefdf9 100644 --- a/report/report.go +++ b/report/report.go @@ -136,13 +136,6 @@ func fillCveDetail(r *models.ScanResult) error { } } } - //TODO Remove - // sort.Slice(r.ScannedCves, func(i, j int) bool { - // if r.ScannedCves[j].CveContents.CvssV2Score() == r.ScannedCves[i].CveContents.CvssV2Score() { - // return r.ScannedCves[j].CveContents.CvssV2Score() < r.ScannedCves[i].CveContents.CvssV2Score() - // } - // return r.ScannedCves[j].CveContents.CvssV2Score() < r.ScannedCves[i].CveContents.CvssV2Score() - // }) return nil } diff --git a/report/util.go b/report/util.go index 7f898f84..e0bf2399 100644 --- a/report/util.go +++ b/report/util.go @@ -237,91 +237,6 @@ func formatFullPlainText(r models.ScanResult) string { return fmt.Sprintf("%s\n%s", header, table) } -// type distroLink struct { -// title string -// url string -// } - -// distroLinks add Vendor URL of the CVE to table -// func distroLinks(cveInfo models.CveInfo, osFamily string) []distroLink { -// cveID := cveInfo.VulnInfo.CveID -// switch osFamily { -// case "rhel", "centos": -// links := []distroLink{ -// { -// "RHEL-CVE", -// fmt.Sprintf("%s/%s", redhatSecurityBaseURL, cveID), -// }, -// } -// for _, advisory := range cveInfo.DistroAdvisories { -// aidURL := strings.Replace(advisory.AdvisoryID, ":", "-", -1) -// links = append(links, distroLink{ -// // "RHEL-errata", -// advisory.AdvisoryID, -// fmt.Sprintf(redhatRHSABaseBaseURL, aidURL), -// }) -// } -// return links -// case "oraclelinux": -// links := []distroLink{ -// { -// "Oracle-CVE", -// fmt.Sprintf(oracleSecurityBaseURL, cveID), -// }, -// } -// for _, advisory := range cveInfo.DistroAdvisories { -// links = append(links, distroLink{ -// // "Oracle-ELSA" -// advisory.AdvisoryID, -// fmt.Sprintf(oracleELSABaseBaseURL, advisory.AdvisoryID), -// }) -// } -// return links -// case "amazon": -// links := []distroLink{ -// { -// "RHEL-CVE", -// fmt.Sprintf("%s/%s", redhatSecurityBaseURL, cveID), -// }, -// } -// for _, advisory := range cveInfo.DistroAdvisories { -// links = append(links, distroLink{ -// // "Amazon-ALAS", -// advisory.AdvisoryID, -// fmt.Sprintf(amazonSecurityBaseURL, advisory.AdvisoryID), -// }) -// } -// return links -// case "ubuntu": -// return []distroLink{ -// { -// "Ubuntu-CVE", -// fmt.Sprintf("%s/%s", ubuntuSecurityBaseURL, cveID), -// }, -// //TODO Ubuntu USN -// } -// case "debian": -// return []distroLink{ -// { -// "Debian-CVE", -// fmt.Sprintf("%s/%s", debianTrackerBaseURL, cveID), -// }, -// // TODO Debian dsa -// } -// case "FreeBSD": -// links := []distroLink{} -// for _, advisory := range cveInfo.DistroAdvisories { -// links = append(links, distroLink{ -// "FreeBSD-VuXML", -// fmt.Sprintf(freeBSDVuXMLBaseURL, advisory.AdvisoryID), -// }) -// } -// return links -// default: -// return []distroLink{} -// } -// } - func cweURL(cweID string) string { return fmt.Sprintf("https://cwe.mitre.org/data/definitions/%s.html", strings.TrimPrefix(cweID, "CWE-")) diff --git a/util/util.go b/util/util.go index b5707bac..da888b2c 100644 --- a/util/util.go +++ b/util/util.go @@ -147,21 +147,3 @@ func Distinct(ss []string) (distincted []string) { } return } - -// VendorLink returns a URL of the given OS family and CVEID -//TODO -// func VendorLink(family, cveID string) string { -// cType := models.NewCveContentType(family) -// switch cType { -// case models.RedHat: -// return "https://access.redhat.com/security/cve/" + cveID -// case models.Debian: -// return "https://security-tracker.debian.org/tracker/" + cveID -// case models.Ubuntu: -// return "http://people.ubuntu.com/~ubuntu-security/cve/" + cveID -// // case models.FreeBSD: -// // return "http://people.ubuntu.com/~ubuntu-security/cve/" + cveID -// } - -// return "" -// }