alpine

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2019 License: Apache-2.0 Imports: 19 Imported by: 4

Documentation

Index

Constants

View Source
const (
	Name = "Alpine Linux"
	ID   = "alpine"
)

Common os-release fields applicable for *claircore.Distribution usage.

Variables

View Source
var ReleaseToPrettyName = map[Release]string{
	V3_10: "Alpine Linux v3.10",
	V3_9:  "Alpine Linux v3.9",
	V3_8:  "Alpine Linux v3.8",
	V3_7:  "Alpine Linux v3.7",
	V3_6:  "Alpine Linux v3.6",
	V3_5:  "Alpine Linux v3.5",
	V3_4:  "Alpine Linux v3.4",
	V3_3:  "Alpine Linux v3.3",
}

ReleaseToPrettyName maps a Release to the PrettyName found in alpine's os-release file.

Official Alpine images consistantly have a Pretty_Name field in their os-release files.

Functions

func DBUrl

func DBUrl(release Release, repo Repo) string

DBUrl will return a fqdn'd url for a given release,repo pair

func NewEcosystem

func NewEcosystem(ctx context.Context) *indexer.Ecosystem

NewEcosystem provides the set of scanners and coalescers for the dpkg ecosystem

Types

type Coalescer

type Coalescer struct {
	// contains filtered or unexported fields
}

Coalescer takes individual layer artifacts and coalesces them to form the final image's package results

It is expected to run a coalescer per "ecosystem". For example it would make sense to coalesce results for dpkg, os-release, and apt scanners

func NewCoalescer

func NewCoalescer(store indexer.Store) *Coalescer

NewCoalescer is a constructor for a Coalescer

func (*Coalescer) Coalesce

func (c *Coalescer) Coalesce(ctx context.Context, layers []*claircore.Layer) (*claircore.IndexReport, error)

Coalesce coalesces artifacts found in layers and creates a final IndexReport with the final package details found in the image. This method blocks and when its finished the c.sr field will hold the final IndexReport

type Details

type Details struct {
	Name string `yaml:"name"`
	// fixed package version string mapped to an array of CVE ids affecting the package
	Secfixes map[string][]string `yaml:"secfixes"`
}

Details define a package's name and security fixes for said package

type Matcher

type Matcher struct{}

func (*Matcher) Filter

func (*Matcher) Filter(record *claircore.IndexRecord) bool

func (*Matcher) Query

func (*Matcher) Query() []driver.MatchExp

func (*Matcher) Vulnerable

func (*Matcher) Vulnerable(record *claircore.IndexRecord, vuln *claircore.Vulnerability) bool

type Option

type Option func(*Updater) error

Option configures the provided Updater

func WithURL

func WithURL(url string) Option

WithURL overrides the default URL to fetch an OVAL database.

type Package

type Package struct {
	Pkg Details `yaml:pkg`
}

Package wraps the Details

type Release

type Release string

Release is a particular release of the Alpine linux distribution

const (
	V3_10 Release = "v3.10"
	V3_9  Release = "v3.9"
	V3_8  Release = "v3.8"
	V3_7  Release = "v3.7"
	V3_6  Release = "v3.6"
	V3_5  Release = "v3.5"
	V3_4  Release = "v3.4"
	V3_3  Release = "v3.3"
)

type Repo

type Repo string
const (
	Main      Repo = "main"
	Community Repo = "community"
)

type Scanner

type Scanner struct{}

Scanner scans for packages in an apk database.

The zero value is ready to use.

func (*Scanner) Kind

func (*Scanner) Kind() string

Kind implements indexer.VersionedScanner.

func (*Scanner) Name

func (*Scanner) Name() string

Name implements indexer.VersionedScanner.

func (*Scanner) Scan

func (ps *Scanner) Scan(layer *claircore.Layer) ([]*claircore.Package, error)

Scan proxies the call to ScanContext.

func (*Scanner) ScanContext

func (*Scanner) ScanContext(ctx context.Context, layer *claircore.Layer) ([]*claircore.Package, error)

ScanContext examines a layer for an apk installation database, and extracts the packages listed there.

A return of (nil, nil) is expected if there's no apk database.

func (*Scanner) Version

func (*Scanner) Version() string

Version implements indexer.VersionedScanner.

type SecurityDB

type SecurityDB struct {
	Distroversion string    `yaml:"distroversion"`
	Reponame      string    `yaml:"reponame"`
	Urlprefix     string    `yaml:"urlprefix"`
	Apkurl        string    `yaml:"apkurl"`
	Packages      []Package `yaml:"packages"`
}

SecurityDB is the yaml security database structure

func (*SecurityDB) Parse

func (db *SecurityDB) Parse(contents io.Reader) error

type Updater

type Updater struct {
	// contains filtered or unexported fields
}

func NewUpdater

func NewUpdater(release Release, repo Repo, opts ...Option) (*Updater, error)

NewUpdater returns an updater configured according to the provided Options.

func (*Updater) Fetch

func (u *Updater) Fetch() (io.ReadCloser, string, error)

func (*Updater) FetchContext

func (u *Updater) FetchContext(ctx context.Context, hint driver.Fingerprint) (io.ReadCloser, driver.Fingerprint, error)

func (*Updater) Name

func (u *Updater) Name() string

func (*Updater) Parse

func (u *Updater) Parse(r io.ReadCloser) ([]*claircore.Vulnerability, error)

func (*Updater) ParseContext

func (u *Updater) ParseContext(ctx context.Context, r io.ReadCloser) ([]*claircore.Vulnerability, error)

Jump to

Keyboard shortcuts

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