kics

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: Apache-2.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	SourceProvider SourceProvider
	Storage        Storage
	Parser         *parser.Parser
	Inspector      *engine.Inspector
	Tracker        Tracker
}

Service is a struct that contains a SourceProvider to receive sources, a storage to save and retrieve scanning informations a parser to parse and provide files in format that KICS understand, a inspector that runs the scanning and a tracker to update scanning numbers

func (*Service) GetScanSummary

func (s *Service) GetScanSummary(ctx context.Context, scanIDs []string) ([]model.SeveritySummary, error)

GetScanSummary returns how many vulnerabilities of each severity was found

func (*Service) GetVulnerabilities

func (s *Service) GetVulnerabilities(ctx context.Context, scanID string) ([]model.Vulnerability, error)

GetVulnerabilities returns a list of scan detected vulnerabilities

func (*Service) StartScan

func (s *Service) StartScan(ctx context.Context, scanID string, hideProgress bool) error

StartScan executes scan over the context, using the scanID as reference

type SourceProvider

type SourceProvider interface {
	GetBasePath() string
	GetSources(ctx context.Context, scanID string, extensions model.Extensions, sink source.Sink) 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

type Storage

type Storage interface {
	SaveFile(ctx context.Context, metadata *model.FileMetadata) error
	SaveVulnerabilities(ctx context.Context, vulnerabilities []model.Vulnerability) error
	GetVulnerabilities(ctx context.Context, scanID string) ([]model.Vulnerability, error)
	GetScanSummary(ctx context.Context, scanIDs []string) ([]model.SeveritySummary, error)
}

Storage is the interface that wraps following basic methods: SaveFile, SaveVulnerability, GetVulnerability and GetScanSummary SaveFile should append metadata to a file SaveVulnerabilities should append vulnerabilities list to current storage GetVulnerabilities should returns all vulnerabilities associated to a scan ID GetScanSummary should return a list of summaries based on their scan IDs

type Tracker

type Tracker interface {
	TrackFileFound()
	TrackFileParse()
}

Tracker is the interface that wraps the basic methods: TrackFileFound and TrackFileParse TrackFileFound should increment the number of files to be scanned TrackFileParse should increment the number of files parsed successfully to be scanned

Jump to

Keyboard shortcuts

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