Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:cve search #4347

Merged
merged 4 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading