nightfall

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// maximum attempts to Nightfall API upon receiving 429 Too Many Requests before failing
	MaxScanAttempts = 5
)

Variables

View Source
var (
	// ErrMaxScanRetries is the error for when the max number of retries to the API has occurred without success
	ErrMaxScanRetries = errors.New("max number of retries has been attempted")
)

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
	APIClient *nightfallAPI.APIClient
}

APIClient is a wrapper around nightfallAPI.APIClient

func NewAPIClient

func NewAPIClient() *APIClient

NewAPIClient generates a nightfallAPI client

func (*APIClient) ScanPayload

ScanPayload makes the scan request to the nightfallAPI

type Client

type Client struct {
	APIClient          nightfallintf.NightfallAPI
	APIKey             string
	ConditionSetUUID   string
	Conditions         []*nightfallAPI.Condition
	MaxNumberRoutines  int
	InitialRetryDelay  time.Duration
	TokenExclusionList []string
	FileInclusionList  []string
	FileExclusionList  []string
}

Client client which uses Nightfall API to determine findings from input strings

func NewClient

func NewClient(config nightfallconfig.Config) *Client

NewClient create Client

func (*Client) CreateScanRequest

func (n *Client) CreateScanRequest(items []string) nightfallAPI.ScanRequestV2

func (*Client) ReviewDiff

func (n *Client) ReviewDiff(
	ctx context.Context,
	logger logger.Logger,
	fileDiffs []*diffreviewer.FileDiff,
) ([]*diffreviewer.Comment, error)

ReviewDiff will take in a diff, chunk the contents of the diff and send the chunks to the Nightfall API to determine if it contains sensitive data

func (*Client) Scan

func (n *Client) Scan(
	ctx context.Context,
	logger logger.Logger,
	items []string,
) ([][]nightfallAPI.ScanResponseV2, error)

Scan send /scan request to Nightfall API and return findings

Jump to

Keyboard shortcuts

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