source

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package source defines scan source interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chunk

type Chunk struct {
	// Data is the raw content to scan.
	Data []byte

	// SourceMetadata describes where the chunk originated from.
	SourceMetadata finding.SourceMetadata
}

Chunk is the smallest unit of data to be scanned.

type Source

type Source interface {
	// Type returns the source type identifier (e.g., "git", "filesystem", "container").
	Type() string

	// Chunks streams scannable data chunks over a channel.
	//
	// The returned channel is closed exactly once, when chunk production has
	// finished: either after the source has streamed every chunk to normal
	// completion, or after it aborts early on a terminal failure (see Err), or
	// after the given context is cancelled. Callers must drain the channel until
	// it is closed; only then is the outcome of the scan known.
	Chunks(ctx context.Context) <-chan Chunk

	// Err returns the first terminal (fatal) error that aborted or prevented
	// chunk production — a clone/open failure, an authentication error, a
	// listing/pull error, a decompression-limit trip, a directory-walk failure,
	// and so on — or nil if the source streamed to normal completion.
	//
	// A nil Err with zero chunks means the target was genuinely empty; a non-nil
	// Err means the scan failed and any absence of findings must NOT be treated
	// as a clean result. Context cancellation is reported through the context,
	// not here, so a cancelled scan leaves Err nil.
	//
	// Err is only valid to call AFTER the channel returned by Chunks has been
	// fully drained (closed). The channel close is the happens-before edge that
	// publishes the terminal error the source records before closing the channel,
	// so no additional synchronization is required for this single read. Calling
	// Err before the channel closes is a data race.
	Err() error

	// Validate checks that the source is accessible and valid. Implementations
	// must honor cancellation and deadlines for every network or blocking
	// operation performed during validation.
	Validate(ctx context.Context) error
}

Source represents a data source to be scanned. Each source type (Git, filesystem, container) implements this interface.

Directories

Path Synopsis
Package container provides a container image scan source.
Package container provides a container image scan source.
Package filesystem provides a filesystem-based scan source.
Package filesystem provides a filesystem-based scan source.
Package gcs provides a Google Cloud Storage bucket scan source.
Package gcs provides a Google Cloud Storage bucket scan source.
Package git provides a Git repository scan source.
Package git provides a Git repository scan source.
Package s3 provides an AWS S3 bucket scan source.
Package s3 provides an AWS S3 bucket scan source.
Package slack provides a Slack workspace scan source.
Package slack provides a Slack workspace scan source.

Jump to

Keyboard shortcuts

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