postgresmodels

package
v0.0.217 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttackChainNode added in v0.0.205

type AttackChainNode struct {
	gorm.Model           // ID, CreatedAt, UpdatedAt, DeletedAt - ID is required for linking nodes
	Name          string `gorm:"not null"`
	AttackChainID string `gorm:"not null"` // hash of cluster/resourceID
	CustomerGUID  string `gorm:"not null"`
	IsRoot        bool   `gorm:"not null"`
}

func (AttackChainNode) TableName added in v0.0.205

func (AttackChainNode) TableName() string

type AttackChainNodeControlsRelation added in v0.0.205

type AttackChainNodeControlsRelation struct {
	BaseModel
	NodeID uint            `gorm:"primaryKey; not null"`
	Node   AttackChainNode `gorm:"foreignKey:NodeID"`

	// ControlID = failed or ignored control ID that is associated with the node.
	ControlID string `gorm:"primaryKey; type:varchar(255);not null"`
}

func (AttackChainNodeControlsRelation) TableName added in v0.0.205

type AttackChainNodeImageScanRelation added in v0.0.205

type AttackChainNodeImageScanRelation struct {
	BaseModel
	NodeID uint            `gorm:"primaryKey; not null"`
	Node   AttackChainNode `gorm:"foreignKey:NodeID"`

	// ImageScanId = hash of customerGUID, cluster, containerSpecID
	// Should be used instead of ContainersScanID
	ImageScanId string `gorm:"primaryKey; not null"`
}

func (AttackChainNodeImageScanRelation) TableName added in v0.0.205

type AttackChainNodeRelatedResourcesRelation added in v0.0.205

type AttackChainNodeRelatedResourcesRelation struct {
	BaseModel
	NodeID     uint            `gorm:"primaryKey; not null"`
	Node       AttackChainNode `gorm:"foreignKey:NodeID"`
	ResourceID string          `gorm:"primaryKey; not null"`
}

func (AttackChainNodeRelatedResourcesRelation) TableName added in v0.0.205

type AttackChainNodeRelation added in v0.0.205

type AttackChainNodeRelation struct {
	BaseModel
	ParentNode   AttackChainNode `gorm:"foreignKey:ParentNodeID"`
	ParentNodeID uint            `gorm:"primaryKey; not null"`
	ChildNode    AttackChainNode `gorm:"foreignKey:ChildNodeID"`
	ChildNodeID  uint            `gorm:"primaryKey; not null"`
}

func (AttackChainNodeRelation) TableName added in v0.0.205

func (AttackChainNodeRelation) TableName() string

type AttackChainState added in v0.0.217

type AttackChainState struct {
	// BaseModel.CreatedAt is the former FirstSeen and CreationTime which are the same
	BaseModel

	// primary keys
	AttackChainID   string `gorm:"primaryKey;not null"` // name/cluster/resourceID
	CustomerGUID    string `gorm:"primaryKey;not null"`
	AttackTrackName string `gorm:"primaryKey;not null"`

	AttackTrackDescription string

	// attributes["cluster"], attributes["namespace"], attributes["kind"], attributes["name"]
	Resource     datatypes.JSON // designator attributes
	ResourceHash string         `gorm:"not null"` // hash of resource name/namespace/kind/apiversion/cluster (Extracted from designator attribues)
	ClusterName  string         `gorm:"not null"`

	LatestReportGUID string `gorm:"not null"` // latest reportGUID in which this attack chain was identified

	Status string // "active"/ "fixed"

	// processing status is updated by the UI once a scan is initiated for all relevant clusters (connected) of the customerGUID.
	// "done" is updated by the attack chain engine once finished processing.
	ProcessingStatus string    `gorm:"not null"` // "processing"/ "done"
	ViewedMainScreen time.Time // updated by UI - if the attack chain was viewed by the user// New badge

	RootNode   AttackChainNode `gorm:"foreignKey:RootNodeID"`
	RootNodeID uint            `gorm:"not null"`
}

func (AttackChainState) TableName added in v0.0.217

func (AttackChainState) TableName() string

type BaseModel

type BaseModel struct {
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

type BaseReport added in v0.0.212

type BaseReport struct {

	// Total number of chunks expected. Will be populated with the (ReportNumber of the LastReport + 1) (IsLastReport == true)
	// If not known yet (i.e. IsLastReport not recieved yet), will be set to -1
	TotalChunksExpected int

	//specify the total number of chunks recieved so far - will be increment by one on each chunk recieved.
	TotalChunksRecieved int

	// set to True when TotalChunksExpected == TotalChunksRecieved
	Completed bool
}

type ContextualVulnerabilityFinding added in v0.0.182

type ContextualVulnerabilityFinding struct {
	VulnerabilityFinding     `gorm:"embedded"`
	VulnerabilityScanSummary VulnerabilityScanSummary `gorm:"foreignKey:ImageScanId"`
}

ContextualVulnerabilityFinding is a VulnerabilityFinding with a VulnerabilityScanSummary, do not auto-migrate it uses only for retreiving data from db

func (ContextualVulnerabilityFinding) TableName added in v0.0.182

type Vulnerability

type Vulnerability struct {
	BaseModel
	Name          string `gorm:"primaryKey"`
	Severity      string
	SeverityScore int
	IsRCE         bool
	Links         pq.StringArray `gorm:"type:text[]"`
	Description   string
}

type VulnerabilityFinding

type VulnerabilityFinding struct {
	BaseModel
	VulnerabilityName string        `gorm:"primaryKey"`
	Vulnerability     Vulnerability `gorm:"foreignKey:VulnerabilityName"`
	ImageScanId       string        `gorm:"primaryKey"`
	Component         string        `gorm:"primaryKey"`
	ComponentVersion  string        `gorm:"primaryKey"`
	LayerHash         string        `gorm:"primaryKey"`
	FixAvailable      *bool
	FixedInVersion    string
	LayerIndex        *int
	LayerCommand      string
	IsRelevant        *bool
	RelevantLabel     string
	IsIgnored         *bool
	IgnoreRuleIds     pq.StringArray `gorm:"type:text[]"`
}

type VulnerabilityScanSummary

type VulnerabilityScanSummary struct {
	BaseModel
	BaseReport
	ScanKind                   string
	ImageScanId                string `gorm:"primaryKey"`
	ContainerSpecId            string
	Timestamp                  time.Time
	CustomerGuid               string
	Wlid                       string
	Designators                datatypes.JSON
	ImageRegistry              string
	ImageRepository            string
	ImageTag                   string
	ImageHash                  string
	JobIds                     pq.StringArray `gorm:"type:text[]"`
	Status                     string
	Errors                     pq.StringArray               `gorm:"type:text[]"`
	Findings                   []VulnerabilityFinding       `gorm:"foreignKey:ImageScanId"`
	VulnerabilitySeverityStats []VulnerabilitySeverityStats `gorm:"foreignKey:ImageScanId"`
	IsStub                     *bool                        // if true, this is a stub scan summary, and the actual scan summary is not yet available. Should be deleted once we have the real one.
}

type VulnerabilitySeverityStats added in v0.0.179

type VulnerabilitySeverityStats struct {
	BaseModel
	ImageScanId                  string         `gorm:"primaryKey"`
	Severity                     string         `gorm:"primaryKey"`
	DayDate                      datatypes.Date `gorm:"primaryKey"`
	SeverityScore                int
	TotalCount                   int64
	RCEFixCount                  int64
	FixAvailableOfTotalCount     int64
	RelevantCount                int64
	FixAvailableForRelevantCount int64
	RCECount                     int64
	UrgentCount                  int64
	NeglectedCount               int64
	HealthStatus                 string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL