Documentation ¶
Overview ¶
Package syft is a "one-stop-shop" for helper utilities for all major functionality provided by child packages of the syft library.
Here is what the main execution path for syft does:
- Parse a user image string to get a stereoscope image.Source object
- Invoke all catalogers to catalog the image, adding discovered packages to a single catalog object
- Invoke one or more encoders to output contents of the catalog
A Source object encapsulates the image object to be cataloged and the user options (catalog all layers vs. squashed layer), providing a way to inspect paths and file content within the image. The Source object, not the image object, is used throughout the main execution path. This abstraction allows for decoupling of what is cataloged (a docker image, an OCI image, a filesystem, etc) and how it is cataloged (the individual catalogers).
Similar to the cataloging process, Linux distribution identification is also performed based on what is discovered within the image.
Index ¶
- func CreateSBOM(ctx context.Context, src source.Source, cfg *CreateSBOMConfig) (*sbom.SBOM, error)
- func GetSource(ctx context.Context, userInput string, cfg *GetSourceConfig) (source.Source, error)
- func SetBus(b *partybus.Bus)
- func SetLogger(logger logger.Logger)
- type CreateSBOMConfig
- func (c *CreateSBOMConfig) Create(ctx context.Context, src source.Source) (*sbom.SBOM, error)
- func (c *CreateSBOMConfig) WithCatalogerSelection(selection pkgcataloging.SelectionRequest) *CreateSBOMConfig
- func (c *CreateSBOMConfig) WithCatalogers(catalogerRefs ...pkgcataloging.CatalogerReference) *CreateSBOMConfig
- func (c *CreateSBOMConfig) WithDataGenerationConfig(cfg cataloging.DataGenerationConfig) *CreateSBOMConfig
- func (c *CreateSBOMConfig) WithFilesConfig(cfg filecataloging.Config) *CreateSBOMConfig
- func (c *CreateSBOMConfig) WithPackagesConfig(cfg pkgcataloging.Config) *CreateSBOMConfig
- func (c *CreateSBOMConfig) WithParallelism(p int) *CreateSBOMConfig
- func (c *CreateSBOMConfig) WithRelationshipsConfig(cfg cataloging.RelationshipsConfig) *CreateSBOMConfig
- func (c *CreateSBOMConfig) WithSearchConfig(cfg cataloging.SearchConfig) *CreateSBOMConfig
- func (c *CreateSBOMConfig) WithTool(name, version string, cfg ...any) *CreateSBOMConfig
- func (c *CreateSBOMConfig) WithoutCatalogers() *CreateSBOMConfig
- func (c *CreateSBOMConfig) WithoutFiles() *CreateSBOMConfig
- type GetSourceConfig
- func (c *GetSourceConfig) WithAlias(alias source.Alias) *GetSourceConfig
- func (c *GetSourceConfig) WithBasePath(basePath string) *GetSourceConfig
- func (c *GetSourceConfig) WithDefaultImagePullSource(defaultImagePullSource string) *GetSourceConfig
- func (c *GetSourceConfig) WithDigestAlgorithms(algorithms ...crypto.Hash) *GetSourceConfig
- func (c *GetSourceConfig) WithExcludeConfig(excludeConfig source.ExcludeConfig) *GetSourceConfig
- func (c *GetSourceConfig) WithPlatform(platform *image.Platform) *GetSourceConfig
- func (c *GetSourceConfig) WithRegistryOptions(registryOptions *image.RegistryOptions) *GetSourceConfig
- func (c *GetSourceConfig) WithSources(sources ...string) *GetSourceConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateSBOM ¶ added in v0.101.0
CreateSBOM creates a software bill-of-materials from the given source. If the CreateSBOMConfig is nil, then default options will be used.
func GetSource ¶ added in v1.0.0
GetSource uses all of Syft's known source providers to attempt to resolve the user input to a usable source.Source
Types ¶
type CreateSBOMConfig ¶ added in v0.101.0
type CreateSBOMConfig struct { // required configuration input to specify how cataloging should be performed Search cataloging.SearchConfig Relationships cataloging.RelationshipsConfig DataGeneration cataloging.DataGenerationConfig Packages pkgcataloging.Config Files filecataloging.Config Parallelism int CatalogerSelection pkgcataloging.SelectionRequest // audit what tool is being used to generate the SBOM ToolName string ToolVersion string ToolConfiguration interface{} // contains filtered or unexported fields }
CreateSBOMConfig specifies all parameters needed for creating an SBOM.
func DefaultCreateSBOMConfig ¶ added in v0.101.0
func DefaultCreateSBOMConfig() *CreateSBOMConfig
func (*CreateSBOMConfig) Create ¶ added in v0.101.0
Create creates an SBOM from the given source with the current SBOM configuration.
func (*CreateSBOMConfig) WithCatalogerSelection ¶ added in v0.101.0
func (c *CreateSBOMConfig) WithCatalogerSelection(selection pkgcataloging.SelectionRequest) *CreateSBOMConfig
WithCatalogerSelection allows for adding to, removing from, or sub-selecting the final set of catalogers by name or tag.
func (*CreateSBOMConfig) WithCatalogers ¶ added in v0.101.0
func (c *CreateSBOMConfig) WithCatalogers(catalogerRefs ...pkgcataloging.CatalogerReference) *CreateSBOMConfig
WithCatalogers allows for adding user-provided catalogers to the final set of catalogers that will always be run regardless of the source type or any cataloger selections provided.
func (*CreateSBOMConfig) WithDataGenerationConfig ¶ added in v0.101.0
func (c *CreateSBOMConfig) WithDataGenerationConfig(cfg cataloging.DataGenerationConfig) *CreateSBOMConfig
WithDataGenerationConfig allows for defining what data elements that cannot be discovered from the underlying target being scanned that should be generated after package creation.
func (*CreateSBOMConfig) WithFilesConfig ¶ added in v0.101.0
func (c *CreateSBOMConfig) WithFilesConfig(cfg filecataloging.Config) *CreateSBOMConfig
WithFilesConfig allows for defining file-based cataloging parameters.
func (*CreateSBOMConfig) WithPackagesConfig ¶ added in v0.101.0
func (c *CreateSBOMConfig) WithPackagesConfig(cfg pkgcataloging.Config) *CreateSBOMConfig
WithPackagesConfig allows for defining any specific behavior for syft-implemented catalogers.
func (*CreateSBOMConfig) WithParallelism ¶ added in v0.101.0
func (c *CreateSBOMConfig) WithParallelism(p int) *CreateSBOMConfig
WithParallelism allows for setting the number of concurrent cataloging tasks that can be performed at once
func (*CreateSBOMConfig) WithRelationshipsConfig ¶ added in v0.101.0
func (c *CreateSBOMConfig) WithRelationshipsConfig(cfg cataloging.RelationshipsConfig) *CreateSBOMConfig
WithRelationshipsConfig allows for defining the specific relationships that should be captured during cataloging.
func (*CreateSBOMConfig) WithSearchConfig ¶ added in v0.101.0
func (c *CreateSBOMConfig) WithSearchConfig(cfg cataloging.SearchConfig) *CreateSBOMConfig
WithSearchConfig allows for setting the specific search configuration for cataloging.
func (*CreateSBOMConfig) WithTool ¶ added in v0.101.0
func (c *CreateSBOMConfig) WithTool(name, version string, cfg ...any) *CreateSBOMConfig
WithTool allows for setting the specific name, version, and any additional configuration that is not captured in the syft default API configuration. This could cover inputs for catalogers that were user-provided, thus, is not visible to the syft API, but would be useful to see in the SBOM output.
func (*CreateSBOMConfig) WithoutCatalogers ¶ added in v0.101.0
func (c *CreateSBOMConfig) WithoutCatalogers() *CreateSBOMConfig
WithoutCatalogers removes all catalogers from the final set of catalogers. This is useful if you want to only use user-provided catalogers (without the default syft-provided catalogers).
func (*CreateSBOMConfig) WithoutFiles ¶ added in v0.101.0
func (c *CreateSBOMConfig) WithoutFiles() *CreateSBOMConfig
WithoutFiles allows for disabling file cataloging altogether.
type GetSourceConfig ¶ added in v1.0.0
type GetSourceConfig struct { // SourceProviderConfig may optionally be provided to be used when constructing the default set of source providers, unused if All specified SourceProviderConfig *sourceproviders.Config // Sources is an explicit list of source names to use, in order, to attempt to locate a source Sources []string // DefaultImagePullSource will cause a particular image pull source to be used as the first pull source, followed by other pull sources DefaultImagePullSource string }
func DefaultGetSourceConfig ¶ added in v1.0.0
func DefaultGetSourceConfig() *GetSourceConfig
func (*GetSourceConfig) WithAlias ¶ added in v1.0.0
func (c *GetSourceConfig) WithAlias(alias source.Alias) *GetSourceConfig
func (*GetSourceConfig) WithBasePath ¶ added in v1.0.0
func (c *GetSourceConfig) WithBasePath(basePath string) *GetSourceConfig
func (*GetSourceConfig) WithDefaultImagePullSource ¶ added in v1.0.0
func (c *GetSourceConfig) WithDefaultImagePullSource(defaultImagePullSource string) *GetSourceConfig
func (*GetSourceConfig) WithDigestAlgorithms ¶ added in v1.0.0
func (c *GetSourceConfig) WithDigestAlgorithms(algorithms ...crypto.Hash) *GetSourceConfig
func (*GetSourceConfig) WithExcludeConfig ¶ added in v1.0.0
func (c *GetSourceConfig) WithExcludeConfig(excludeConfig source.ExcludeConfig) *GetSourceConfig
func (*GetSourceConfig) WithPlatform ¶ added in v1.0.0
func (c *GetSourceConfig) WithPlatform(platform *image.Platform) *GetSourceConfig
func (*GetSourceConfig) WithRegistryOptions ¶ added in v1.0.0
func (c *GetSourceConfig) WithRegistryOptions(registryOptions *image.RegistryOptions) *GetSourceConfig
func (*GetSourceConfig) WithSources ¶ added in v1.0.0
func (c *GetSourceConfig) WithSources(sources ...string) *GetSourceConfig
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package event provides event types for all events that the syft library published onto the event bus.
|
Package event provides event types for all events that the syft library published onto the event bus. |
parsers
Package parsers provides parser helpers to extract payloads for each event type that the syft library publishes onto the event bus.
|
Package parsers provides parser helpers to extract payloads for each event type that the syft library publishes onto the event bus. |
package license provides common methods for working with SPDX license data
|
package license provides common methods for working with SPDX license data |
Package pkg provides the data structures for a package, a package catalog, package types, and domain-specific metadata.
|
Package pkg provides the data structures for a package, a package catalog, package types, and domain-specific metadata. |
cataloger/alpine
Package alpine provides a concrete Cataloger implementations for packages relating to the Alpine linux distribution.
|
Package alpine provides a concrete Cataloger implementations for packages relating to the Alpine linux distribution. |
cataloger/arch
Package arch provides a concrete Cataloger implementations for packages relating to the Arch linux distribution.
|
Package arch provides a concrete Cataloger implementations for packages relating to the Arch linux distribution. |
cataloger/binary
Package binary provides a concrete cataloger implementations for surfacing possible packages based on signatures found within binary files.
|
Package binary provides a concrete cataloger implementations for surfacing possible packages based on signatures found within binary files. |
cataloger/cpp
Package cpp provides a concrete Cataloger implementations for the C/C++ language ecosystem.
|
Package cpp provides a concrete Cataloger implementations for the C/C++ language ecosystem. |
cataloger/dart
Package dart provides a concrete Cataloger implementations for the Dart language ecosystem.
|
Package dart provides a concrete Cataloger implementations for the Dart language ecosystem. |
cataloger/debian
Package debian provides a concrete Cataloger implementation relating to packages within the Debian linux distribution.
|
Package debian provides a concrete Cataloger implementation relating to packages within the Debian linux distribution. |
cataloger/dotnet
Package dotnet provides a concrete Cataloger implementation relating to packages within the C#/.NET language/runtime ecosystem.
|
Package dotnet provides a concrete Cataloger implementation relating to packages within the C#/.NET language/runtime ecosystem. |
cataloger/elixir
Package elixir provides a concrete Cataloger implementation relating to packages within the Elixir language ecosystem.
|
Package elixir provides a concrete Cataloger implementation relating to packages within the Elixir language ecosystem. |
cataloger/erlang
Package erlang provides concrete Catalogers implementation relating to packages within the Erlang language ecosystem.
|
Package erlang provides concrete Catalogers implementation relating to packages within the Erlang language ecosystem. |
cataloger/gentoo
Package gentoo provides a concrete Cataloger implementation related to packages within the Gentoo linux ecosystem.
|
Package gentoo provides a concrete Cataloger implementation related to packages within the Gentoo linux ecosystem. |
cataloger/githubactions
Package githubactions provides a concrete Cataloger implementation for GitHub Actions packages (both actions and workflows).
|
Package githubactions provides a concrete Cataloger implementation for GitHub Actions packages (both actions and workflows). |
cataloger/golang
Package golang provides a concrete Cataloger implementation relating to packages within the Go language ecosystem.
|
Package golang provides a concrete Cataloger implementation relating to packages within the Go language ecosystem. |
cataloger/haskell
Package haskell provides a concrete Cataloger implementation relating to packages within the Haskell language ecosystem.
|
Package haskell provides a concrete Cataloger implementation relating to packages within the Haskell language ecosystem. |
cataloger/internal/cpegenerate/dictionary/index-generator
This program downloads the latest CPE dictionary from NIST and processes it into a JSON file that can be embedded into Syft for more accurate CPE results.
|
This program downloads the latest CPE dictionary from NIST and processes it into a JSON file that can be embedded into Syft for more accurate CPE results. |
cataloger/java
Package java provides a concrete Cataloger implementation for packages relating to the Java language ecosystem.
|
Package java provides a concrete Cataloger implementation for packages relating to the Java language ecosystem. |
cataloger/javascript
Package javascript provides a concrete Cataloger implementation for packages relating to the JavaScript language ecosystem.
|
Package javascript provides a concrete Cataloger implementation for packages relating to the JavaScript language ecosystem. |
cataloger/kernel
Package kernel provides a concrete Cataloger implementation for linux kernel and module files.
|
Package kernel provides a concrete Cataloger implementation for linux kernel and module files. |
cataloger/lua
Package lua provides a concrete Cataloger implementation for packages relating to the Lua language ecosystem.
|
Package lua provides a concrete Cataloger implementation for packages relating to the Lua language ecosystem. |
cataloger/nix
Package nix provides a concrete Cataloger implementation for packages within the Nix packaging ecosystem.
|
Package nix provides a concrete Cataloger implementation for packages within the Nix packaging ecosystem. |
cataloger/php
Package php provides a concrete Cataloger implementation relating to packages within the PHP language ecosystem.
|
Package php provides a concrete Cataloger implementation relating to packages within the PHP language ecosystem. |
cataloger/python
Package python provides a concrete Cataloger implementation relating to packages within the Python language ecosystem.
|
Package python provides a concrete Cataloger implementation relating to packages within the Python language ecosystem. |
cataloger/r
Package r provides a concrete Cataloger implementation relating to packages within the R language ecosystem.
|
Package r provides a concrete Cataloger implementation relating to packages within the R language ecosystem. |
cataloger/redhat
Package redhat provides a concrete DBCataloger implementation relating to packages within the RedHat linux distribution.
|
Package redhat provides a concrete DBCataloger implementation relating to packages within the RedHat linux distribution. |
cataloger/ruby
Package ruby provides a concrete Cataloger implementation relating to packages within the Ruby language ecosystem.
|
Package ruby provides a concrete Cataloger implementation relating to packages within the Ruby language ecosystem. |
cataloger/rust
Package rust provides a concrete Cataloger implementation relating to packages within the Rust language ecosystem.
|
Package rust provides a concrete Cataloger implementation relating to packages within the Rust language ecosystem. |
cataloger/sbom
Package sbom provides a concrete Cataloger implementation for capturing packages embedded within SBOM files.
|
Package sbom provides a concrete Cataloger implementation for capturing packages embedded within SBOM files. |
cataloger/swift
Package swift provides a concrete Cataloger implementation relating to packages within the swift language ecosystem.
|
Package swift provides a concrete Cataloger implementation relating to packages within the swift language ecosystem. |
Package source provides an abstraction to allow a user to loosely define a data source to catalog and expose a common interface that catalogers and use explore and analyze data from the data source.
|
Package source provides an abstraction to allow a user to loosely define a data source to catalog and expose a common interface that catalogers and use explore and analyze data from the data source. |