Skip to content

Commit

Permalink
fix:cve search (#4347)
Browse files Browse the repository at this point in the history
* fix

* fix

* code review comments incorporated

* code review comments incorporated
  • Loading branch information
ShashwatDadhich committed Dec 6, 2023
1 parent b886994 commit 93ecb69
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 5 additions & 4 deletions internal/sql/repository/security/CveStoreRepository.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package security

import (
"fmt"
"github.com/devtron-labs/devtron/internal/sql/repository/helper"
"github.com/devtron-labs/devtron/pkg/sql"
"github.com/go-pg/pg"
"go.uber.org/zap"
Expand Down Expand Up @@ -51,10 +52,10 @@ type VulnerabilityExposure struct {
AppId int `json:"appId"`
EnvId int `json:"envId"`
//ClusterId int `json:"clusterId"`
AppStore bool `json:"appStore"`
Blocked bool `json:"blocked"`
PipelineEnvId int `json:"-"`
ChartEnvId int `json:"-"`
AppType helper.AppType `json:"appType"`
Blocked bool `json:"blocked"`
PipelineEnvId int `json:"-"`
ChartEnvId int `json:"-"`
}

type VulnerabilityExposureListingResponse struct {
Expand Down
8 changes: 5 additions & 3 deletions pkg/security/ImageScanService.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,15 +581,17 @@ func (impl ImageScanServiceImpl) VulnerabilityExposure(request *security.Vulnera
cveStores = append(cveStores, cveStore)
for _, item := range vulnerabilityExposureList {
envId := 0
if item.AppStore {
if item.AppType == helper.ChartStoreApp {
envId = item.ChartEnvId
} else {
} else if item.AppType == helper.CustomApp {
envId = item.PipelineEnvId
}
env := envMap[envId]
item.EnvId = envId
item.EnvName = env.Environment
blockCveList, err := impl.policyService.GetBlockedCVEList(cveStores, env.ClusterId, envId, item.AppId, item.AppStore)
var appStore bool
appStore = item.AppType == helper.ChartStoreApp
blockCveList, err := impl.policyService.GetBlockedCVEList(cveStores, env.ClusterId, envId, item.AppId, appStore)
if err != nil {
impl.Logger.Errorw("error while fetching blocked list", "err", err)
return nil, err
Expand Down

0 comments on commit 93ecb69

Please sign in to comment.