audit

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2020 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InspectString

func InspectString(content string, c *object.Commit, repo *Repo, filename string)

InspectString accepts a string, commit object, repo, and filename. This function iterates over all the rules set by the gitleaks config. If the rule contains entropy checks then entropy will be checked first. Next, if the rule contains a regular expression then that will be checked.

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