container

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package container provides a container image scan source. It pulls and inspects OCI/Docker images layer by layer without requiring a running Docker daemon (daemon-less, via go-containerregistry).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerSource

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

ContainerSource scans container image layers for secrets.

func New

func New(imageRef string, opts ...Option) *ContainerSource

New creates a new ContainerSource for the given image reference.

func (*ContainerSource) Chunks

func (s *ContainerSource) Chunks(ctx context.Context) <-chan source.Chunk

Chunks pulls the image and sends file contents from each layer as chunks.

func (*ContainerSource) Err added in v1.7.0

func (s *ContainerSource) Err() error

Err returns the first terminal error that aborted image scanning, or nil if it completed normally. It must only be called after the channel returned by Chunks has been fully drained (closed).

func (*ContainerSource) Type

func (s *ContainerSource) Type() string

Type returns the source type identifier.

func (*ContainerSource) Validate

func (s *ContainerSource) Validate() error

Validate checks that the image reference is parseable and accessible.

type Option

type Option func(*ContainerSource)

Option configures a ContainerSource.

func WithBufferSize

func WithBufferSize(size int) Option

WithBufferSize sets the chunk channel buffer size. Values less than or equal to zero are ignored.

func WithExcludePaths

func WithExcludePaths(patterns []string) Option

WithExcludePaths sets glob patterns for layer file paths to exclude from scanning. Patterns are matched against each file's cleaned, slash-based path within the layer, mirroring filesystem.WithExcludePaths semantics.

func WithMaxFileSize

func WithMaxFileSize(size int64) Option

WithMaxFileSize sets the maximum file size to extract from layers. Values less than or equal to zero are ignored.

func WithMaxImageSize added in v1.7.0

func WithMaxImageSize(size int64) Option

WithMaxImageSize sets the maximum number of decompressed bytes read across all of an image's layers, bounding total decompression work. Values less than or equal to zero are ignored.

func WithMaxLayerSize added in v1.7.0

func WithMaxLayerSize(size int64) Option

WithMaxLayerSize sets the maximum number of decompressed bytes read from a single layer, guarding against decompression-bomb layers with an extreme compression ratio. Values less than or equal to zero are ignored.

Jump to

Keyboard shortcuts

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