Documentation ¶
Overview ¶
Package database is a generated GoMock package.
Index ¶
- Constants
- Variables
- func ApplicationFromDB(view *ApplicationView) *models.Application
- func ApplicationResourceFromDB(view *ResourceView) *models.ApplicationResource
- func ArrayToDBArray(arr []string) string
- func CISDockerBenchmarkLevelFilterGte(db *gorm.DB, columnName string, value *string) *gorm.DB
- func CISDockerBenchmarkLevelFilterLte(db *gorm.DB, columnName string, value *string) *gorm.DB
- func CISDockerBenchmarkResultFromDB(result *CISDockerBenchmarkCheckView) *models.CISDockerBenchmarkResultsEX
- func CreateApplicationID(app *models.ApplicationInfo) string
- func CreateCVSSString(cvss *types.CVSS) string
- func CreatePackageID(pkgInfo *types.PackageInfo) string
- func CreateResourceID(info *types.ResourceInfo) string
- func CreateTimeFilter(timeColName string, startTime, endTime strfmt.DateTime) string
- func CreateVulnerabilityID(vul *types.PackageVulnerabilityScan) string
- func DBArrayToArray(str string) []string
- func FieldInTable(table, field string) string
- func FilterArrayContains(db *gorm.DB, column string, values []string) *gorm.DB
- func FilterArrayDoesntContain(db *gorm.DB, column string, values []string) *gorm.DB
- func FilterContains(db *gorm.DB, column string, values []string) *gorm.DB
- func FilterEndsWith(db *gorm.DB, column string, value *string) *gorm.DB
- func FilterGte(db *gorm.DB, column string, value *int64) *gorm.DB
- func FilterIs(db *gorm.DB, column string, values []string) *gorm.DB
- func FilterIsBool(db *gorm.DB, column string, value *bool) *gorm.DB
- func FilterIsEmptyString(db *gorm.DB, column string) *gorm.DB
- func FilterIsNot(db *gorm.DB, column string, values []string) *gorm.DB
- func FilterIsNotEmptyString(db *gorm.DB, column string) *gorm.DB
- func FilterIsNotNumber(db *gorm.DB, column string, values []int64) *gorm.DB
- func FilterIsNumber(db *gorm.DB, column string, values []int64) *gorm.DB
- func FilterLte(db *gorm.DB, column string, value *int64) *gorm.DB
- func FilterStartsWith(db *gorm.DB, column string, value *string) *gorm.DB
- func PackageApplicationResourcesFromDB(pri *PackageResourcesInfoView) *models.PackageApplicationResources
- func PackageFromDB(view *PackageView) *models.Package
- func Paginate(page, pageSize int64) func(db *gorm.DB) *gorm.DB
- func RuntimeQuickScanConfigFromDB(config *QuickScanConfig) *models.RuntimeQuickScanConfig
- func SeverityFilterGte(db *gorm.DB, columnName string, value *string) *gorm.DB
- func SeverityFilterIs(db *gorm.DB, columnName string, values []string) *gorm.DB
- func SeverityFilterIsNot(db *gorm.DB, columnName string, values []string) *gorm.DB
- func SeverityFilterLte(db *gorm.DB, columnName string, value *string) *gorm.DB
- func ToDBArrayElement(s string) string
- func VulnerabilityFromDB(view *VulnerabilityView) *models.Vulnerability
- type Application
- type ApplicationResources
- type ApplicationTable
- type ApplicationTableHandler
- func (a *ApplicationTableHandler) Count(filters *CountFilters) (int64, error)
- func (a *ApplicationTableHandler) Create(app *Application, params *TransactionParams) error
- func (a *ApplicationTableHandler) Delete(app *Application) error
- func (a *ApplicationTableHandler) GetApplication(id string) (*models.ApplicationEx, error)
- func (a *ApplicationTableHandler) GetApplicationsAndTotal(params GetApplicationsParams) ([]ApplicationView, int64, error)
- func (a *ApplicationTableHandler) GetDBApplication(id string, shouldGetRelationships bool) (*Application, error)
- func (a *ApplicationTableHandler) GetMostVulnerable(limit int) ([]*models.Application, error)
- func (a *ApplicationTableHandler) UpdateInfo(app *Application, params *TransactionParams) error
- type ApplicationView
- type CISDockerBenchmarkCheck
- type CISDockerBenchmarkCheckView
- type CISDockerBenchmarkLevelCounters
- type CISDockerBenchmarkResultTable
- type CISDockerBenchmarkResultTableHandler
- func (c *CISDockerBenchmarkResultTableHandler) CountPerLevel(filters *CountFilters) ([]*models.CISDockerBenchmarkLevelCount, error)
- func (c *CISDockerBenchmarkResultTableHandler) GetCISDockerBenchmarkResultsAndTotal(params operations.GetCisdockerbenchmarkresultsIDParams) ([]CISDockerBenchmarkCheckView, int64, error)
- type CountFilters
- type DBConfig
- type Database
- type DeleteRelationshipsParams
- type GetApplicationResourcesParams
- type GetApplicationsParams
- type GetIDsParams
- type GetPackagesParams
- type GetVulnerabilitiesParams
- type Handler
- func (db *Handler) ApplicationTable() ApplicationTable
- func (db *Handler) CISDockerBenchmarkResultTable() CISDockerBenchmarkResultTable
- func (db *Handler) CreateFakeData()
- func (db *Handler) IDsView() IDsView
- func (db *Handler) JoinTables() JoinTables
- func (db *Handler) NewVulnerabilityTable() NewVulnerabilityTable
- func (db *Handler) ObjectTree() ObjectTree
- func (db *Handler) PackageTable() PackageTable
- func (db *Handler) QuickScanConfigTable() QuickScanConfigTable
- func (db *Handler) RefreshMaterializedViews()
- func (db *Handler) ResourceTable() ResourceTable
- func (db *Handler) SchedulerTable() SchedulerTable
- func (db *Handler) SetMaterializedViewHandler(config *DBConfig)
- func (db *Handler) VulnerabilityTable() VulnerabilityTable
- type IDsView
- type IDsViewHandler
- type JoinTables
- type JoinTablesHandler
- func (j *JoinTablesHandler) DeleteRelationships(params DeleteRelationshipsParams) error
- func (j *JoinTablesHandler) GetPackageResourcesAndTotal(params operations.GetPackagesIDApplicationResourcesParams) ([]PackageResourcesInfoView, int64, error)
- func (j *JoinTablesHandler) GetPackageVulnerabilitiesByPackages(packageIDs []string) ([]PackageVulnerabilities, error)
- func (j *JoinTablesHandler) GetPackageVulnerabilitiesByVulnerabilities(vulnerabilityIDs []string) ([]PackageVulnerabilities, error)
- func (j *JoinTablesHandler) GetResourcePackageIDToAnalyzers(resourceIDs []string) (map[ResourcePkgID][]string, error)
- func (j *JoinTablesHandler) GetResourcePackagesByPackages(packageIDs []string) ([]ResourcePackages, error)
- func (j *JoinTablesHandler) GetResourcePackagesByResources(resourceIDs []string) ([]ResourcePackages, error)
- type Level
- type MockHandler
- func (m *MockHandler) ApplicationTable() ApplicationTable
- func (m *MockHandler) CISDockerBenchmarkResultTable() CISDockerBenchmarkResultTable
- func (m *MockHandler) IDsView() IDsView
- func (m *MockHandler) JoinTables() JoinTables
- func (m *MockHandler) NewVulnerabilityTable() NewVulnerabilityTable
- func (m *MockHandler) ObjectTree() ObjectTree
- func (m *MockHandler) PackageTable() PackageTable
- func (m *MockHandler) QuickScanConfigTable() QuickScanConfigTable
- func (m *MockHandler) ResourceTable() ResourceTable
- func (m *MockHandler) SchedulerTable() SchedulerTable
- func (m *MockHandler) VulnerabilityTable() VulnerabilityTable
- type MockResourceTable
- func (m *MockResourceTable) Count(arg0 *CountFilters) (int64, error)
- func (m *MockResourceTable) Create(arg0 *Resource) error
- func (m *MockResourceTable) Delete(arg0 *Resource) error
- func (m *MockResourceTable) EXPECT() *MockResourceTableMockRecorder
- func (m *MockResourceTable) GetApplicationResource(arg0 string) (*models.ApplicationResourceEx, error)
- func (m *MockResourceTable) GetApplicationResourcesAndTotal(arg0 GetApplicationResourcesParams) ([]ResourceView, int64, error)
- func (m *MockResourceTable) GetDBResource(arg0 string, arg1 bool) (*Resource, error)
- func (m *MockResourceTable) GetMostVulnerable(arg0 int) ([]*models.ApplicationResource, error)
- type MockResourceTableMockRecorder
- func (mr *MockResourceTableMockRecorder) Count(arg0 interface{}) *gomock.Call
- func (mr *MockResourceTableMockRecorder) Create(arg0 interface{}) *gomock.Call
- func (mr *MockResourceTableMockRecorder) Delete(arg0 interface{}) *gomock.Call
- func (mr *MockResourceTableMockRecorder) GetApplicationResource(arg0 interface{}) *gomock.Call
- func (mr *MockResourceTableMockRecorder) GetApplicationResourcesAndTotal(arg0 interface{}) *gomock.Call
- func (mr *MockResourceTableMockRecorder) GetDBResource(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockResourceTableMockRecorder) GetMostVulnerable(arg0 interface{}) *gomock.Call
- type NewVulnerability
- type NewVulnerabilityTable
- type NewVulnerabilityTableHandler
- func (v *NewVulnerabilityTableHandler) Create(vul *NewVulnerability) error
- func (v *NewVulnerabilityTableHandler) CreateNewVulnerabilitiesTrends(application *Application) error
- func (v *NewVulnerabilityTableHandler) GetNewVulnerabilitiesTrends(params operations.GetDashboardTrendsVulnerabilitiesParams) ([]*models.NewVulnerabilitiesTrend, error)
- type NewVulnerabilityView
- type ObjectTree
- type ObjectTreeHandler
- type Package
- type PackageResourcesInfoView
- type PackageTable
- type PackageTableHandler
- func (p *PackageTableHandler) Count(filters *CountFilters) (int64, error)
- func (p *PackageTableHandler) Create(pkg *Package) error
- func (p *PackageTableHandler) DeleteByIDs(pkgIDs []string) error
- func (p *PackageTableHandler) GetDBPackage(id string) (*Package, error)
- func (p *PackageTableHandler) GetMostVulnerable(limit int) ([]*models.Package, error)
- func (p *PackageTableHandler) GetPackage(id string) (*models.Package, error)
- func (p *PackageTableHandler) GetPackagesAndTotal(params GetPackagesParams) ([]PackageView, int64, error)
- func (p *PackageTableHandler) GetPackagesCountPerLanguage() ([]*models.PackagesCountPerLanguage, error)
- func (p *PackageTableHandler) GetPackagesCountPerLicense() ([]*models.PackagesCountPerLicense, error)
- type PackageView
- type PackageVulnerabilities
- type PkgVulID
- type QuickScanConfig
- type QuickScanConfigTable
- type QuickScanConfigTableHandler
- type Resource
- func CreateResource(info *types.ResourceInfo) *Resource
- func CreateResourceFromContentAnalysis(resourceContentAnalysis *models.ResourceContentAnalysis, ...) *Resource
- func CreateResourceFromRuntimeContentAnalysis(resourceContentAnalysis *runtime_scan_models.ResourceContentAnalysis, ...) *Resource
- func CreateResourceFromVulnerabilityScan(resourceVulnerabilityScan *types.ResourceVulnerabilityScan, ...) *Resource
- func UpdateResourceAnalyzers(resources []Resource, resourcePkgIDToAnalyzers map[ResourcePkgID][]string) []Resource
- type ResourceCISDBChecks
- type ResourcePackages
- type ResourcePkgID
- type ResourceTable
- type ResourceTableHandler
- func (r *ResourceTableHandler) Count(filters *CountFilters) (int64, error)
- func (r *ResourceTableHandler) Create(resource *Resource) error
- func (r *ResourceTableHandler) Delete(resource *Resource) error
- func (r *ResourceTableHandler) GetApplicationResource(id string) (*models.ApplicationResourceEx, error)
- func (r *ResourceTableHandler) GetApplicationResourcesAndTotal(params GetApplicationResourcesParams) ([]ResourceView, int64, error)
- func (r *ResourceTableHandler) GetDBResource(id string, shouldGetRelationships bool) (*Resource, error)
- func (r *ResourceTableHandler) GetMostVulnerable(limit int) ([]*models.ApplicationResource, error)
- type ResourceView
- type Scheduler
- type SchedulerTable
- type SchedulerTableHandler
- type Severity
- type SeverityCounters
- type TransactionParams
- type ViewRefreshHandler
- type Vulnerability
- type VulnerabilityTable
- type VulnerabilityTableHandler
- func (v *VulnerabilityTableHandler) Count(filters *CountFilters) (int64, error)
- func (v *VulnerabilityTableHandler) CountPerSeverity(filters *CountFilters) ([]*models.VulnerabilityCount, error)
- func (v *VulnerabilityTableHandler) CountVulnerabilitiesWithFix() ([]*models.VulnerabilitiesWithFix, error)
- func (v *VulnerabilityTableHandler) Create(vul *Vulnerability) error
- func (v *VulnerabilityTableHandler) DeleteByIDs(vulIDs []string) error
- func (v *VulnerabilityTableHandler) GetDBVulnerability(id string) (*Vulnerability, error)
- func (v *VulnerabilityTableHandler) GetVulnerabilitiesAndTotal(params GetVulnerabilitiesParams) ([]VulnerabilityView, int64, error)
- func (v *VulnerabilityTableHandler) GetVulnerability(vulID, pkgID string) (*models.VulnerabilityEx, error)
- type VulnerabilityView
Constants ¶
const ( DBDriverTypePostgres = "POSTGRES" DBDriverTypeLocal = "LOCAL" )
const ( ApplicationIDType idType = "application" ResourceIDType idType = "resource" PackageIDType idType = "package" VulnerabilityIDType idType = "vulnerability" )
const ( ApplicationResourcesJoinTableName = "application_resources" ResourcePackagesJoinTableName = "resource_packages" PackageVulnerabilitiesJoinTableName = "package_vulnerabilities" ResourceCISDockerBenchmarkCheckTableName = "resource_cis_d_b_checks" )
const DefaultViewRefreshIntervalSecond = 5
Variables ¶
var CVSSSeverityIntToString = map[Severity]models.VulnerabilitySeverity{ NEGLIGIBLE: "", LOW: models.VulnerabilitySeverityLOW, MEDIUM: models.VulnerabilitySeverityMEDIUM, HIGH: models.VulnerabilitySeverityHIGH, CRITICAL: models.VulnerabilitySeverityCRITICAL, }
var ( // IDViewQuery ids_view is base on `resources` table to support detached resources (resource not related to any application). IDViewQuery = `` /* 399-byte string literal not displayed */ )
var LevelStringToInt = map[string]Level{ string(models.CISDockerBenchmarkLevelINFO): CISDockerBenchmarkLevelINFO, string(models.CISDockerBenchmarkLevelWARN): CISDockerBenchmarkLevelWARN, string(models.CISDockerBenchmarkLevelFATAL): CISDockerBenchmarkLevelFATAL, }
var ModelsVulnerabilitySeverityToInt = map[models.VulnerabilitySeverity]Severity{ models.VulnerabilitySeverityNEGLIGIBLE: NEGLIGIBLE, models.VulnerabilitySeverityLOW: LOW, models.VulnerabilitySeverityMEDIUM: MEDIUM, models.VulnerabilitySeverityHIGH: HIGH, models.VulnerabilitySeverityCRITICAL: CRITICAL, }
var SeverityIntToString = map[Severity]models.VulnerabilitySeverity{ NEGLIGIBLE: models.VulnerabilitySeverityNEGLIGIBLE, LOW: models.VulnerabilitySeverityLOW, MEDIUM: models.VulnerabilitySeverityMEDIUM, HIGH: models.VulnerabilitySeverityHIGH, CRITICAL: models.VulnerabilitySeverityCRITICAL, }
var SeverityStringToInt = map[string]Severity{ string(models.VulnerabilitySeverityNEGLIGIBLE): NEGLIGIBLE, string(models.VulnerabilitySeverityLOW): LOW, string(models.VulnerabilitySeverityMEDIUM): MEDIUM, string(models.VulnerabilitySeverityHIGH): HIGH, string(models.VulnerabilitySeverityCRITICAL): CRITICAL, }
var TypesVulnerabilitySeverityToInt = map[types.VulnerabilitySeverity]Severity{ types.VulnerabilitySeverityNEGLIGIBLE: NEGLIGIBLE, types.VulnerabilitySeverityLOW: LOW, types.VulnerabilitySeverityMEDIUM: MEDIUM, types.VulnerabilitySeverityHIGH: HIGH, types.VulnerabilitySeverityCRITICAL: CRITICAL, }
Functions ¶
func ApplicationFromDB ¶
func ApplicationFromDB(view *ApplicationView) *models.Application
func ApplicationResourceFromDB ¶
func ApplicationResourceFromDB(view *ResourceView) *models.ApplicationResource
func ArrayToDBArray ¶
ArrayToDBArray Convert an array element to a DB array element.
func CISDockerBenchmarkResultFromDB ¶
func CISDockerBenchmarkResultFromDB(result *CISDockerBenchmarkCheckView) *models.CISDockerBenchmarkResultsEX
func CreateApplicationID ¶
func CreateApplicationID(app *models.ApplicationInfo) string
func CreateCVSSString ¶
func CreatePackageID ¶
func CreatePackageID(pkgInfo *types.PackageInfo) string
func CreateResourceID ¶
func CreateResourceID(info *types.ResourceInfo) string
func CreateTimeFilter ¶
func CreateVulnerabilityID ¶
func CreateVulnerabilityID(vul *types.PackageVulnerabilityScan) string
func DBArrayToArray ¶
func FieldInTable ¶
func FilterArrayContains ¶
func FilterIsNotNumber ¶
func PackageApplicationResourcesFromDB ¶
func PackageApplicationResourcesFromDB(pri *PackageResourcesInfoView) *models.PackageApplicationResources
func PackageFromDB ¶
func PackageFromDB(view *PackageView) *models.Package
func RuntimeQuickScanConfigFromDB ¶
func RuntimeQuickScanConfigFromDB(config *QuickScanConfig) *models.RuntimeQuickScanConfig
func SeverityFilterGte ¶
func SeverityFilterIs ¶
func SeverityFilterIsNot ¶
func SeverityFilterLte ¶
func ToDBArrayElement ¶
ToDBArrayElement Convert an array element to a DB array element.
func VulnerabilityFromDB ¶
func VulnerabilityFromDB(view *VulnerabilityView) *models.Vulnerability
Types ¶
type Application ¶
type Application struct { ID string `gorm:"primarykey" faker:"-"` // consists of the application name Name string `json:"name,omitempty" gorm:"column:name"` Type models.ApplicationType `json:"type,omitempty" gorm:"column:type" faker:"oneof: IMAGE, DIRECTORY, FILE"` Labels string `json:"labels,omitempty" gorm:"column:labels" faker:"oneof: |label1|, |label1||label2|, |label1||label2||label3|"` Environments string `json:"environments,omitempty" gorm:"column:environments" faker:"oneof: |env1|, |env1||env2|, |env1||env2||env3|"` Resources []Resource `json:"resources,omitempty" gorm:"many2many:application_resources;" faker:"-"` }
func CreateApplication ¶
func CreateApplication(app *models.ApplicationInfo) *Application
func (Application) TableName ¶
func (Application) TableName() string
func (*Application) UpdateApplicationInfo ¶
func (a *Application) UpdateApplicationInfo(app *models.ApplicationInfo) *Application
type ApplicationResources ¶
type ApplicationResources struct { ApplicationID string `json:"application_id,omitempty" gorm:"primarykey;column:application_id"` ResourceID string `json:"resource_id,omitempty" gorm:"primarykey;column:resource_id"` }
ApplicationResources join table of Application and Resource.
type ApplicationTable ¶
type ApplicationTable interface { Create(app *Application, params *TransactionParams) error UpdateInfo(app *Application, params *TransactionParams) error Delete(app *Application) error GetApplicationsAndTotal(params GetApplicationsParams) ([]ApplicationView, int64, error) GetApplication(id string) (*models.ApplicationEx, error) GetDBApplication(id string, shouldGetRelationships bool) (*Application, error) Count(filters *CountFilters) (int64, error) GetMostVulnerable(limit int) ([]*models.Application, error) }
type ApplicationTableHandler ¶
type ApplicationTableHandler struct { IDsView IDsView // contains filtered or unexported fields }
func (*ApplicationTableHandler) Count ¶
func (a *ApplicationTableHandler) Count(filters *CountFilters) (int64, error)
func (*ApplicationTableHandler) Create ¶
func (a *ApplicationTableHandler) Create(app *Application, params *TransactionParams) error
func (*ApplicationTableHandler) Delete ¶
func (a *ApplicationTableHandler) Delete(app *Application) error
func (*ApplicationTableHandler) GetApplication ¶
func (a *ApplicationTableHandler) GetApplication(id string) (*models.ApplicationEx, error)
func (*ApplicationTableHandler) GetApplicationsAndTotal ¶
func (a *ApplicationTableHandler) GetApplicationsAndTotal(params GetApplicationsParams) ([]ApplicationView, int64, error)
func (*ApplicationTableHandler) GetDBApplication ¶
func (a *ApplicationTableHandler) GetDBApplication(id string, shouldGetRelationships bool) (*Application, error)
func (*ApplicationTableHandler) GetMostVulnerable ¶
func (a *ApplicationTableHandler) GetMostVulnerable(limit int) ([]*models.Application, error)
func (*ApplicationTableHandler) UpdateInfo ¶
func (a *ApplicationTableHandler) UpdateInfo(app *Application, params *TransactionParams) error
type ApplicationView ¶
type ApplicationView struct { Application Resources int `json:"resources,omitempty" gorm:"column:resources"` Packages int `json:"packages,omitempty" gorm:"column:packages"` SeverityCounters CISDockerBenchmarkLevelCounters }
type CISDockerBenchmarkCheck ¶
type CISDockerBenchmarkCheck struct { ID string `gorm:"primarykey" faker:"-"` // consists of the Code name Code string `json:"code,omitempty" gorm:"column:code" faker:"oneof: CIS-DI-0006, CIS-DI-0005, CIS-DI-0001"` Level int `json:"level,omitempty" gorm:"column:level" faker:"oneof: 3, 2, 1"` Descriptions string `json:"descriptions" gorm:"column:descriptions" faker:"oneof: desc3, desc2, desc1"` }
func (CISDockerBenchmarkCheck) TableName ¶
func (CISDockerBenchmarkCheck) TableName() string
type CISDockerBenchmarkCheckView ¶
type CISDockerBenchmarkCheckView struct { CISDockerBenchmarkCheck ResourceID string `json:"resource_id,omitempty" gorm:"column:resource_id"` }
type CISDockerBenchmarkLevelCounters ¶
type CISDockerBenchmarkLevelCounters struct { TotalInfoCount int `json:"total_info_count,omitempty" gorm:"column:total_info_count"` TotalWarnCount int `json:"total_warn_count,omitempty" gorm:"column:total_warn_count"` TotalFatalCount int `json:"total_fatal_count,omitempty" gorm:"column:total_fatal_count"` HighestCISDockerBenchmarkLevel int `json:"highest_level,omitempty" gorm:"column:highest_level"` LowestCISDockerBenchmarkLevel int `json:"lowest_level,omitempty" gorm:"column:lowest_level"` }
type CISDockerBenchmarkResultTable ¶
type CISDockerBenchmarkResultTable interface { CountPerLevel(filters *CountFilters) ([]*models.CISDockerBenchmarkLevelCount, error) GetCISDockerBenchmarkResultsAndTotal(params operations.GetCisdockerbenchmarkresultsIDParams) ([]CISDockerBenchmarkCheckView, int64, error) }
type CISDockerBenchmarkResultTableHandler ¶
type CISDockerBenchmarkResultTableHandler struct {
// contains filtered or unexported fields
}
func (*CISDockerBenchmarkResultTableHandler) CountPerLevel ¶
func (c *CISDockerBenchmarkResultTableHandler) CountPerLevel(filters *CountFilters) ([]*models.CISDockerBenchmarkLevelCount, error)
func (*CISDockerBenchmarkResultTableHandler) GetCISDockerBenchmarkResultsAndTotal ¶
func (c *CISDockerBenchmarkResultTableHandler) GetCISDockerBenchmarkResultsAndTotal(params operations.GetCisdockerbenchmarkresultsIDParams) ([]CISDockerBenchmarkCheckView, int64, error)
type CountFilters ¶
type Database ¶
type Database interface { ApplicationTable() ApplicationTable ResourceTable() ResourceTable PackageTable() PackageTable VulnerabilityTable() VulnerabilityTable NewVulnerabilityTable() NewVulnerabilityTable JoinTables() JoinTables IDsView() IDsView ObjectTree() ObjectTree QuickScanConfigTable() QuickScanConfigTable SchedulerTable() SchedulerTable CISDockerBenchmarkResultTable() CISDockerBenchmarkResultTable }
nolint:interfacebloat
type GetApplicationResourcesParams ¶
type GetApplicationResourcesParams struct { operations.GetApplicationResourcesParams // List of application IDs that were affected by the last runtime scan. RuntimeScanApplicationIDs []string }
type GetApplicationsParams ¶
type GetApplicationsParams struct { operations.GetApplicationsParams // List of application IDs that were affected by the last runtime scan. RuntimeScanApplicationIDs []string }
type GetIDsParams ¶
type GetIDsParams struct { FilterIDs []string // The IDs to filter by FilterIDType idType // The ID type to filter by LookupIDType idType // The ID type to lookup for }
type GetPackagesParams ¶
type GetPackagesParams struct { operations.GetPackagesParams // List of application IDs that were affected by the last runtime scan. RuntimeScanApplicationIDs []string }
type GetVulnerabilitiesParams ¶
type GetVulnerabilitiesParams struct { operations.GetVulnerabilitiesParams // List of application IDs that were affected by the last runtime scan. RuntimeScanApplicationIDs []string }
type Handler ¶
type Handler struct { DriverType string DB *gorm.DB ViewRefreshHandler *ViewRefreshHandler }
func (*Handler) ApplicationTable ¶
func (db *Handler) ApplicationTable() ApplicationTable
func (*Handler) CISDockerBenchmarkResultTable ¶
func (db *Handler) CISDockerBenchmarkResultTable() CISDockerBenchmarkResultTable
func (*Handler) JoinTables ¶
func (db *Handler) JoinTables() JoinTables
func (*Handler) NewVulnerabilityTable ¶
func (db *Handler) NewVulnerabilityTable() NewVulnerabilityTable
func (*Handler) ObjectTree ¶
func (db *Handler) ObjectTree() ObjectTree
func (*Handler) PackageTable ¶
func (db *Handler) PackageTable() PackageTable
func (*Handler) QuickScanConfigTable ¶
func (db *Handler) QuickScanConfigTable() QuickScanConfigTable
func (*Handler) RefreshMaterializedViews ¶
func (db *Handler) RefreshMaterializedViews()
func (*Handler) ResourceTable ¶
func (db *Handler) ResourceTable() ResourceTable
func (*Handler) SchedulerTable ¶
func (db *Handler) SchedulerTable() SchedulerTable
func (*Handler) SetMaterializedViewHandler ¶
func (*Handler) VulnerabilityTable ¶
func (db *Handler) VulnerabilityTable() VulnerabilityTable
type IDsView ¶
type IDsView interface {
GetIDs(params GetIDsParams, idsShouldMatch bool) ([]string, error)
}
type IDsViewHandler ¶
func (*IDsViewHandler) GetIDs ¶
func (i *IDsViewHandler) GetIDs(params GetIDsParams, idsShouldMatch bool) ([]string, error)
type JoinTables ¶
type JoinTables interface { DeleteRelationships(params DeleteRelationshipsParams) error // GetResourcePackageIDToAnalyzers returns a map of ResourcePkgID to analyzers list for the given `resourceIDs`, // retrieved from the PackageResources join table. // ResourcePackage is a package that is associated to a resource. // ResourcePackageID is a combination of resource and package ID. GetResourcePackageIDToAnalyzers(resourceIDs []string) (map[ResourcePkgID][]string, error) GetPackageResourcesAndTotal(params operations.GetPackagesIDApplicationResourcesParams) ([]PackageResourcesInfoView, int64, error) GetResourcePackagesByResources(resourceIDs []string) ([]ResourcePackages, error) GetResourcePackagesByPackages(packageIDs []string) ([]ResourcePackages, error) GetPackageVulnerabilitiesByPackages(packageIDs []string) ([]PackageVulnerabilities, error) GetPackageVulnerabilitiesByVulnerabilities(vulnerabilityIDs []string) ([]PackageVulnerabilities, error) }
type JoinTablesHandler ¶
type JoinTablesHandler struct {
// contains filtered or unexported fields
}
func (*JoinTablesHandler) DeleteRelationships ¶
func (j *JoinTablesHandler) DeleteRelationships(params DeleteRelationshipsParams) error
func (*JoinTablesHandler) GetPackageResourcesAndTotal ¶
func (j *JoinTablesHandler) GetPackageResourcesAndTotal(params operations.GetPackagesIDApplicationResourcesParams) ([]PackageResourcesInfoView, int64, error)
func (*JoinTablesHandler) GetPackageVulnerabilitiesByPackages ¶
func (j *JoinTablesHandler) GetPackageVulnerabilitiesByPackages(packageIDs []string) ([]PackageVulnerabilities, error)
func (*JoinTablesHandler) GetPackageVulnerabilitiesByVulnerabilities ¶
func (j *JoinTablesHandler) GetPackageVulnerabilitiesByVulnerabilities(vulnerabilityIDs []string) ([]PackageVulnerabilities, error)
func (*JoinTablesHandler) GetResourcePackageIDToAnalyzers ¶
func (j *JoinTablesHandler) GetResourcePackageIDToAnalyzers(resourceIDs []string) (map[ResourcePkgID][]string, error)
func (*JoinTablesHandler) GetResourcePackagesByPackages ¶
func (j *JoinTablesHandler) GetResourcePackagesByPackages(packageIDs []string) ([]ResourcePackages, error)
func (*JoinTablesHandler) GetResourcePackagesByResources ¶
func (j *JoinTablesHandler) GetResourcePackagesByResources(resourceIDs []string) ([]ResourcePackages, error)
type MockHandler ¶
type MockHandler struct {
*MockResourceTable
}
func (*MockHandler) ApplicationTable ¶
func (m *MockHandler) ApplicationTable() ApplicationTable
func (*MockHandler) CISDockerBenchmarkResultTable ¶
func (m *MockHandler) CISDockerBenchmarkResultTable() CISDockerBenchmarkResultTable
func (*MockHandler) IDsView ¶
func (m *MockHandler) IDsView() IDsView
func (*MockHandler) JoinTables ¶
func (m *MockHandler) JoinTables() JoinTables
func (*MockHandler) NewVulnerabilityTable ¶
func (m *MockHandler) NewVulnerabilityTable() NewVulnerabilityTable
func (*MockHandler) ObjectTree ¶
func (m *MockHandler) ObjectTree() ObjectTree
func (*MockHandler) PackageTable ¶
func (m *MockHandler) PackageTable() PackageTable
func (*MockHandler) QuickScanConfigTable ¶
func (m *MockHandler) QuickScanConfigTable() QuickScanConfigTable
func (*MockHandler) ResourceTable ¶
func (m *MockHandler) ResourceTable() ResourceTable
func (*MockHandler) SchedulerTable ¶
func (m *MockHandler) SchedulerTable() SchedulerTable
func (*MockHandler) VulnerabilityTable ¶
func (m *MockHandler) VulnerabilityTable() VulnerabilityTable
type MockResourceTable ¶
type MockResourceTable struct {
// contains filtered or unexported fields
}
MockResourceTable is a mock of ResourceTable interface
func NewMockResourceTable ¶
func NewMockResourceTable(ctrl *gomock.Controller) *MockResourceTable
NewMockResourceTable creates a new mock instance
func (*MockResourceTable) Count ¶
func (m *MockResourceTable) Count(arg0 *CountFilters) (int64, error)
Count mocks base method
func (*MockResourceTable) Create ¶
func (m *MockResourceTable) Create(arg0 *Resource) error
Create mocks base method
func (*MockResourceTable) Delete ¶
func (m *MockResourceTable) Delete(arg0 *Resource) error
Delete mocks base method
func (*MockResourceTable) EXPECT ¶
func (m *MockResourceTable) EXPECT() *MockResourceTableMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockResourceTable) GetApplicationResource ¶
func (m *MockResourceTable) GetApplicationResource(arg0 string) (*models.ApplicationResourceEx, error)
GetApplicationResource mocks base method
func (*MockResourceTable) GetApplicationResourcesAndTotal ¶
func (m *MockResourceTable) GetApplicationResourcesAndTotal(arg0 GetApplicationResourcesParams) ([]ResourceView, int64, error)
GetApplicationResourcesAndTotal mocks base method
func (*MockResourceTable) GetDBResource ¶
func (m *MockResourceTable) GetDBResource(arg0 string, arg1 bool) (*Resource, error)
GetDBResource mocks base method
func (*MockResourceTable) GetMostVulnerable ¶
func (m *MockResourceTable) GetMostVulnerable(arg0 int) ([]*models.ApplicationResource, error)
GetMostVulnerable mocks base method
type MockResourceTableMockRecorder ¶
type MockResourceTableMockRecorder struct {
// contains filtered or unexported fields
}
MockResourceTableMockRecorder is the mock recorder for MockResourceTable
func (*MockResourceTableMockRecorder) Count ¶
func (mr *MockResourceTableMockRecorder) Count(arg0 interface{}) *gomock.Call
Count indicates an expected call of Count
func (*MockResourceTableMockRecorder) Create ¶
func (mr *MockResourceTableMockRecorder) Create(arg0 interface{}) *gomock.Call
Create indicates an expected call of Create
func (*MockResourceTableMockRecorder) Delete ¶
func (mr *MockResourceTableMockRecorder) Delete(arg0 interface{}) *gomock.Call
Delete indicates an expected call of Delete
func (*MockResourceTableMockRecorder) GetApplicationResource ¶
func (mr *MockResourceTableMockRecorder) GetApplicationResource(arg0 interface{}) *gomock.Call
GetApplicationResource indicates an expected call of GetApplicationResource
func (*MockResourceTableMockRecorder) GetApplicationResourcesAndTotal ¶
func (mr *MockResourceTableMockRecorder) GetApplicationResourcesAndTotal(arg0 interface{}) *gomock.Call
GetApplicationResourcesAndTotal indicates an expected call of GetApplicationResourcesAndTotal
func (*MockResourceTableMockRecorder) GetDBResource ¶
func (mr *MockResourceTableMockRecorder) GetDBResource(arg0, arg1 interface{}) *gomock.Call
GetDBResource indicates an expected call of GetDBResource
func (*MockResourceTableMockRecorder) GetMostVulnerable ¶
func (mr *MockResourceTableMockRecorder) GetMostVulnerable(arg0 interface{}) *gomock.Call
GetMostVulnerable indicates an expected call of GetMostVulnerable
type NewVulnerability ¶
type NewVulnerability struct { ID string `gorm:"primarykey"` // consists of the vulnerability ID + package ID (PkgVulID) VulID string `json:"vul_id,omitempty" gorm:"column:vul_id"` AddedAt time.Time `json:"added_at,omitempty" gorm:"column:added_at" faker:"-"` }
func (NewVulnerability) TableName ¶
func (NewVulnerability) TableName() string
type NewVulnerabilityTable ¶
type NewVulnerabilityTable interface { Create(vul *NewVulnerability) error CreateNewVulnerabilitiesTrends(application *Application) error GetNewVulnerabilitiesTrends(params operations.GetDashboardTrendsVulnerabilitiesParams) ([]*models.NewVulnerabilitiesTrend, error) }
type NewVulnerabilityTableHandler ¶
type NewVulnerabilityTableHandler struct {
// contains filtered or unexported fields
}
func (*NewVulnerabilityTableHandler) Create ¶
func (v *NewVulnerabilityTableHandler) Create(vul *NewVulnerability) error
func (*NewVulnerabilityTableHandler) CreateNewVulnerabilitiesTrends ¶
func (v *NewVulnerabilityTableHandler) CreateNewVulnerabilitiesTrends(application *Application) error
func (*NewVulnerabilityTableHandler) GetNewVulnerabilitiesTrends ¶
func (v *NewVulnerabilityTableHandler) GetNewVulnerabilitiesTrends(params operations.GetDashboardTrendsVulnerabilitiesParams) ([]*models.NewVulnerabilitiesTrend, error)
type NewVulnerabilityView ¶
type NewVulnerabilityView struct { AddedAt time.Time `json:"added_at,omitempty" gorm:"column:added_at" faker:"-"` SeverityCounters }
type ObjectTree ¶
type ObjectTree interface { SetApplication(app *Application, params *TransactionParams, shouldUpdatePackageVulnerabilities bool) error SetResource(resource *Resource, params *TransactionParams, shouldUpdatePackageVulnerabilities bool) error }
type ObjectTreeHandler ¶
type ObjectTreeHandler struct { DriverType string // contains filtered or unexported fields }
func (*ObjectTreeHandler) SetApplication ¶
func (o *ObjectTreeHandler) SetApplication(app *Application, params *TransactionParams, shouldUpdatePackageVulnerabilities bool) error
func (*ObjectTreeHandler) SetResource ¶
func (o *ObjectTreeHandler) SetResource(resource *Resource, params *TransactionParams, shouldUpdatePackageVulnerabilities bool) error
type Package ¶
type Package struct { ID string `gorm:"primarykey" faker:"-"` // consists of the package name + version Name string `json:"name,omitempty" gorm:"column:name" faker:"oneof: pkg1, pkg2, pkg3"` Version string `json:"version,omitempty" gorm:"column:version" faker:"oneof: v1, v2, v3"` License string `json:"license,omitempty" gorm:"column:license" faker:"oneof: MIT, , Apache 2.0"` Language string `json:"language,omitempty" gorm:"column:language" faker:"oneof: go, , java, python"` Vulnerabilities []Vulnerability `json:"vulnerabilities,omitempty" gorm:"many2many:package_vulnerabilities" faker:"-"` }
func CreatePackage ¶
func CreatePackage(pkg *types.PackageInfo, vuls []Vulnerability) *Package
func CreatePackageFromContentAnalysis ¶
func CreatePackageFromContentAnalysis(pkgInfo *models.PackageInfo) *Package
func CreatePackageFromRuntimeContentAnalysis ¶
func CreatePackageFromRuntimeContentAnalysis(pkgInfo *runtime_scan_models.PackageInfo) *Package
type PackageResourcesInfoView ¶
type PackageResourcesInfoView struct { ResourcePackages ResourceName string `json:"resource_name,omitempty" gorm:"column:resource_name"` ResourceHash string `json:"resource_hash,omitempty" gorm:"column:resource_hash"` }
func (PackageResourcesInfoView) TableName ¶
func (PackageResourcesInfoView) TableName() string
type PackageTable ¶
type PackageTable interface { Create(pkg *Package) error GetPackagesAndTotal(params GetPackagesParams) ([]PackageView, int64, error) GetPackage(id string) (*models.Package, error) GetPackagesCountPerLanguage() ([]*models.PackagesCountPerLanguage, error) GetPackagesCountPerLicense() ([]*models.PackagesCountPerLicense, error) Count(filters *CountFilters) (int64, error) GetMostVulnerable(limit int) ([]*models.Package, error) DeleteByIDs(pkgIDs []string) error GetDBPackage(id string) (*Package, error) }
type PackageTableHandler ¶
type PackageTableHandler struct { IDsView IDsView // contains filtered or unexported fields }
func (*PackageTableHandler) Count ¶
func (p *PackageTableHandler) Count(filters *CountFilters) (int64, error)
func (*PackageTableHandler) Create ¶
func (p *PackageTableHandler) Create(pkg *Package) error
func (*PackageTableHandler) DeleteByIDs ¶
func (p *PackageTableHandler) DeleteByIDs(pkgIDs []string) error
func (*PackageTableHandler) GetDBPackage ¶
func (p *PackageTableHandler) GetDBPackage(id string) (*Package, error)
func (*PackageTableHandler) GetMostVulnerable ¶
func (p *PackageTableHandler) GetMostVulnerable(limit int) ([]*models.Package, error)
func (*PackageTableHandler) GetPackage ¶
func (p *PackageTableHandler) GetPackage(id string) (*models.Package, error)
func (*PackageTableHandler) GetPackagesAndTotal ¶
func (p *PackageTableHandler) GetPackagesAndTotal(params GetPackagesParams) ([]PackageView, int64, error)
func (*PackageTableHandler) GetPackagesCountPerLanguage ¶
func (p *PackageTableHandler) GetPackagesCountPerLanguage() ([]*models.PackagesCountPerLanguage, error)
func (*PackageTableHandler) GetPackagesCountPerLicense ¶
func (p *PackageTableHandler) GetPackagesCountPerLicense() ([]*models.PackagesCountPerLicense, error)
type PackageView ¶
type PackageView struct { Package Applications int `json:"applications,omitempty" gorm:"column:applications"` Resources int `json:"resources,omitempty" gorm:"column:resources"` SeverityCounters }
type PackageVulnerabilities ¶
type PackageVulnerabilities struct { PackageID string `json:"package_id,omitempty" gorm:"primarykey;column:package_id"` VulnerabilityID string `json:"vulnerability_id,omitempty" gorm:"primarykey;column:vulnerability_id"` FixVersion string `json:"fix_version,omitempty" gorm:"column:fix_version"` }
PackageVulnerabilities join table of Package and Vulnerability.
func (*PackageVulnerabilities) BeforeSave ¶
func (pv *PackageVulnerabilities) BeforeSave(db *gorm.DB) error
type QuickScanConfig ¶
type QuickScanConfig struct { ID string `gorm:"primarykey" faker:"-"` CISDockerBenchmarkEnabled bool `json:"cis_docker_benchmark_enabled,omitempty" gorm:"column:cis_docker_benchmark_enabled"` MaxScanParallelism int64 `json:"max_scan_parallelism,omitempty" gorm:"column:max_scan_parallelism"` }
func DBQuickScanConfigFromAPI ¶
func DBQuickScanConfigFromAPI(runtimeQuickScanConfig *models.RuntimeQuickScanConfig) *QuickScanConfig
func (QuickScanConfig) TableName ¶
func (QuickScanConfig) TableName() string
type QuickScanConfigTable ¶
type QuickScanConfigTable interface { Get() (*models.RuntimeQuickScanConfig, error) Set(conf *models.RuntimeQuickScanConfig) error SetDefault() error }
type QuickScanConfigTableHandler ¶
type QuickScanConfigTableHandler struct {
// contains filtered or unexported fields
}
func (*QuickScanConfigTableHandler) Get ¶
func (q *QuickScanConfigTableHandler) Get() (*models.RuntimeQuickScanConfig, error)
func (*QuickScanConfigTableHandler) Set ¶
func (q *QuickScanConfigTableHandler) Set(conf *models.RuntimeQuickScanConfig) error
func (*QuickScanConfigTableHandler) SetDefault ¶
func (q *QuickScanConfigTableHandler) SetDefault() error
type Resource ¶
type Resource struct { ID string `gorm:"primarykey" faker:"-"` // consists of the resource hash Hash string `json:"hash,omitempty" gorm:"column:hash" faker:"oneof: hash1, hash2, hash3"` Name string `json:"name,omitempty" gorm:"column:name" faker:"oneof: resource1, resource2, resource3"` Type types.ResourceType `json:"type,omitempty" gorm:"column:type" faker:"oneof: IMAGE, DIRECTORY, FILE"` SbomID string `json:"sbom_id,omitempty" gorm:"column:sbom_id" faker:"oneof: smobID1, smobID2, smobID3"` ReportingAnalyzers string `json:"reporting_analyzers,omitempty" gorm:"column:reporting_analyzers" faker:"oneof: |analyzer1|, |analyzer1||analyzer2|"` Packages []Package `json:"packages,omitempty" gorm:"many2many:resource_packages;" faker:"-"` CISDockerBenchmarkChecks []CISDockerBenchmarkCheck `json:"cis_d_b_checks,omitempty" gorm:"many2many:resource_cis_d_b_checks;" faker:"-"` }
func CreateResource ¶
func CreateResource(info *types.ResourceInfo) *Resource
func CreateResourceFromContentAnalysis ¶
func CreateResourceFromContentAnalysis(resourceContentAnalysis *models.ResourceContentAnalysis, params *TransactionParams) *Resource
func CreateResourceFromRuntimeContentAnalysis ¶
func CreateResourceFromRuntimeContentAnalysis(resourceContentAnalysis *runtime_scan_models.ResourceContentAnalysis, params *TransactionParams) *Resource
func CreateResourceFromVulnerabilityScan ¶
func CreateResourceFromVulnerabilityScan(resourceVulnerabilityScan *types.ResourceVulnerabilityScan, params *TransactionParams) *Resource
func UpdateResourceAnalyzers ¶
func UpdateResourceAnalyzers(resources []Resource, resourcePkgIDToAnalyzers map[ResourcePkgID][]string) []Resource
func (*Resource) WithAnalyzers ¶
func (*Resource) WithCISDockerBenchmarkChecks ¶
func (r *Resource) WithCISDockerBenchmarkChecks(checks []CISDockerBenchmarkCheck) *Resource
func (*Resource) WithPackages ¶
type ResourceCISDBChecks ¶
type ResourceCISDBChecks struct { CISDockerBenchmarkCheckID string `json:"cis_docker_benchmark_check_id,omitempty" gorm:"primarykey;column:cis_docker_benchmark_check_id"` ResourceID string `json:"resource_id,omitempty" gorm:"primarykey;column:resource_id"` }
ResourceCISDBChecks join table of Resource and CISDockerBenchmarkCheck.
func (ResourceCISDBChecks) TableName ¶
func (ResourceCISDBChecks) TableName() string
type ResourcePackages ¶
type ResourcePackages struct { ResourceID string `json:"resource_id,omitempty" gorm:"primarykey;column:resource_id"` PackageID string `json:"package_id,omitempty" gorm:"primarykey;column:package_id"` Analyzers string `json:"analyzers,omitempty" gorm:"column:analyzers"` }
ResourcePackages join table of Resource and Package.
func (*ResourcePackages) BeforeSave ¶
func (rp *ResourcePackages) BeforeSave(db *gorm.DB) error
type ResourcePkgID ¶
type ResourcePkgID string
func CreateResourcePkgID ¶
func CreateResourcePkgID(resourceID, pkgID string) ResourcePkgID
type ResourceTable ¶
type ResourceTable interface { Create(resource *Resource) error GetApplicationResourcesAndTotal(params GetApplicationResourcesParams) ([]ResourceView, int64, error) GetApplicationResource(id string) (*models.ApplicationResourceEx, error) GetDBResource(id string, shouldGetRelationships bool) (*Resource, error) Count(filters *CountFilters) (int64, error) GetMostVulnerable(limit int) ([]*models.ApplicationResource, error) Delete(resource *Resource) error }
type ResourceTableHandler ¶
type ResourceTableHandler struct { IDsView IDsView // contains filtered or unexported fields }
func (*ResourceTableHandler) Count ¶
func (r *ResourceTableHandler) Count(filters *CountFilters) (int64, error)
func (*ResourceTableHandler) Create ¶
func (r *ResourceTableHandler) Create(resource *Resource) error
func (*ResourceTableHandler) Delete ¶
func (r *ResourceTableHandler) Delete(resource *Resource) error
func (*ResourceTableHandler) GetApplicationResource ¶
func (r *ResourceTableHandler) GetApplicationResource(id string) (*models.ApplicationResourceEx, error)
func (*ResourceTableHandler) GetApplicationResourcesAndTotal ¶
func (r *ResourceTableHandler) GetApplicationResourcesAndTotal(params GetApplicationResourcesParams) ([]ResourceView, int64, error)
func (*ResourceTableHandler) GetDBResource ¶
func (r *ResourceTableHandler) GetDBResource(id string, shouldGetRelationships bool) (*Resource, error)
func (*ResourceTableHandler) GetMostVulnerable ¶
func (r *ResourceTableHandler) GetMostVulnerable(limit int) ([]*models.ApplicationResource, error)
type ResourceView ¶
type ResourceView struct { Resource Applications int `json:"applications,omitempty" gorm:"column:applications"` Packages int `json:"packages,omitempty" gorm:"column:packages"` SeverityCounters CISDockerBenchmarkLevelCounters }
type Scheduler ¶
type SchedulerTable ¶
type SchedulerTableHandler ¶
type SchedulerTableHandler struct {
// contains filtered or unexported fields
}
func (*SchedulerTableHandler) Get ¶
func (s *SchedulerTableHandler) Get() (*Scheduler, error)
func (*SchedulerTableHandler) Set ¶
func (s *SchedulerTableHandler) Set(scheduler *Scheduler) error
func (*SchedulerTableHandler) UpdateNextScanTime ¶
func (s *SchedulerTableHandler) UpdateNextScanTime(t string) error
type SeverityCounters ¶
type SeverityCounters struct { TotalNegCount int `json:"total_neg_count,omitempty" gorm:"column:total_neg_count"` TotalLowCount int `json:"total_low_count,omitempty" gorm:"column:total_low_count"` TotalMediumCount int `json:"total_medium_count,omitempty" gorm:"column:total_medium_count"` TotalHighCount int `json:"total_high_count,omitempty" gorm:"column:total_high_count"` TotalCriticalCount int `json:"total_critical_count,omitempty" gorm:"column:total_critical_count"` HighestSeverity int `json:"highest_severity,omitempty" gorm:"column:highest_severity"` LowestSeverity int `json:"lowest_severity,omitempty" gorm:"column:lowest_severity"` }
type TransactionParams ¶
type TransactionParams struct { // map package.id + vulnerability.id to fix version FixVersions map[PkgVulID]string // map resource.id + package.id to analyzers list Analyzers map[ResourcePkgID][]string // map resource.id + package.id to scanners list Scanners map[ResourcePkgID][]string Timestamp time.Time VulnerabilitySource models.VulnerabilitySource }
type ViewRefreshHandler ¶
type ViewRefreshHandler struct {
// contains filtered or unexported fields
}
func (*ViewRefreshHandler) GetAndClearChanges ¶
func (vh *ViewRefreshHandler) GetAndClearChanges() map[string]bool
func (*ViewRefreshHandler) IsSetViewRefreshHandler ¶
func (vh *ViewRefreshHandler) IsSetViewRefreshHandler() bool
func (*ViewRefreshHandler) TableChanged ¶
func (vh *ViewRefreshHandler) TableChanged(table string)
type Vulnerability ¶
type Vulnerability struct { ID string `gorm:"primarykey" faker:"-"` // consists of the vulnerability name Name string `json:"name,omitempty" gorm:"column:name" faker:"oneof: vul1, vul2, vul3, vul4, vul5"` ScannedAt time.Time `json:"scanned_at,omitempty" gorm:"column:scanned_at" faker:"-"` Severity int `json:"severity,omitempty" gorm:"column:severity" faker:"oneof: 3, 2, 1, 0"` Description string `json:"description,omitempty" gorm:"column:description" faker:"-"` Links string `json:"links,omitempty" gorm:"column:links" faker:"oneof: |link1|, |link1||link2|"` // Serialized CVSS struct CVSS string `json:"cvss,omitempty" gorm:"column:cvss" faker:"-"` CVSSBaseScore float64 `json:"cvss_base_score,omitempty" gorm:"column:cvss_base_score" faker:"-"` CVSSSeverity int `json:"cvss_severity,omitempty" gorm:"column:cvss_severity" faker:"-"` ReportingScanners string `json:"reporting_scanners,omitempty" gorm:"column:reporting_scanners" faker:"oneof: |scanner1|, |scanner1||scanner2|"` Source models.VulnerabilitySource `json:"source,omitempty" gorm:"column:source" faker:"oneof: CICD, RUNTIME"` }
func CreateVulnerability ¶
func CreateVulnerability(vul *types.PackageVulnerabilityScan, params *TransactionParams) Vulnerability
func (Vulnerability) TableName ¶
func (Vulnerability) TableName() string
type VulnerabilityTable ¶
type VulnerabilityTable interface { Create(vul *Vulnerability) error GetVulnerability(vulID, pkgID string) (*models.VulnerabilityEx, error) GetVulnerabilitiesAndTotal(params GetVulnerabilitiesParams) ([]VulnerabilityView, int64, error) CountVulnerabilitiesWithFix() ([]*models.VulnerabilitiesWithFix, error) CountPerSeverity(filters *CountFilters) ([]*models.VulnerabilityCount, error) Count(filters *CountFilters) (int64, error) DeleteByIDs(vulIDs []string) error GetDBVulnerability(id string) (*Vulnerability, error) }
type VulnerabilityTableHandler ¶
type VulnerabilityTableHandler struct { IDsView IDsView // contains filtered or unexported fields }
func (*VulnerabilityTableHandler) Count ¶
func (v *VulnerabilityTableHandler) Count(filters *CountFilters) (int64, error)
func (*VulnerabilityTableHandler) CountPerSeverity ¶
func (v *VulnerabilityTableHandler) CountPerSeverity(filters *CountFilters) ([]*models.VulnerabilityCount, error)
func (*VulnerabilityTableHandler) CountVulnerabilitiesWithFix ¶
func (v *VulnerabilityTableHandler) CountVulnerabilitiesWithFix() ([]*models.VulnerabilitiesWithFix, error)
func (*VulnerabilityTableHandler) Create ¶
func (v *VulnerabilityTableHandler) Create(vul *Vulnerability) error
func (*VulnerabilityTableHandler) DeleteByIDs ¶
func (v *VulnerabilityTableHandler) DeleteByIDs(vulIDs []string) error
func (*VulnerabilityTableHandler) GetDBVulnerability ¶
func (v *VulnerabilityTableHandler) GetDBVulnerability(id string) (*Vulnerability, error)
func (*VulnerabilityTableHandler) GetVulnerabilitiesAndTotal ¶
func (v *VulnerabilityTableHandler) GetVulnerabilitiesAndTotal(params GetVulnerabilitiesParams) ([]VulnerabilityView, int64, error)
func (*VulnerabilityTableHandler) GetVulnerability ¶
func (v *VulnerabilityTableHandler) GetVulnerability(vulID, pkgID string) (*models.VulnerabilityEx, error)
type VulnerabilityView ¶
type VulnerabilityView struct { Vulnerability Resources int `json:"resources,omitempty" gorm:"column:resources"` Applications int `json:"applications,omitempty" gorm:"column:applications"` PackageID string `json:"package_id,omitempty" gorm:"column:package_id"` PackageName string `json:"package_name,omitempty" gorm:"column:package_name"` PackageVersion string `json:"package_version,omitempty" gorm:"column:package_version"` FixVersion string `json:"fix_version,omitempty" gorm:"column:fix_version"` }
Source Files ¶
- application.go
- cis_docker_benchmark_level.go
- cis_docker_benchmark_result.go
- common.go
- database.go
- fake.go
- full_tree.go
- id_view.go
- join_tables.go
- license_view.go
- mock_database.go
- mock_resource_table.go
- new_vulnerability.go
- package.go
- package_resource_info_view.go
- quickscan.go
- refresh_materialized_views.go
- resource.go
- scheduler.go
- severity.go
- vulnerability.go