Skip to content

Commit 7182360

Browse files
committed
Update vulnerability event handling to include user agent and adjust test cases
Signed-off-by: rafi <refaei.shikho@hotmail.com>
1 parent 39a3de9 commit 7182360

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

integrations/gitlabint/gitlab_webhook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func (g *GitlabIntegration) HandleWebhook(ctx shared.Context) error {
129129
return nil
130130
}
131131

132-
vulnEvent = models.NewReopenedEvent(vuln.GetID(), vuln.GetType(), fmt.Sprintf("gitlab:%d", event.User.ID), fmt.Sprintf("This Vulnerability is marked as accepted by %s, due to closing of the gitlab ticket.", event.User.Name), false, &userAgent)
132+
vulnEvent = models.NewReopenedEvent(vuln.GetID(), vuln.GetType(), fmt.Sprintf("gitlab:%d", event.User.ID), fmt.Sprintf("This Vulnerability is marked as reopened by %s, due to reopening of the gitlab ticket.", event.User.Name), false, &userAgent)
133133

134134
err := g.aggregatedVulnRepository.ApplyAndSave(reqCtx, nil, vuln, &vulnEvent)
135135
if err != nil {

tests/daemon_pipeline_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ func TestDaemonPipelineAutoReopenExceedThreshold(t *testing.T) {
299299
"test-user",
300300
"Test acceptance",
301301
false,
302-
"test-user-agent",
302+
nil,
303303
)
304304
acceptEvent.CreatedAt = time.Now().Add(-48 * time.Hour)
305305
err = f.DB.Create(&acceptEvent).Error

transformer/vulnevent_transformer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ func ConvertVulnEventDetailToDto(e models.VulnEventDetail) dtos.VulnEventDTO {
3636
PackageName: e.ComponentPurl,
3737
URI: e.URI,
3838
CreatedByVexRule: e.CreatedByVexRule,
39+
UserAgent: e.GetUserAgent(),
3940
}
4041
}
4142

0 commit comments

Comments
 (0)