Documentation
¶
Overview ¶
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. * * This product includes software developed at Datadog (https://www.datadoghq.com) Copyright 2024 Datadog, Inc.
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. * * This product includes software developed at Datadog (https://www.datadoghq.com) Copyright 2024 Datadog, Inc.
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. * * This product includes software developed at Datadog (https://www.datadoghq.com) Copyright 2024 Datadog, Inc.
Index ¶
- Variables
- func GetExcludePaths(ctx context.Context, pathExpressions string) ([]string, error)
- type ExtractedPath
- type FileSystemSourceProvider
- func (s *FileSystemSourceProvider) GetBasePaths() []string
- func (s *FileSystemSourceProvider) GetParallelSources(ctx context.Context, extensions model.Extensions, sink Sink, ...) error
- func (s *FileSystemSourceProvider) GetSources(ctx context.Context, extensions model.Extensions, sink Sink, ...) error
- type ResolverSink
- type Sink
- type SourceProvider
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotSupportedFile - error representing when a file format is not supported by KICS ErrNotSupportedFile = errors.New("invalid file format") )
Functions ¶
Types ¶
type ExtractedPath ¶
type ExtractedPath struct {
Path []string
ExtractionMap map[string]model.ExtractedPathObject
}
ExtractedPath is a struct that contains the paths, temporary paths to remove and extraction map path of the sources Path is the slice of paths to scan ExtractionMap is a map that correlates the temporary path to the given path RemoveTmp is the slice containing temporary paths to be removed
func GetKuberneterSources ¶
func GetKuberneterSources(ctx context.Context, source []string, destinationPath string) (ExtractedPath, error)
GetKuberneterSources uses Kubernetes API to download runtime resources After Downloaded files kics scan the files as normal local files
func GetSources ¶
GetSources goes through the source slice, and determines the of source type (ex: zip, git, local). It than extracts the files to be scanned. If the source given is not local, a temp dir will be created where the files will be stored.
type FileSystemSourceProvider ¶
type FileSystemSourceProvider struct {
// contains filtered or unexported fields
}
FileSystemSourceProvider provides a path to be scanned and a list of files which will not be scanned
func NewFileSystemSourceProvider ¶
func NewFileSystemSourceProvider(ctx context.Context, paths, excludes, onlyPaths []string) (*FileSystemSourceProvider, error)
NewFileSystemSourceProvider initializes a FileSystemSourceProvider with path and files that will be ignored
func (*FileSystemSourceProvider) GetBasePaths ¶
func (s *FileSystemSourceProvider) GetBasePaths() []string
GetBasePaths returns base path of FileSystemSourceProvider
func (*FileSystemSourceProvider) GetParallelSources ¶ added in v0.0.3
func (s *FileSystemSourceProvider) GetParallelSources(ctx context.Context, extensions model.Extensions, sink Sink, resolverSink ResolverSink) error
GetParallelSources is an alternative to GetSources, parallelising the task
func (*FileSystemSourceProvider) GetSources ¶
func (s *FileSystemSourceProvider) GetSources(ctx context.Context, extensions model.Extensions, sink Sink, resolverSink ResolverSink) error
GetSources tries to open file or directory and execute sink function on it
type ResolverSink ¶
ResolverSink defines a sink function to be passed as reference to functions for resolved files/templates
type SourceProvider ¶
type SourceProvider interface {
GetBasePaths() []string
GetSources(ctx context.Context, extensions model.Extensions, sink Sink, resolverSink ResolverSink) error
GetParallelSources(ctx context.Context, extensions model.Extensions, sink Sink, resolverSink ResolverSink) error
}
SourceProvider is the interface that wraps the basic GetSources method. GetBasePath returns base path of FileSystemSourceProvider GetSources receives context, receive ID, extensions supported and a sink function to save sources