gitleaks

package
v1.25.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2019 License: GPL-3.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const ErrExit = 2
View Source
const LeakExit = 1

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Regexes   []Regex
	WhiteList struct {
		// contains filtered or unexported fields
	}
	Entropy struct {
		// contains filtered or unexported fields
	}
	// contains filtered or unexported fields
}

Config contains gitleaks config

type Leak

type Leak struct {
	Line     string    `json:"line"`
	Commit   string    `json:"commit"`
	Offender string    `json:"offender"`
	Type     string    `json:"reason"`
	Message  string    `json:"commitMsg"`
	Author   string    `json:"author"`
	Email    string    `json:"email"`
	File     string    `json:"file"`
	Repo     string    `json:"repo"`
	Date     time.Time `json:"date"`
}

Leak represents a leaked secret or regex match.

type Options

type Options struct {
	// remote target options
	Repo       string `short:"r" long:"repo" description:"Repo url to audit"`
	GithubUser string `long:"github-user" description:"Github user to audit"`
	GithubOrg  string `long:"github-org" description:"Github organization to audit"`
	GithubURL  string `` /* 157-byte string literal not displayed */
	GithubPR   string `long:"github-pr" description:"Github PR url to audit. This does not clone the repo. GITHUB_TOKEN must be set"`

	GitLabUser string `long:"gitlab-user" description:"GitLab user ID to audit"`
	GitLabOrg  string `long:"gitlab-org" description:"GitLab group ID to audit"`

	CommitStop string `long:"commit-stop" description:"sha of commit to stop at"`
	Commit     string `long:"commit" description:"sha of commit to audit"`
	Depth      int64  `long:"depth" description:"maximum commit depth"`

	// local target option
	RepoPath  string `long:"repo-path" description:"Path to repo"`
	OwnerPath string `long:"owner-path" description:"Path to owner directory (repos discovered)"`

	// Process options
	Threads        int     `long:"threads" description:"Maximum number of threads gitleaks spawns"`
	Disk           bool    `long:"disk" description:"Clones repo(s) to disk"`
	SingleSearch   string  `long:"single-search" description:"single regular expression to search for"`
	ConfigPath     string  `long:"config" description:"path to gitleaks config"`
	SSHKey         string  `long:"ssh-key" description:"path to ssh key"`
	ExcludeForks   bool    `long:"exclude-forks" description:"exclude forks for organization/user audits"`
	Entropy        float64 `long:"entropy" short:"e" description:"Include entropy checks during audit. Entropy scale: 0.0(no entropy) - 8.0(max entropy)"`
	NoiseReduction bool    `long:"noise-reduction" description:"Reduce the number of finds when entropy checks are enabled"`
	RepoConfig     bool    `long:"repo-config" description:"Load config from target repo. Config file must be \".gitleaks.toml\""`
	Branch         string  `long:"branch" description:"Branch to audit"`

	// Output options
	Log          string `short:"l" long:"log" description:"log level"`
	Verbose      bool   `short:"v" long:"verbose" description:"Show verbose output from gitleaks audit"`
	Report       string `long:"report" description:"path to write report file. Needs to be csv or json"`
	Redact       bool   `long:"redact" description:"redact secrets from log messages and report"`
	Version      bool   `long:"version" description:"version number"`
	SampleConfig bool   `long:"sample-config" description:"prints a sample config file"`
}

Options for gitleaks

func ParseOpts

func ParseOpts() *Options

ParseOpts parses the options

type Regex

type Regex struct {
	// contains filtered or unexported fields
}

type RepoInfo

type RepoInfo struct {
	// contains filtered or unexported fields
}

RepoInfo contains a src-d git repository and other data about the repo

type Report

type Report struct {
	Leaks    []Leak
	Duration string
	Commits  int64
}

Report is

func Run

func Run(optsL *Options) (*Report, error)

Run is the entry point for gitleaks

type TomlConfig

type TomlConfig struct {
	Regexes []struct {
		Description string
		Regex       string
	}
	Entropy struct {
		LineRegexes []string
		Ranges      []string
	}
	Whitelist struct {
		Files   []string
		Regexes []string
		Commits []string
		Repos   []string
	}
}

TomlConfig is used for loading gitleaks configs from a toml file

Jump to

Keyboard shortcuts

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