gitleaks

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package gitleaks provides data model, decoder, and validator for Gitleaks secret detection report

Index

Constants

View Source
const ConfigFieldName = "gitleaks"

ConfigFieldName field name for config map

View Source
const ConfigType = "Gitleaks Config"

ConfigType in plain text

View Source
const ReportType = "Gitleaks Scan Report"

ReportType in plain text

Variables

This section is empty.

Functions

func NewValidator

func NewValidator() gcv.Validator[Finding, Config]

NewValidator implementation of the generic validator

func NoSecretsRule

func NoSecretsRule(findings []Finding, config Config) error

NoSecretsRule deny if no secrets are allowed and count of secrets > 0

Types

type Config

type Config struct {
	SecretsAllowed bool `json:"secretsAllowed" yaml:"secretsAllowed"`
}

Config data model

type Finding

type Finding report.Finding

Finding data model alias

type ReportDecoder

type ReportDecoder struct {
	bytes.Buffer
}

ReportDecoder reports are just an array of findings. No findings is '[]' literally

func NewReportDecoder

func NewReportDecoder() *ReportDecoder

NewReportDecoder custom decoder with specific rules to handle empty findings reports

func (*ReportDecoder) Decode

func (d *ReportDecoder) Decode() (any, error)

Decode from internal buffer

func (*ReportDecoder) DecodeFrom

func (d *ReportDecoder) DecodeFrom(r io.Reader) (any, error)

DecodeFrom ...

func (*ReportDecoder) FileType

func (d *ReportDecoder) FileType() string

FileType in plain text

type ScanReport

type ScanReport []Finding

ScanReport a slice of findings

func (ScanReport) String

func (r ScanReport) String() string

String a formatted table of detected secrets

Jump to

Keyboard shortcuts

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