1
0
mirror of https://github.com/securego/gosec.git synced 2025-11-29 22:37:59 +02:00

Enable golangcli and improve testing for formatters

This commit is contained in:
Matthieu MOREL
2021-05-10 10:08:04 +02:00
committed by GitHub
parent 4df7f1c3e9
commit 103c429df5
18 changed files with 755 additions and 336 deletions

View File

@@ -5,13 +5,6 @@ import (
"fmt"
)
const (
//URL is the base URL for CWE definitions
URL = "https://cwe.mitre.org/data/definitions/"
//Acronym is the acronym of CWE
Acronym = "CWE"
)
// Weakness defines a CWE weakness based on http://cwe.mitre.org/data/xsd/cwe_schema_v6.4.xsd
type Weakness struct {
ID string
@@ -21,7 +14,7 @@ type Weakness struct {
//SprintURL format the CWE URL
func (w *Weakness) SprintURL() string {
return fmt.Sprintf("%s%s.html", URL, w.ID)
return fmt.Sprintf("https://cwe.mitre.org/data/definitions/%s.html", w.ID)
}
//SprintID format the CWE ID
@@ -39,3 +32,13 @@ func (w *Weakness) MarshalJSON() ([]byte, error) {
URL: w.SprintURL(),
})
}
//InformationURI link to the published CWE PDF
func InformationURI() string {
return fmt.Sprintf("https://cwe.mitre.org/data/published/cwe_v%s.pdf/", Version)
}
//DownloadURI link to the zipped XML of the CWE list
func DownloadURI() string {
return fmt.Sprintf("https://cwe.mitre.org/data/xml/cwec_v%s.xml.zip", Version)
}