Documentation ¶
Index ¶
- func ExtractImagesFromTar(tarFilePath string) ([]string, error)
- func NewLocalPackageScanner(logger types.Logger, dockerConfigPath, packagePath string) (types.PackageScanner, error)
- func NewRemotePackageScanner(ctx context.Context, logger types.Logger, ...) types.PackageScanner
- type ImageIndex
- type ImageManifest
- type LocalPackageScanner
- type Scanner
- type ScannerFactoryImpl
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractImagesFromTar ¶ added in v0.0.8
ExtractImagesFromTar extracts images from the tar archive and returns names of the container images. Parameters: - tarFilePath: the path to the tar archive to extract the images from. Returns: - []string: the names of the container images. - error: an error if the extraction fails.
func NewLocalPackageScanner ¶ added in v0.0.8
func NewLocalPackageScanner(logger types.Logger, dockerConfigPath, packagePath string) (types.PackageScanner, error)
NewLocalPackageScanner creates a new LocalPackageScanner instance. Parameters: - logger: the logger to use for logging. - dockerConfigPath: the path to the docker configuration file. - packagePath: the path to the zarf package to scan. Returns: - *LocalPackageScanner: the LocalPackageScanner instance. - error: an error if the instance cannot be created.
func NewRemotePackageScanner ¶ added in v0.0.8
func NewRemotePackageScanner( ctx context.Context, logger types.Logger, dockerConfigPath, org, packageName, tag string, ) types.PackageScanner
NewRemotePackageScanner creates a new Scanner for remote packages.
Types ¶
type ImageIndex ¶ added in v0.0.8
type ImageIndex struct { MediaType string `json:"mediaType"` Manifests []ImageManifest `json:"manifests"` SchemaVersion int `json:"schemaVersion"` }
ImageIndex represents the structure of the index.json file.
type ImageManifest ¶ added in v0.0.8
type ImageManifest struct { Annotations struct { BaseName string `json:"org.opencontainers.image.base.name"` } `json:"annotations"` MediaType string `json:"mediaType"` Digest string `json:"digest"` Size int `json:"size"` }
ImageManifest represents the structure of the image manifest in the index.json file.
type LocalPackageScanner ¶ added in v0.0.8
type LocalPackageScanner struct {
// contains filtered or unexported fields
}
LocalPackageScanner is a struct that holds the logger and paths for docker configuration and package.
func (*LocalPackageScanner) Scan ¶ added in v0.0.8
func (lps *LocalPackageScanner) Scan(ctx context.Context) ([]string, error)
Scan scans the package and returns the scan results which are trivy scan results in json format. Parameters: - ctx: the context to use for the scan. Returns: - []string: the scan results which are trivy scan results in json format. - error: an error if the scan fails.
func (*LocalPackageScanner) ScanResultReader ¶ added in v0.0.8
func (lps *LocalPackageScanner) ScanResultReader(jsonFilePath string) (types.ScanResultReader, error)
ScanResultReader reads the scan result from the json file and returns the scan result. Parameters: - jsonFilePath: the path to the json file to read the scan result from. Returns: - types.ScanResultReader: the scan result. - error: an error if the reading fails.
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner implements the PackageScanner interface for remote packages.
func (*Scanner) ScanResultReader ¶
func (s *Scanner) ScanResultReader(jsonFilePath string) (types.ScanResultReader, error)
ScanResultReader creates a new ScanResultReader from a JSON file. This takes a trivy scan result file and returns a ScanResultReader.
Parameters:
- jsonFilePath: The path to the JSON file containing the scan results.
Returns:
- types.ScanResultReader: An instance of ScanResultReader that can be used to access the scan results.
- error: An error if the file cannot be opened or the JSON cannot be decoded.
func (*Scanner) ScanZarfPackage ¶
ScanZarfPackage scans a Zarf package and returns the scan results.
Parameters:
- org: The organization that owns the package.
- packageName: The name of the package to scan.
- tag: The tag of the package to scan.
Returns:
- []string: A slice of file paths containing the scan results in JSON format.
- error: An error if the scan operation fails.
type ScannerFactoryImpl ¶ added in v0.0.8
type ScannerFactoryImpl struct{}
ScannerFactoryImpl is the implementation of the ScannerFactory interface.
func (*ScannerFactoryImpl) CreateScanner ¶ added in v0.0.8
func (sf *ScannerFactoryImpl) CreateScanner(ctx context.Context, logger types.Logger, dockerConfigPath, org, packageName, tag, packagePath string) (types.PackageScanner, error)
CreateScanner creates a new PackageScanner based on the provided options.