model

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeletePackagesByNameExceptTags added in v0.0.10

func DeletePackagesByNameExceptTags(db *gorm.DB, name string, excludeTags []string) error

DeletePackagesByNameExceptTags deletes all packages with the given name except those with specified tags.

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.

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.

type HistoryArray added in v0.0.8

type HistoryArray []History

HistoryArray is a custom type for handling JSON serialization of History arrays.

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      HistoryArray `json:"history" gorm:"type:jsonb"`
}

ImageConfig contains the configuration details of the container image.

type JSONStringArray

type JSONStringArray []string

JSONStringArray custom type for handling JSON serialization of string arrays.

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 Package added in v0.0.8

type Package struct {
	CreatedAt  time.Time         `json:"CreatedAt" gorm:"autoCreateTime"`
	UpdatedAt  time.Time         `json:"UpdatedAt" gorm:"autoUpdateTime"`
	Name       string            `json:"Name"`
	Repository string            `json:"Repository"`
	Tag        string            `json:"Tag"`
	Config     types.ZarfPackage `json:"Config" gorm:"serializer:json;type:jsonb"`
	Scans      []Scan            `json:"Scans" gorm:"foreignKey:PackageID;constraint:OnDelete:CASCADE"`
	ID         uint              `json:"ID" gorm:"primaryKey;autoIncrement"`
}

Package represents a collection of scans.

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 Report added in v0.0.10

type Report struct {
	CreatedAt   time.Time       `json:"CreatedAt" gorm:"autoCreateTime"`
	PackageName string          `json:"PackageName" gorm:"not null" index:"idx_package_name"`
	Tag         string          `json:"Tag" gorm:"not null" index:"idx_tag"`
	SBOM        json.RawMessage `json:"SBOM"`
	ID          uint            `json:"ID" gorm:"primaryKey;autoIncrement"`
	Critical    int             `json:"Critical"`
	High        int             `json:"High"`
	Medium      int             `json:"Medium"`
	Low         int             `json:"Low"`
	Info        int             `json:"Info"`
	Total       int             `json:"Total"`
}

Report represents a report of a scan.

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 {
	CreatedAt       time.Time       `json:"CreatedAt" gorm:"autoCreateTime"`
	UpdatedAt       time.Time       `json:"UpdatedAt" gorm:"autoUpdateTime"`
	ArtifactName    string          `json:"ArtifactName"`
	ArtifactType    string          `json:"ArtifactType"`
	Metadata        json.RawMessage `json:"Metadata" gorm:"type:jsonb"`
	Vulnerabilities []Vulnerability `json:"Vulnerabilities" gorm:"foreignKey:ScanID;constraint:OnDelete:CASCADE"`
	Entrypoint      json.RawMessage `json:"Entrypoint" gorm:"type:jsonb"`
	ID              uint            `json:"ID" gorm:"primaryKey;autoIncrement"`
	SchemaVersion   int             `json:"SchemaVersion"`
	PackageID       uint            `json:"PackageID" gorm:"foreignKey:ID;references:ID;constraint:OnDelete:CASCADE"` //nolint:lll
}

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:jsonb"`
	References       References     `json:"References" gorm:"type:jsonb"`
	ScanID           uint           `json:"ScanID" gorm:"index"`
	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