[][src]Module rusty_hogs::git_scanning

Collection of tools for scanning Git repos for secrets.

GitScanner acts as a wrapper around a SecretScanner object to provide helper functions for performing scanning against Git repositories. Relies on the git2-rs library which provides lower level access to the Git data structures.

Examples

Basic usage requires you to create a GitScanner object...

use rusty_hogs::SecretScannerBuilder;
use rusty_hogs::git_scanning::GitScanner;
let gs = GitScanner::new();

Alternatively you can build a custom SecretScanner object and supply it to the GitScanner contructor...

use rusty_hogs::SecretScannerBuilder;
use rusty_hogs::git_scanning::GitScanner;
let ss = SecretScannerBuilder::new().set_pretty_print(true).build();
let gs = GitScanner::new_from_scanner(ss);

After that, you must first run init_git_repo(), then perform_scan(), which returns a HashSet of findings. In this example we're specifying a specific commit to stop scanning at (801360e) so we can have a reliable result.

use rusty_hogs::SecretScannerBuilder;
use rusty_hogs::git_scanning::{GitScanner, GitFinding};
use std::collections::HashSet;
use std::path::Path;

let gs = GitScanner::new();

let mut gs = gs.init_git_repo(".", Path::new("."), None, None, None, None);
let findings: HashSet<GitFinding> = gs.perform_scan(None, None, Some("8013160e"), false);
assert_eq!(findings.len(), 45);

Structs

GitFinding

serde_json object that represents a single found secret - finding

GitScanner

Contains helper functions for performing scans of Git repositories

Enums

GitScheme

enum used by init_git_repo to communicate the type of git repo specified by the supplied URL