detect-secrets-js
Version:
A JavaScript implementation of Yelp's detect-secrets tool - no Python required
51 lines (50 loc) • 1.97 kB
TypeScript
import { ScanResults, Secret } from "./types";
import { ScanOptions } from "./types";
/**
* Git blame information about a specific line
*/
interface GitBlameInfo {
author: string;
email: string;
date: string;
commit: string;
message: string;
}
/**
* Scan a local directory for secrets using Gitleaks
* @param directory The directory to scan
* @param scanGitHistory Whether to scan git history (commits)
* @returns Scan results
*/
export declare function runGitleaksScan(directory: string, scanOptions?: ScanOptions): Promise<ScanResults>;
/**
* Clone and scan a remote repository for secrets
* @param repoUrl URL of the Git repository to scan
* @param branch Optional branch to check out
* @returns Scan results
*/
export declare function scanRemoteRepository(repoUrl: string, scanOptions?: ScanOptions): Promise<ScanResults>;
/**
* Scan Git history (commits) for secrets in a local repository
* @param directory The directory containing the Git repository
* @param fromCommit Optional starting commit hash
* @param toCommit Optional ending commit hash
* @returns Scan results
*/
export declare function scanGitHistory(directory: string, fromCommit?: string, toCommit?: string, scanOptions?: ScanOptions): Promise<ScanResults>;
/**
* Get git blame information for a specific file and line
* @param filePath Path to the file
* @param lineNumber Line number to blame
* @param scanOptions Optional scan options
* @returns Object with author, email, date, and commit message
*/
export declare function getGitBlameInfo(filePath: string, lineNumber: number, scanOptions?: ScanOptions): Promise<GitBlameInfo>;
/**
* Enrich secrets with git blame information
* @param secrets Array of secrets to enrich
* @param scanOptions Optional scan options
* @returns Enriched secrets with author information
*/
export declare function enrichSecretsWithBlameInfo(secrets: Secret[], scanOptions?: ScanOptions): Promise<Secret[]>;
export {};