Documentation
¶
Overview ¶
Package imagesbom builds package inventories of running container images from the containerd content store (docs/architecture.md, Image inventory).
Index ¶
Constants ¶
const ( StatusReady = "ready" StatusPending = "pending" )
Result statuses.
const ( LabelSource = "org.opencontainers.image.source" LabelRevision = "org.opencontainers.image.revision" )
OCI annotation keys read from the image config labels.
const DefaultContentStore = "/var/lib/containerd/io.containerd.content.v1.content"
DefaultContentStore is containerd's default content store; k3s and RKE2 use their own paths (docs/install-kubernetes.md).
const Scanner = "osv-scalibr " + version.ScannerVersion
Scanner names the inventory engine and its version in every result.
Variables ¶
This section is empty.
Functions ¶
func DigestFromImageID ¶
DigestFromImageID extracts the content digest from a container status imageID.
func ParseDigest ¶
ParseDigest validates a sha256 content digest.
Types ¶
type Inventory ¶
type Inventory struct {
// contains filtered or unexported fields
}
Inventory builds one image at a time, in the background for running digests and first for requested ones.
func (*Inventory) Get ¶
Get returns the cached inventory, pending while it is queued or building, or unavailable with the reason.
type Labels ¶
type Labels struct {
Source string `json:"source,omitempty"`
Revision string `json:"revision,omitempty"`
}
Labels are the OCI source and revision labels of the image config.
type Limits ¶
type Limits struct {
// MaxLayerBytes bounds the uncompressed layer bytes read.
MaxLayerBytes int64
// MaxFiles bounds the layer entries read.
MaxFiles int
// MaxStagedBytes bounds the package metadata files staged on disk for the extractors.
MaxStagedBytes int64
MaxPackages int
Timeout time.Duration
}
Limits bound one build; reaching any of them marks the result truncated with the reason.
func DefaultLimits ¶
func DefaultLimits() Limits
DefaultLimits are the build bounds used when a limit is zero.
type Options ¶
type Options struct {
Node string
ContentStore string
// Dir holds the cache and the transient work directory; it lives under the agent state directory.
Dir string
Limits Limits
CacheEntries int
CacheBytes int64
// Settle delays background builds of newly observed digests.
Settle time.Duration
// Pause separates background builds so they stay low priority.
Pause time.Duration
// FailureRetry is how long a failed build is reported before it is tried again.
FailureRetry time.Duration
Arch string
Variant string
Redactor *redact.Redactor
Logger *slog.Logger
Clock func() time.Time
}
Options configures an Inventory.
type Package ¶
type Package struct {
Ecosystem string `json:"ecosystem"`
Name string `json:"name"`
Version string `json:"version"`
PURL string `json:"purl,omitempty"`
Location string `json:"location,omitempty"`
}
Package is one installed package; it carries metadata only, never file contents.
type Result ¶
type Result struct {
Status string `json:"status"`
Digest string `json:"digest"`
Reason string `json:"reason,omitempty"`
Labels Labels `json:"labels"`
Packages []Package `json:"packages"`
Truncated bool `json:"truncated"`
Scanner string `json:"scanner"`
}
Result is the image.sbom.get result and the image_sbom task payload.
func Redact ¶
Redact passes every free-form string of r through the redactor before it reaches a sink.
func Unavailable ¶
Unavailable reports why no inventory can be returned for digest, as a sentence.
type TaskRequest ¶
type TaskRequest struct {
Digest string `json:"digest"`
}
TaskRequest is the JSON payload of an image_sbom node task.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package imagesbomtest writes synthetic containerd content stores for tests of image inventory callers.
|
Package imagesbomtest writes synthetic containerd content stores for tests of image inventory callers. |