mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-18 12:25:28 +00:00
Add severity label to Gitlab/JIRA reporter
This commit is contained in:
parent
10cc08c758
commit
a4be346e4d
@ -1,6 +1,8 @@
|
|||||||
package gitlab
|
package gitlab
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/output"
|
"github.com/projectdiscovery/nuclei/v2/pkg/output"
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/reporting/format"
|
"github.com/projectdiscovery/nuclei/v2/pkg/reporting/format"
|
||||||
"github.com/xanzy/go-gitlab"
|
"github.com/xanzy/go-gitlab"
|
||||||
@ -48,12 +50,14 @@ func New(options *Options) (*Integration, error) {
|
|||||||
func (i *Integration) CreateIssue(event *output.ResultEvent) error {
|
func (i *Integration) CreateIssue(event *output.ResultEvent) error {
|
||||||
summary := format.Summary(event)
|
summary := format.Summary(event)
|
||||||
description := format.MarkdownDescription(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{
|
_, _, err := i.client.Issues.CreateIssue(i.options.ProjectName, &gitlab.CreateIssueOptions{
|
||||||
Title: &summary,
|
Title: &summary,
|
||||||
Description: &description,
|
Description: &description,
|
||||||
Labels: gitlab.Labels{i.options.IssueLabel},
|
Labels: gitlab.Labels{i.options.IssueLabel, severityLabel},
|
||||||
AssigneeIDs: []int{i.userID},
|
AssigneeIDs: []int{i.userID},
|
||||||
})
|
})
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,6 +60,7 @@ func New(options *Options) (*Integration, error) {
|
|||||||
// CreateNewIssue creates a new issue in the tracker
|
// CreateNewIssue creates a new issue in the tracker
|
||||||
func (i *Integration) CreateNewIssue(event *output.ResultEvent) error {
|
func (i *Integration) CreateNewIssue(event *output.ResultEvent) error {
|
||||||
summary := format.Summary(event)
|
summary := format.Summary(event)
|
||||||
|
severityLabel := fmt.Sprintf("Severity:%s", event.Info.SeverityHolder.Severity.String())
|
||||||
|
|
||||||
fields := &jira.IssueFields{
|
fields := &jira.IssueFields{
|
||||||
Assignee: &jira.User{AccountID: i.options.AccountID},
|
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},
|
Type: jira.IssueType{Name: i.options.IssueType},
|
||||||
Project: jira.Project{Key: i.options.ProjectName},
|
Project: jira.Project{Key: i.options.ProjectName},
|
||||||
Summary: summary,
|
Summary: summary,
|
||||||
|
Labels: []string{severityLabel},
|
||||||
}
|
}
|
||||||
// On-prem version of Jira server does not use AccountID
|
// On-prem version of Jira server does not use AccountID
|
||||||
if !i.options.Cloud {
|
if !i.options.Cloud {
|
||||||
@ -77,6 +79,7 @@ func (i *Integration) CreateNewIssue(event *output.ResultEvent) error {
|
|||||||
Type: jira.IssueType{Name: i.options.IssueType},
|
Type: jira.IssueType{Name: i.options.IssueType},
|
||||||
Project: jira.Project{Key: i.options.ProjectName},
|
Project: jira.Project{Key: i.options.ProjectName},
|
||||||
Summary: summary,
|
Summary: summary,
|
||||||
|
Labels: []string{severityLabel},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user