types

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Image      ScanType = 1
	Tarball    ScanType = 2
	Filesystem ScanType = 3

	JSON          OutputFormat = "json"
	Table         OutputFormat = "table"
	CycloneDXJSON OutputFormat = "cdx-json"
	CycloneDXXML  OutputFormat = "cdx-xml"
	SPDXJSON      OutputFormat = "spdx-json"
	SPDXXML       OutputFormat = "spdx-xml"
	SPDXTag       OutputFormat = "spdx-tag"
	SnapshotJSON  OutputFormat = "snapshot-json"
)
View Source
const ConfigVersion string = "1.0"
View Source
const SchemaVersion = "1.0"

Variables

This section is empty.

Functions

func GetAllOutputFormat

func GetAllOutputFormat() string

func IsValidOutputFormat

func IsValidOutputFormat(format string) bool

func MakeNid

func MakeNid() string

Types

type AttestationConfig

type AttestationConfig struct {
	Key      string `yaml:"key"`
	Pub      string `yaml:"pub"`
	Password string `yaml:"password"`
}

AttestationConfig model

type AttestationOptions

type AttestationOptions struct {
	Key        string
	Pub        string
	AttestType string
	Predicate  string
	Password   string
	OutputFile string
	OutputType string
}

AttestationOptions model

type Component

type Component struct {
	ID              string        `json:"id"`
	Name            string        `json:"name"`
	Version         string        `json:"version"`
	Type            string        `json:"type"`
	PURL            string        `json:"purl,omitempty"`
	Description     string        `json:"description,omitempty"`
	Origin          string        `json:"origin,omitempty"`
	Licenses        []string      `json:"licenses,omitempty"`
	CPEs            []string      `json:"cpes,omitempty"`
	Metadata        interface{}   `json:"metadata,omitempty"`
	Vulnerabilities []interface{} `json:"vulnerabilities,omitempty"`
}

func NewComponent

func NewComponent(name, version, category, origin, desc string, metadata ...interface{}) Component

func (Component) ToJSON

func (c Component) ToJSON() string

type Config

type Config struct {
	Version      string            `json:"version" yaml:"version"`
	MaxFileSize  int64             `json:"max_file_size" yaml:"max_file_size"`
	Registry     RegistryConfig    `json:"registry" yaml:"registry"`
	Attestation  AttestationConfig `json:"attestation" yaml:"attestation"`
	SecretConfig SecretConfig      `json:"secret_config" yaml:"secret_config"`
}

type Distro

type Distro struct {
	PrettyName              string   `json:"prettyName,omitempty"`
	Name                    string   `json:"name,omitempty"`
	ID                      string   `json:"id,omitempty"`
	IDLike                  []string `json:"idLike,omitempty"`
	Version                 string   `json:"version,omitempty"`
	VersionID               string   `json:"versionID,omitempty"`
	DistributionID          string   `json:"distributionID,omitempty"`
	DistributionDescription string   `json:"distributionDescription,omitempty"`
	DistributionCodename    string   `json:"distributionCodename,omitempty"`
	HomeURL                 string   `json:"homeURL,omitempty"`
	SupportURL              string   `json:"supportURL,omitempty"`
	BugReportURL            string   `json:"bugReportURL,omitempty"`
	PrivacyPolicyURL        string   `json:"privacyPolicyURL,omitempty"`
}

type ImageInfo

type ImageInfo struct {
	Digest     v1.Hash         `json:"digest,omitempty"`
	MediaType  types.MediaType `json:"mediatype,omitempty"`
	Size       int64           `json:"size,omitempty"`
	Manifest   v1.Manifest     `json:"manifest,omitempty"`
	ConfigFile v1.ConfigFile   `json:"config_file,omitempty"`
	Layers     []Layer         `json:"layers,omitempty"`
}

type Layer

type Layer struct {
	Digest    v1.Hash         `json:"digest,omitempty"`
	DiffID    v1.Hash         `json:"diff_id,omitempty"`
	Size      int64           `json:"size,omitempty"`
	MediaType types.MediaType `json:"media_type,omitempty"`
}

type ManifestFile

type ManifestFile struct {
	Content []byte
	Size    int64
	Path    string
	Layer   string
}

func (*ManifestFile) ReadArchiveFileContent

func (m *ManifestFile) ReadArchiveFileContent(file *zip.File) error

func (*ManifestFile) ReadContent

func (m *ManifestFile) ReadContent(file *os.File) error

type Metadata

type Metadata struct {
	Author    string    `json:"author"`
	Timestamp time.Time `json:"timestamp"`
	Tool      string    `json:"tool"`
}

type OutputFormat

type OutputFormat string

func (OutputFormat) String

func (o OutputFormat) String() string

type Parameters

type Parameters struct {
	ScanType         ScanType
	Input            string
	OutputFormat     OutputFormat
	SaveToFile       string
	Quiet            bool
	Scanners         []string
	AllowFileListing bool
	Provenance       string
}

func DefaultParameters

func DefaultParameters() Parameters

func (*Parameters) GetScanType

func (p *Parameters) GetScanType() error

type RegistryConfig

type RegistryConfig struct {
	Username string `json:"username" yaml:"username"`
	Password string `json:"password" yaml:"password"`
}

type RpmDB

type RpmDB struct {
	Path         string
	Layer        string
	PackageInfos []rpmdb.PackageInfo
}

func (*RpmDB) ReadDBFile

func (r *RpmDB) ReadDBFile(file string) error

type Rule

type Rule struct {
	ID          string   `json:"id" yaml:"id"`
	Description string   `json:"description" yaml:"description"`
	Pattern     string   `json:"pattern" yaml:"pattern"`
	Keywords    []string `json:"keywords" yaml:"keywords"`
}

type SBOM

type SBOM struct {
	Schema     string `json:"schema"`
	Version    string `json:"version"`
	Serial     string `json:"serial"`
	Metadata   `json:"metadata"`
	Total      int         `json:"total"`
	Components []Component `json:"components"`
}

func NewSBOM

func NewSBOM() SBOM

func (SBOM) ToJSON

func (s SBOM) ToJSON() string

type SLSA

type SLSA struct {
	Provenance map[string]interface{} `json:"provenance,omitempty"`
}

type ScanType

type ScanType int

type Secret

type Secret struct {
	Match       string `json:"match"`
	Description string `json:"description"`
	File        string `json:"file"`
	Content     string `json:"content"`
	Line        int    `json:"line"`
}

Secret model

type SecretConfig

type SecretConfig struct {
	Whitelist Whitelist `json:"whitelist" yaml:"whitelist"`
	Rules     []Rule    `json:"rules" yaml:"rules"`
}

type SoftwareManifest

type SoftwareManifest struct {
	SBOM       interface{} `json:"sbom"`
	Distro     Distro      `json:"distro,omitempty"`
	ImageInfo  ImageInfo   `json:"image_info,omitempty"`
	Secrets    []Secret    `json:"secrets"`
	Files      []string    `json:"files"`
	Parameters Parameters  `json:"parameters"`
	SLSA       SLSA        `json:"slsa"`
	Duration   float64     `json:"duration"`
}

type Whitelist

type Whitelist struct {
	Patterns []string `json:"patterns" yaml:"patterns"`
	Keywords []string `json:"keywords" yaml:"keywords"`
}

Jump to

Keyboard shortcuts

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