audit

package
v4.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2020 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InspectFile

func InspectFile(content string, fullpath string, c *object.Commit, repo *Repo)

InspectFile accepts a file content, fullpath of file, commit and repo. If the file is binary OR if a file is matched on whitelisted files set in the configuration, then gitleaks will skip auditing that file. It will check first if rules apply to this file comparing filename and path to their respective rule regexes and inspect file content with inspectFileContents after.

func RegexMatched added in v4.2.0

func RegexMatched(f interface{}, re *regexp.Regexp) bool

RegexMatched matched an interface to a regular expression. The interface f can be a string type or go-git *object.File type.

func Run

func Run(m *manager.Manager) error

Run accepts a manager and begins an audit based on the options/configs set in the manager.

Types

type Repo

type Repo struct {
	*git.Repository

	Name    string
	Manager *manager.Manager
	// contains filtered or unexported fields
}

Repo wraps a *git.Repository object in addition to a manager object and the name of the repo. Commits are inspected from the *git.Repository object. If a commit is found then we send it via the manager LeakChan where the manager receives and keeps track of all leaks.

func NewRepo

func NewRepo(m *manager.Manager) *Repo

NewRepo initializes and returns a Repo struct.

func (*Repo) Audit

func (repo *Repo) Audit() error

Audit is responsible for scanning the entire history (default behavior) of a git repo. Options that can change the behavior of this function include: --commit, --depth, --branch. See options/options.go for an explanation on these options.

func (*Repo) AuditUncommitted

func (repo *Repo) AuditUncommitted() error

AuditUncommitted will do a `git diff` and scan changed files that are being tracked. This is useful functionality for a pre-commit hook so you can make sure your code does not have any leaks before committing.

func (*Repo) Clone

func (repo *Repo) Clone(cloneOption *git.CloneOptions) error

Clone will clone a repo and return a Repo struct which contains a go-git repo. The clone method is determined by the clone options set in Manager.metadata.cloneOptions

func (*Repo) Open

func (repo *Repo) Open() error

Open opens a local repo either from repo-path or $PWD

Jump to

Keyboard shortcuts

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