model

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CVSS

type CVSS map[string]CVSSData

CVSS is a struct that represents the CVSS score.

func (*CVSS) Scan

func (c *CVSS) Scan(value interface{}) error

Scan implements the sql.Scanner interface for database deserialization.

func (CVSS) Value

func (c CVSS) Value() (driver.Value, error)

Value implements the driver.Valuer interface for database serialization.

type CVSSData

type CVSSData struct {
	V3Vector string  `json:"V3Vector"`
	V3Score  float64 `json:"V3Score"`
}

CVSSData is a struct that represents the CVSS data.

type Config

type Config struct {
	ExposedPorts ExposedPorts `json:"ExposedPorts" gorm:"type:jsonb"`
	User         string       `json:"User"`
	WorkingDir   string       `json:"WorkingDir"`
	Entrypoint   []string     `json:"Entrypoint" gorm:"type:text[]"`
	Env          []string     `json:"Env" gorm:"type:text[]"`
}

Config represents the configuration of the container.

type CweIDs

type CweIDs []string

CweIDs is a slice of strings that represents the CWE IDs.

func (*CweIDs) Scan

func (c *CweIDs) Scan(value interface{}) error

Scan implements the sql.Scanner interface for database deserialization.

func (CweIDs) Value

func (c CweIDs) Value() (driver.Value, error)

Value implements the driver.Valuer interface for database serialization.

type DataSource

type DataSource struct {
	ID   string `json:"ID" gorm:"primaryKey"`
	Name string `json:"Name" gorm:"primaryKey"`
	URL  string `json:"URL" gorm:"primaryKey"`
}

DataSource is a struct that represents a data source for vulnerability.

func (*DataSource) Scan

func (d *DataSource) Scan(value interface{}) error

Scan implements the sql.Scanner interface for database deserialization.

func (DataSource) Value

func (d DataSource) Value() (driver.Value, error)

Value implements the driver.Valuer interface for database serialization.

type ExposedPorts

type ExposedPorts map[string]interface{}

ExposedPorts represents the exposed ports of the container.

func (*ExposedPorts) Scan

func (e *ExposedPorts) Scan(value interface{}) error

Scan implements the sql.Scanner interface for database deserialization.

func (ExposedPorts) Value

func (e ExposedPorts) Value() (driver.Value, error)

type History

type History struct {
	Author     string `json:"author,omitempty"`
	Created    string `json:"created"`
	CreatedBy  string `json:"created_by"`
	Comment    string `json:"comment"`
	EmptyLayer bool   `json:"empty_layer,omitempty"`
}

History represents the history of the image.

func (*History) Scan

func (h *History) Scan(value interface{}) error

Scan implements the sql.Scanner interface for database deserialization.

func (History) Value

func (h History) Value() (driver.Value, error)

Value implements the driver.Valuer interface for database serialization.

type ImageConfig

type ImageConfig struct {
	Config       Config    `json:"config" gorm:"embedded"`
	Architecture string    `json:"architecture"`
	Author       string    `json:"author"`
	Created      string    `json:"created"`
	OS           string    `json:"os"`
	RootFS       RootFS    `json:"rootfs" gorm:"embedded"`
	History      []History `json:"history" gorm:"type:text[]"`
}

ImageConfig contains the configuration details of the container image.

type JSONStringArray

type JSONStringArray []string

JSONStringArray custom type for handling JSON serialization of string arrays.

func (*JSONStringArray) Scan

func (j *JSONStringArray) Scan(value interface{}) error

Scan implements the sql.Scanner interface for database deserialization.

func (JSONStringArray) Value

func (j JSONStringArray) Value() (driver.Value, error)

Value implements the driver.Valuer interface for database serialization.

type Layer

type Layer struct {
	Digest string `json:"Digest"`
	DiffID string `json:"DiffID"`
}

Layer is a struct that represents a layer in the image.

type Metadata

type Metadata struct {
	ImageConfig ImageConfig     `json:"ImageConfig" gorm:"embedded"`
	OS          OS              `json:"OS" gorm:"embedded"`
	ImageID     string          `json:"ImageID"`
	DiffIDs     JSONStringArray `json:"DiffIDs" gorm:"type:text"`
	RepoTags    JSONStringArray `json:"RepoTags" gorm:"type:text"`
	RepoDigests JSONStringArray `json:"RepoDigests" gorm:"type:text"`
}

Metadata contains additional information about the scanned artifact.

type OS

type OS struct {
	Family string `json:"Family"`
	Name   string `json:"Name"`
}

OS represents the operating system information.

type PkgIdentifier

type PkgIdentifier struct {
	PURL string `json:"PURL" gorm:"primaryKey"`
	UID  string `json:"UID" gorm:"primaryKey"`
}

PkgIdentifier is a struct that represents a package identifier pURL.

func (*PkgIdentifier) Scan

func (p *PkgIdentifier) Scan(value interface{}) error

Scan implements the sql.Scanner interface for database deserialization.

func (PkgIdentifier) Value

func (p PkgIdentifier) Value() (driver.Value, error)

Value implements the driver.Valuer interface for database serialization.

type References

type References []string

References is a slice of strings that represents the references.

func (*References) Scan

func (r *References) Scan(value interface{}) error

Scan implements the sql.Scanner interface for database deserialization.

func (References) Value

func (r References) Value() (driver.Value, error)

type RootFS

type RootFS struct {
	Type    string   `json:"type"`
	DiffIDs []string `json:"diff_ids" gorm:"type:text[]"`
}

RootFS represents the root filesystem of the image.

type Scan

type Scan struct {
	Metadata        Metadata        `json:"Metadata" gorm:"embedded"`
	CreatedAt       time.Time       `json:"CreatedAt" gorm:"autoCreateTime"`
	UpdatedAt       time.Time       `json:"UpdatedAt" gorm:"autoUpdateTime"`
	ArtifactName    string          `json:"ArtifactName"`
	ArtifactType    string          `json:"ArtifactType"`
	Vulnerabilities []Vulnerability `json:"Vulnerabilities" gorm:"foreignKey:ScanID"`
	ID              uint            `json:"ID" gorm:"primaryKey;autoIncrement"`
	SchemaVersion   int             `json:"SchemaVersion"`
}

Scan represents the result of a vulnerability scan.

type VendorSeverity

type VendorSeverity map[string]int

VendorSeverity is a struct that represents the vendor severity.

func (*VendorSeverity) Scan

func (v *VendorSeverity) Scan(value interface{}) error

Scan implements the sql.Scanner interface for database deserialization.

func (VendorSeverity) Value

func (v VendorSeverity) Value() (driver.Value, error)

Value implements the driver.Valuer interface for database serialization.

type Vulnerability

type Vulnerability struct {
	CreatedAt        time.Time      `json:"CreatedAt" gorm:"autoCreateTime"`
	LastModifiedDate time.Time      `json:"LastModifiedDate" gorm:"type:timestamp"`
	PublishedDate    time.Time      `json:"PublishedDate" gorm:"type:timestamp"`
	UpdatedAt        time.Time      `json:"UpdatedAt" gorm:"autoUpdateTime"`
	CVSS             CVSS           `json:"CVSS" gorm:"type:jsonb"`
	VendorSeverity   VendorSeverity `json:"VendorSeverity" gorm:"type:jsonb"`
	DataSource       DataSource     `json:"DataSource" gorm:"foreignKey:ID,URL;references:ID,URL"`
	Layer            Layer          `json:"Layer" gorm:"embedded"`
	PkgIdentifier    PkgIdentifier  `json:"PkgIdentifier" gorm:"foreignKey:PURL,UID;references:PURL,UID"`
	Description      string         `json:"Description"`
	FixedVersion     string         `json:"FixedVersion"`
	InstalledVersion string         `json:"InstalledVersion"`
	PkgName          string         `json:"PkgName"`
	PkgPath          string         `json:"PkgPath"`
	PrimaryURL       string         `json:"PrimaryURL"`
	Severity         string         `json:"Severity"`
	SeveritySource   string         `json:"SeveritySource"`
	Status           string         `json:"Status"`
	Title            string         `json:"Title"`
	VulnerabilityID  string         `json:"VulnerabilityID"`
	Target           string         `json:"Target"`
	Class            string         `json:"Class"`
	Type             string         `json:"Type"`
	CweIDs           CweIDs         `json:"CweIDs" gorm:"type:text[]"`
	References       References     `json:"References" gorm:"type:text[]"`
	ScanID           uint           `json:"ScanID" gorm:"index"` // Foreign key for the Scan
	ID               uint           `gorm:"primaryKey;autoIncrement"`
}

Vulnerability is a struct that represents a vulnerability.

Jump to

Keyboard shortcuts

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