From a4be346e4df86bf48cacbc874ea68c186c94b15c Mon Sep 17 00:00:00 2001 From: Scott Bamforth Date: Fri, 17 Sep 2021 21:08:48 +0100 Subject: [PATCH] Add severity label to Gitlab/JIRA reporter --- v2/pkg/reporting/trackers/gitlab/gitlab.go | 6 +++++- v2/pkg/reporting/trackers/jira/jira.go | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/v2/pkg/reporting/trackers/gitlab/gitlab.go b/v2/pkg/reporting/trackers/gitlab/gitlab.go index 33d4fff01..30e5d33c8 100644 --- a/v2/pkg/reporting/trackers/gitlab/gitlab.go +++ b/v2/pkg/reporting/trackers/gitlab/gitlab.go @@ -1,6 +1,8 @@ package gitlab import ( + "fmt" + "github.com/projectdiscovery/nuclei/v2/pkg/output" "github.com/projectdiscovery/nuclei/v2/pkg/reporting/format" "github.com/xanzy/go-gitlab" @@ -48,12 +50,14 @@ func New(options *Options) (*Integration, error) { func (i *Integration) CreateIssue(event *output.ResultEvent) error { summary := format.Summary(event) description := format.MarkdownDescription(event) + severityLabel := fmt.Sprintf("Severity: %s", event.Info.SeverityHolder.Severity.String()) _, _, err := i.client.Issues.CreateIssue(i.options.ProjectName, &gitlab.CreateIssueOptions{ Title: &summary, Description: &description, - Labels: gitlab.Labels{i.options.IssueLabel}, + Labels: gitlab.Labels{i.options.IssueLabel, severityLabel}, AssigneeIDs: []int{i.userID}, }) + return err } diff --git a/v2/pkg/reporting/trackers/jira/jira.go b/v2/pkg/reporting/trackers/jira/jira.go index 1bfe2edd5..337ba3f5d 100644 --- a/v2/pkg/reporting/trackers/jira/jira.go +++ b/v2/pkg/reporting/trackers/jira/jira.go @@ -60,6 +60,7 @@ func New(options *Options) (*Integration, error) { // CreateNewIssue creates a new issue in the tracker func (i *Integration) CreateNewIssue(event *output.ResultEvent) error { summary := format.Summary(event) + severityLabel := fmt.Sprintf("Severity:%s", event.Info.SeverityHolder.Severity.String()) fields := &jira.IssueFields{ Assignee: &jira.User{AccountID: i.options.AccountID}, @@ -68,6 +69,7 @@ func (i *Integration) CreateNewIssue(event *output.ResultEvent) error { Type: jira.IssueType{Name: i.options.IssueType}, Project: jira.Project{Key: i.options.ProjectName}, Summary: summary, + Labels: []string{severityLabel}, } // On-prem version of Jira server does not use AccountID if !i.options.Cloud { @@ -77,6 +79,7 @@ func (i *Integration) CreateNewIssue(event *output.ResultEvent) error { Type: jira.IssueType{Name: i.options.IssueType}, Project: jira.Project{Key: i.options.ProjectName}, Summary: summary, + Labels: []string{severityLabel}, } }