provider

package
v2.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrNotSupportedFile - error representing when a file format is not supported by KICS
	ErrNotSupportedFile = errors.New("invalid file format")
)

Functions

func GetExcludePaths

func GetExcludePaths(pathExpressions string) ([]string, error)

GetExcludePaths gets all the files that should be excluded

Types

type ExtractedPath

type ExtractedPath struct {
	Path          []string
	ExtractionMap map[string]model.ExtractedPathObject
}

ExtractedPath is a struct that contains the paths and the extraction map of the sources. Path is the slice of paths to scan. ExtractionMap correlates the temporary extraction path to the original given path.

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

func GetSources(source []string) (ExtractedPath, error)

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(paths, excludes []string) (*FileSystemSourceProvider, error)

NewFileSystemSourceProvider initializes a FileSystemSourceProvider with path and files that will be ignored

func (*FileSystemSourceProvider) AddExcluded

func (s *FileSystemSourceProvider) AddExcluded(excludePaths []string) error

AddExcluded add new excluded files to the File System Source Provider

func (*FileSystemSourceProvider) GetBasePaths

func (s *FileSystemSourceProvider) GetBasePaths() []string

GetBasePaths returns base path of FileSystemSourceProvider

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

type ResolverSink func(ctx context.Context, filename string) ([]string, error)

ResolverSink defines a sink function to be passed as reference to functions for resolved files/templates

type Sink

type Sink func(ctx context.Context, filename string, content io.ReadCloser) error

Sink defines a sink function to be passed as reference to functions

type SourceProvider

type SourceProvider interface {
	GetBasePaths() []string
	GetSources(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

Jump to

Keyboard shortcuts

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