Skip to content

Commit

Permalink
feat(saas) add vuls tags from env (#1487)
Browse files Browse the repository at this point in the history
  • Loading branch information
sadayuki-matsuno authored Jul 4, 2022
1 parent 999529a commit 9373131
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions saas/saas.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func (w Writer) Write(rs ...models.ScanResult) error {
if len(rs) == 0 {
return nil
}
tags := strings.Split(os.Getenv("VULS_TAGS"), ",")

ipv4s, ipv6s, err := util.IP()
if err != nil {
Expand Down Expand Up @@ -111,6 +112,13 @@ func (w Writer) Write(rs ...models.ScanResult) error {

svc := s3.New(sess)
for _, r := range rs {
if 0 < len(tags) {
if r.Optional == nil {
r.Optional = map[string]interface{}{}
}
r.Optional["VULS_TAGS"] = tags
}

b, err := json.Marshal(r)
if err != nil {
return xerrors.Errorf("Failed to Marshal to JSON: %w", err)
Expand Down

0 comments on commit 9373131

Please sign in to comment.