Skip to content

Commit

Permalink
chore(report): remove stride and hipchat support (#1104)
Browse files Browse the repository at this point in the history
  • Loading branch information
kotakanbe committed Dec 25, 2020
1 parent a33cff8 commit 83d1f80
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 261 deletions.
67 changes: 1 addition & 66 deletions config/config.go
Expand Up @@ -126,16 +126,12 @@ type Config struct {
Syslog SyslogConf `json:"-"`
AWS AWS `json:"-"`
Azure Azure `json:"-"`
Stride StrideConf `json:"-"`
HipChat HipChatConf `json:"-"`
ChatWork ChatWorkConf `json:"-"`
Telegram TelegramConf `json:"-"`
Saas SaasConf `json:"-"`

RefreshCve bool `json:"refreshCve,omitempty"`
ToSlack bool `json:"toSlack,omitempty"`
ToStride bool `json:"toStride,omitempty"`
ToHipChat bool `json:"toHipChat,omitempty"`
ToChatWork bool `json:"toChatWork,omitempty"`
ToTelegram bool `json:"ToTelegram,omitempty"`
ToEmail bool `json:"toEmail,omitempty"`
Expand Down Expand Up @@ -282,18 +278,10 @@ func (c Config) ValidateOnReport() bool {
errs = append(errs, slackerrs...)
}

if hipchaterrs := c.HipChat.Validate(); 0 < len(hipchaterrs) {
errs = append(errs, hipchaterrs...)
}

if chatworkerrs := c.ChatWork.Validate(); 0 < len(chatworkerrs) {
errs = append(errs, chatworkerrs...)
}

if strideerrs := c.Stride.Validate(); 0 < len(strideerrs) {
errs = append(errs, strideerrs...)
}

if telegramerrs := c.Telegram.Validate(); 0 < len(telegramerrs) {
errs = append(errs, telegramerrs...)
}
Expand Down Expand Up @@ -441,33 +429,6 @@ func (c *SMTPConf) Validate() (errs []error) {
return
}

// StrideConf is stride config
type StrideConf struct {
HookURL string `json:"-"`
AuthToken string `json:"-"`
}

// Validate validates configuration
func (c *StrideConf) Validate() (errs []error) {
if !Conf.ToStride {
return
}

if len(c.HookURL) == 0 {
errs = append(errs, xerrors.New("stride.HookURL must not be empty"))
}

if len(c.AuthToken) == 0 {
errs = append(errs, xerrors.New("stride.AuthToken must not be empty"))
}

_, err := valid.ValidateStruct(c)
if err != nil {
errs = append(errs, err)
}
return
}

// SlackConf is slack config
type SlackConf struct {
HookURL string `valid:"url" json:"-" toml:"hookURL,omitempty"`
Expand Down Expand Up @@ -511,32 +472,6 @@ func (c *SlackConf) Validate() (errs []error) {
return
}

// HipChatConf is HipChat config
type HipChatConf struct {
AuthToken string `json:"-"`
Room string `json:"-"`
}

// Validate validates configuration
func (c *HipChatConf) Validate() (errs []error) {
if !Conf.ToHipChat {
return
}
if len(c.Room) == 0 {
errs = append(errs, xerrors.New("hipchat.room must not be empty"))
}

if len(c.AuthToken) == 0 {
errs = append(errs, xerrors.New("hipchat.AuthToken must not be empty"))
}

_, err := valid.ValidateStruct(c)
if err != nil {
errs = append(errs, err)
}
return
}

// ChatWorkConf is ChatWork config
type ChatWorkConf struct {
APIToken string `json:"-"`
Expand Down Expand Up @@ -589,7 +524,7 @@ func (c *TelegramConf) Validate() (errs []error) {
return
}

// SaasConf is stride config
// SaasConf is FutureVuls config
type SaasConf struct {
GroupID int64 `json:"-"`
Token string `json:"-"`
Expand Down
2 changes: 0 additions & 2 deletions config/tomlloader.go
Expand Up @@ -21,8 +21,6 @@ func (c TOMLLoader) Load(pathToToml, keyPass string) error {
}
Conf.EMail = conf.EMail
Conf.Slack = conf.Slack
Conf.Stride = conf.Stride
Conf.HipChat = conf.HipChat
Conf.ChatWork = conf.ChatWork
Conf.Telegram = conf.Telegram
Conf.Saas = conf.Saas
Expand Down
2 changes: 1 addition & 1 deletion models/cvecontents.go
Expand Up @@ -83,7 +83,7 @@ func (v CveContents) PrimarySrcURLs(lang, myFamily, cveID string) (values []CveC
return values
}

// PrimarySrcURLs returns link of source
// PatchURLs returns link of patch
func (v CveContents) PatchURLs() (urls []string) {
cont, found := v[Nvd]
if !found {
Expand Down
74 changes: 0 additions & 74 deletions report/hipchat.go

This file was deleted.

2 changes: 1 addition & 1 deletion report/report.go
Expand Up @@ -153,7 +153,7 @@ func FillCveInfos(dbclient DBClient, rs []models.ScanResult, dir string) ([]mode
return rs, nil
}

// DetectPkgCVEs detects OS pkg cves
// DetectPkgCves detects OS pkg cves
func DetectPkgCves(dbclient DBClient, r *models.ScanResult) error {
// Pkg Scan
if r.Release != "" {
Expand Down
81 changes: 0 additions & 81 deletions report/stride.go

This file was deleted.

14 changes: 0 additions & 14 deletions saas/uuid.go
Expand Up @@ -152,16 +152,6 @@ func EnsureUUIDs(configPath string, results models.ScanResults) (err error) {
azure = nil
}

stride := &c.Conf.Stride
if stride.HookURL == "" {
stride = nil
}

hipChat := &c.Conf.HipChat
if hipChat.AuthToken == "" {
hipChat = nil
}

chatWork := &c.Conf.ChatWork
if chatWork.APIToken == "" {
chatWork = nil
Expand All @@ -184,8 +174,6 @@ func EnsureUUIDs(configPath string, results models.ScanResults) (err error) {
Syslog *c.SyslogConf `toml:"syslog"`
AWS *c.AWS `toml:"aws"`
Azure *c.Azure `toml:"azure"`
Stride *c.StrideConf `toml:"stride"`
HipChat *c.HipChatConf `toml:"hipChat"`
ChatWork *c.ChatWorkConf `toml:"chatWork"`
Saas *c.SaasConf `toml:"saas"`

Expand All @@ -203,8 +191,6 @@ func EnsureUUIDs(configPath string, results models.ScanResults) (err error) {
Syslog: syslog,
AWS: aws,
Azure: azure,
Stride: stride,
HipChat: hipChat,
ChatWork: chatWork,
Saas: saas,

Expand Down
10 changes: 0 additions & 10 deletions subcmds/discover.go
Expand Up @@ -149,16 +149,6 @@ sqlite3Path = "/path/to/go-msfdb.sqlite3"
#accountKey = "xxxxxxxxxxxxxx"
#containerName = "vuls"
# https://vuls.io/docs/en/usage-settings.html#stride-section
#[stride]
#hookURL = "xxxxxxxxxxxxxxx"
#authToken = "xxxxxxxxxxxxxx"
# https://vuls.io/docs/en/usage-settings.html#hipchat-section
#[hipchat]
#room = "vuls"
#authToken = "xxxxxxxxxxxxxx"
# https://vuls.io/docs/en/usage-settings.html#chatwork-section
#[chatwork]
#room = "xxxxxxxxxxx"
Expand Down
12 changes: 0 additions & 12 deletions subcmds/report.go
Expand Up @@ -51,8 +51,6 @@ func (*ReportCmd) Usage() string {
[-to-email]
[-to-http]
[-to-slack]
[-to-stride]
[-to-hipchat]
[-to-chatwork]
[-to-telegram]
[-to-localfile]
Expand Down Expand Up @@ -134,8 +132,6 @@ func (p *ReportCmd) SetFlags(f *flag.FlagSet) {
"Detail report in plain text")

f.BoolVar(&c.Conf.ToSlack, "to-slack", false, "Send report via Slack")
f.BoolVar(&c.Conf.ToStride, "to-stride", false, "Send report via Stride")
f.BoolVar(&c.Conf.ToHipChat, "to-hipchat", false, "Send report via hipchat")
f.BoolVar(&c.Conf.ToChatWork, "to-chatwork", false, "Send report via chatwork")
f.BoolVar(&c.Conf.ToTelegram, "to-telegram", false, "Send report via Telegram")
f.BoolVar(&c.Conf.ToEmail, "to-email", false, "Send report via Email")
Expand Down Expand Up @@ -297,14 +293,6 @@ func (p *ReportCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}
reports = append(reports, report.SlackWriter{})
}

if c.Conf.ToStride {
reports = append(reports, report.StrideWriter{})
}

if c.Conf.ToHipChat {
reports = append(reports, report.HipChatWriter{})
}

if c.Conf.ToChatWork {
reports = append(reports, report.ChatWorkWriter{})
}
Expand Down

0 comments on commit 83d1f80

Please sign in to comment.