@@ -109,6 +109,8 @@ func (c *ArtifactController) Create(ctx shared.Context) error {
109109
110110 var body requestBody
111111
112+ userAgent := ctx .Request ().UserAgent ()
113+
112114 if err := ctx .Bind (& body ); err != nil {
113115 return err
114116 }
@@ -150,7 +152,7 @@ func (c *ArtifactController) Create(ctx shared.Context) error {
150152 }
151153 currentUserID := shared .GetSession (ctx ).GetUserID ()
152154
153- _ , _ , newState , err := c .ScanNormalizedSBOM (ctx .Request ().Context (), tx , org , project , asset , assetVersion , artifact , bom , currentUserID )
155+ _ , _ , newState , err := c .ScanNormalizedSBOM (ctx .Request ().Context (), tx , org , project , asset , assetVersion , artifact , bom , currentUserID , & userAgent )
154156
155157 if err != nil {
156158 tx .Rollback ()
@@ -190,7 +192,7 @@ func (c *ArtifactController) Create(ctx shared.Context) error {
190192 ArtifactName : artifact .ArtifactName ,
191193 },
192194 SBOM : exportedBOM ,
193- }); err != nil {
195+ }, & userAgent ); err != nil {
194196 slog .Error ("could not handle SBOM updated event" , "err" , err )
195197 } else {
196198 slog .Info ("handled SBOM updated event" , "assetVersion" , assetVersion .Name , "assetID" , assetVersion .AssetID )
@@ -199,7 +201,7 @@ func (c *ArtifactController) Create(ctx shared.Context) error {
199201 }
200202
201203 c .FireAndForget (func () {
202- err := c .dependencyVulnService .SyncIssues (linkedCtx , org , project , asset , assetVersion , newState )
204+ err := c .dependencyVulnService .SyncIssues (linkedCtx , org , project , asset , assetVersion , newState , & userAgent )
203205 if err != nil {
204206 slog .Error ("could not create issues for vulnerabilities" , "err" , err )
205207 }
@@ -238,6 +240,8 @@ func (c *ArtifactController) DeleteArtifact(ctx shared.Context) error {
238240 org := shared .GetOrg (ctx )
239241 project := shared .GetProject (ctx )
240242
243+ userAgent := ctx .Request ().UserAgent ()
244+
241245 // we need to sync the vulnerabilities after deleting the artifact
242246 // maybe we need to close some: https://github.com/l3montree-dev/devguard/issues/1496
243247 // fetch all vulnerabilities which ONLY belong to this artifact
@@ -258,7 +262,7 @@ func (c *ArtifactController) DeleteArtifact(ctx shared.Context) error {
258262 linkedCtx := trace .ContextWithSpan (context .Background (), trace .SpanFromContext (reqCtx ))
259263 if len (syncVulns ) > 0 {
260264 c .FireAndForget (func () {
261- err := c .dependencyVulnService .SyncIssues (linkedCtx , org , project , asset , assetVersion , syncVulns )
265+ err := c .dependencyVulnService .SyncIssues (linkedCtx , org , project , asset , assetVersion , syncVulns , & userAgent )
262266 if err != nil {
263267 slog .Error ("could not sync issues for vulnerabilities after artifact deletion" , "err" , err )
264268 }
@@ -299,6 +303,7 @@ func (c *ArtifactController) UpdateArtifact(ctx shared.Context) error {
299303 }
300304
301305 reqCtx := ctx .Request ().Context ()
306+ userAgent := ctx .Request ().UserAgent ()
302307
303308 artifact , err := c .artifactService .ReadArtifact (reqCtx , nil , artifactName , assetVersion .Name , asset .ID )
304309 if err != nil {
@@ -360,7 +365,7 @@ func (c *ArtifactController) UpdateArtifact(ctx shared.Context) error {
360365 return echo .NewHTTPError (500 , "could not update sbom" ).WithInternal (err )
361366 }
362367
363- _ , _ , vulns , err = c .ScanNormalizedSBOM (reqCtx , tx , org , project , asset , assetVersion , artifact , sbom , shared .GetSession (ctx ).GetUserID ())
368+ _ , _ , vulns , err = c .ScanNormalizedSBOM (reqCtx , tx , org , project , asset , assetVersion , artifact , sbom , shared .GetSession (ctx ).GetUserID (), & userAgent )
364369 if err != nil {
365370 slog .Error ("could not scan sbom after updating it" , "err" , err )
366371 return echo .NewHTTPError (500 , "could not scan sbom after updating it" ).WithInternal (err )
@@ -395,7 +400,7 @@ func (c *ArtifactController) UpdateArtifact(ctx shared.Context) error {
395400 ArtifactName : artifactName ,
396401 },
397402 SBOM : exportedBOM ,
398- }); err != nil {
403+ }, & userAgent ); err != nil {
399404 slog .Error ("could not handle SBOM updated event" , "err" , err )
400405 } else {
401406 slog .Info ("handled SBOM updated event" , "assetVersion" , assetVersion .Name , "assetID" , assetVersion .AssetID )
@@ -404,7 +409,7 @@ func (c *ArtifactController) UpdateArtifact(ctx shared.Context) error {
404409 }
405410
406411 c .FireAndForget (func () {
407- err := c .dependencyVulnService .SyncIssues (linkedCtx , org , project , asset , assetVersion , vulns )
412+ err := c .dependencyVulnService .SyncIssues (linkedCtx , org , project , asset , assetVersion , vulns , & userAgent )
408413 if err != nil {
409414 slog .Error ("could not create issues for vulnerabilities" , "err" , err )
410415 }
0 commit comments