container

package
v1.0.22 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package container scans container images for OS and language package vulnerabilities.

Index

Constants

View Source
const MaxDockerfileBytes = 1 << 20

Prevents an attacker-controlled file from forcing a huge allocation.

Variables

This section is empty.

Functions

func FindContainerSpecs added in v1.0.16

func FindContainerSpecs(dir string) []string

FindContainerSpecs walks dir and returns relative paths of Dockerfiles, Containerfiles, and Compose files (skipping vendored / ignored directories).

func ImagesFromFile added in v1.0.16

func ImagesFromFile(rel, content string) []string

ImagesFromFile dispatches to the right parser based on the file's name.

func IsComposePath added in v1.0.16

func IsComposePath(rel string) bool

func IsContainerSpecPath added in v1.0.16

func IsContainerSpecPath(rel string) bool

IsContainerSpecPath returns true for any file we can extract base images from.

func IsDockerfilePath added in v1.0.16

func IsDockerfilePath(rel string) bool

func ParseComposeImages added in v1.0.16

func ParseComposeImages(content string) []string

ParseComposeImages returns the images referenced from each service in a Docker Compose file. Skips services that use `build:` (their Dockerfile is scanned separately) and templated values containing ${…}.

func ParseImages added in v1.0.16

func ParseImages(content string) []string

ParseImages returns FROM image refs, skipping local stages, scratch, and ARG-templated values that can't be resolved without build context.

func ReadDockerfile added in v1.0.16

func ReadDockerfile(dir, rel string) (string, bool)

ReadDockerfile rejects paths that escape dir and caps the read at MaxDockerfileBytes.

Types

type ContainerScanner

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

func NewContainerScanner

func NewContainerScanner() *ContainerScanner

func (*ContainerScanner) Close

func (s *ContainerScanner) Close() error

func (*ContainerScanner) Init

func (s *ContainerScanner) Init(cfg *core.Config) error

func (*ContainerScanner) Name

func (s *ContainerScanner) Name() string

func (*ContainerScanner) Scan

func (s *ContainerScanner) Scan(ctx context.Context, paths []string, findings chan<- core.Finding) error

func (*ContainerScanner) Type

func (s *ContainerScanner) Type() core.ScanType

Jump to

Keyboard shortcuts

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