detect-secrets-js
Version:
A JavaScript implementation of Yelp's detect-secrets tool - no Python required
119 lines (100 loc) • 1.79 kB
text/typescript
/**
* Options for scanning a directory for secrets
*/
export interface ScanOptions {
/**
* Directory to scan (default: current directory)
*/
directory?: string;
/**
* Scan from project root
*/
root?: boolean;
/**
* File patterns to exclude
*/
excludeFiles?: string[];
/**
* Directory patterns to exclude
*/
excludeDirs?: string[];
/**
* Check for potentially missed secrets
*/
checkMissed?: boolean;
/**
* Include additional information
*/
verbose?: boolean;
/**
* Output file path
*/
output?: string;
/**
* Enable file size limits (default: false)
*/
limitFileSize?: boolean;
/**
* Maximum file size to scan in bytes (default: 0, no limit)
*/
maxFileSize?: number;
}
/**
* A detected secret
*/
export interface Secret {
/**
* File path where the secret was found
*/
file: string;
/**
* Line number where the secret was found
*/
line: number | string;
/**
* Types of secrets detected
*/
types: string[];
/**
* Whether the secret is likely a false positive
*/
is_false_positive: boolean;
/**
* Hashed value of the secret
*/
hashed_secret?: string;
}
/**
* A potentially missed secret
*/
export interface MissedSecret {
/**
* File path where the secret was found
*/
file: string;
/**
* Line number where the secret was found
*/
line: number;
/**
* Type of secret
*/
type: string;
}
/**
* Scan results
*/
export interface ScanResults {
/**
* Detected secrets
*/
secrets: Secret[];
/**
* Potentially missed secrets
*/
missed_secrets: MissedSecret[];
/**
* Whether the file was truncated due to size limits
*/
truncated?: boolean;
}