add JPCERT and USCERT alert dictionary (#740)
* add alert dictionary * fix for sider review * fix for sider review
This commit is contained in:
committed by
Kota Kanbe
parent
8eae5002a3
commit
9d7b115bb5
@@ -20,6 +20,7 @@ package report
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/future-architect/vuls/alert"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -753,6 +754,26 @@ func setChangelogLayout(g *gocui.Gui) error {
|
||||
}
|
||||
}
|
||||
|
||||
if len(vinfo.AlertDict.En) > 0 {
|
||||
lines = append(lines, "\n",
|
||||
"USCERT Alert",
|
||||
"=============",
|
||||
)
|
||||
for _, alert := range vinfo.AlertDict.En {
|
||||
lines = append(lines, fmt.Sprintf("* [%s](%s)", alert.Title, alert.URL))
|
||||
}
|
||||
}
|
||||
|
||||
if config.Conf.Lang == "ja" && len(vinfo.AlertDict.Ja) > 0 {
|
||||
lines = append(lines, "\n",
|
||||
"JPCERT Alert",
|
||||
"=============",
|
||||
)
|
||||
for _, alert := range vinfo.AlertDict.Ja {
|
||||
lines = append(lines, fmt.Sprintf("* [%s](%s)", alert.Title, alert.URL))
|
||||
}
|
||||
}
|
||||
|
||||
if currentScanResult.IsDeepScanMode() {
|
||||
lines = append(lines, "\n",
|
||||
"ChangeLogs",
|
||||
@@ -785,6 +806,7 @@ type dataForTmpl struct {
|
||||
Mitigation string
|
||||
Confidences models.Confidences
|
||||
Cwes []models.CweDictEntry
|
||||
Alerts []alert.Alert
|
||||
Links []string
|
||||
References []models.Reference
|
||||
Packages []string
|
||||
@@ -862,6 +884,17 @@ func detailLines() (string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
alerts := []alert.Alert{}
|
||||
for _, alert := range vinfo.AlertDict.En {
|
||||
alerts = append(alerts, alert)
|
||||
}
|
||||
// Only show JPCERT alert to Japanese users
|
||||
if config.Conf.Lang == "ja" {
|
||||
for _, alert := range vinfo.AlertDict.Ja {
|
||||
alerts = append(alerts, alert)
|
||||
}
|
||||
}
|
||||
|
||||
data := dataForTmpl{
|
||||
CveID: vinfo.CveID,
|
||||
Cvsses: fmt.Sprintf("%s\n", table),
|
||||
@@ -869,6 +902,7 @@ func detailLines() (string, error) {
|
||||
Mitigation: fmt.Sprintf("%s (%s)", mitigation.Value, mitigation.Type),
|
||||
Confidences: vinfo.Confidences,
|
||||
Cwes: cwes,
|
||||
Alerts: alerts,
|
||||
Links: util.Distinct(links),
|
||||
References: refs,
|
||||
}
|
||||
@@ -915,6 +949,11 @@ Confidence
|
||||
{{range $confidence := .Confidences -}}
|
||||
* {{$confidence.DetectionMethod}}
|
||||
{{end}}
|
||||
Alerts
|
||||
-----------
|
||||
{{range .Alerts -}}
|
||||
* [{{.Title}}]({{.URL}})
|
||||
{{end}}
|
||||
References
|
||||
-----------
|
||||
{{range .References -}}
|
||||
|
||||
Reference in New Issue
Block a user