mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 22:05:27 +00:00
Add severity label to Gitlab/JIRA reporter
This commit is contained in:
parent
10cc08c758
commit
a4be346e4d
@ -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
|
||||
}
|
||||
|
||||
@ -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},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user