guardrail-security 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sbom/generator.d.ts +42 -0
- package/dist/sbom/generator.d.ts.map +1 -1
- package/dist/sbom/generator.js +168 -7
- package/dist/secrets/allowlist.d.ts +38 -0
- package/dist/secrets/allowlist.d.ts.map +1 -0
- package/dist/secrets/allowlist.js +131 -0
- package/dist/secrets/config-loader.d.ts +25 -0
- package/dist/secrets/config-loader.d.ts.map +1 -0
- package/dist/secrets/config-loader.js +103 -0
- package/dist/secrets/contextual-risk.d.ts +19 -0
- package/dist/secrets/contextual-risk.d.ts.map +1 -0
- package/dist/secrets/contextual-risk.js +88 -0
- package/dist/secrets/git-scanner.d.ts +29 -0
- package/dist/secrets/git-scanner.d.ts.map +1 -0
- package/dist/secrets/git-scanner.js +109 -0
- package/dist/secrets/guardian.d.ts +70 -57
- package/dist/secrets/guardian.d.ts.map +1 -1
- package/dist/secrets/guardian.js +531 -258
- package/dist/secrets/index.d.ts +4 -0
- package/dist/secrets/index.d.ts.map +1 -1
- package/dist/secrets/index.js +11 -1
- package/dist/secrets/patterns.d.ts +39 -10
- package/dist/secrets/patterns.d.ts.map +1 -1
- package/dist/secrets/patterns.js +129 -71
- package/dist/secrets/pre-commit.d.ts.map +1 -1
- package/dist/secrets/pre-commit.js +1 -1
- package/dist/secrets/vault-integration.d.ts.map +1 -1
- package/dist/secrets/vault-integration.js +1 -0
- package/dist/supply-chain/vulnerability-db.d.ts +89 -16
- package/dist/supply-chain/vulnerability-db.d.ts.map +1 -1
- package/dist/supply-chain/vulnerability-db.js +404 -115
- package/dist/utils/semver.d.ts +37 -0
- package/dist/utils/semver.d.ts.map +1 -0
- package/dist/utils/semver.js +109 -0
- package/package.json +17 -3
- package/src/__tests__/license/engine.test.ts +0 -250
- package/src/__tests__/supply-chain/typosquat.test.ts +0 -191
- package/src/attack-surface/analyzer.ts +0 -153
- package/src/attack-surface/index.ts +0 -5
- package/src/index.ts +0 -21
- package/src/languages/index.ts +0 -91
- package/src/languages/java-analyzer.ts +0 -490
- package/src/languages/python-analyzer.ts +0 -498
- package/src/license/compatibility-matrix.ts +0 -366
- package/src/license/engine.ts +0 -346
- package/src/license/index.ts +0 -6
- package/src/sbom/generator.ts +0 -355
- package/src/sbom/index.ts +0 -5
- package/src/secrets/guardian.ts +0 -468
- package/src/secrets/index.ts +0 -10
- package/src/secrets/patterns.ts +0 -186
- package/src/secrets/pre-commit.ts +0 -158
- package/src/secrets/vault-integration.ts +0 -360
- package/src/secrets/vault-providers.ts +0 -446
- package/src/supply-chain/detector.ts +0 -253
- package/src/supply-chain/index.ts +0 -11
- package/src/supply-chain/malicious-db.ts +0 -103
- package/src/supply-chain/script-analyzer.ts +0 -194
- package/src/supply-chain/typosquat.ts +0 -302
- package/src/supply-chain/vulnerability-db.ts +0 -386
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* contextual-risk.ts
|
|
4
|
+
* Adjust risk levels based on file context (examples, templates, production code)
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.adjustRiskByContext = adjustRiskByContext;
|
|
8
|
+
exports.getContextDescription = getContextDescription;
|
|
9
|
+
/**
|
|
10
|
+
* Adjust risk based on file context
|
|
11
|
+
*/
|
|
12
|
+
function adjustRiskByContext(context) {
|
|
13
|
+
const { filePath, entropy, originalRisk } = context;
|
|
14
|
+
const lowerPath = filePath.toLowerCase();
|
|
15
|
+
// Example/template files: downgrade unless extremely high entropy
|
|
16
|
+
if (isExampleOrTemplate(lowerPath)) {
|
|
17
|
+
if (entropy >= 5.0) {
|
|
18
|
+
// Extremely high entropy in example file - suspicious, keep original risk
|
|
19
|
+
return originalRisk;
|
|
20
|
+
}
|
|
21
|
+
// Downgrade risk for example/template files
|
|
22
|
+
if (originalRisk === 'high')
|
|
23
|
+
return 'medium';
|
|
24
|
+
if (originalRisk === 'medium')
|
|
25
|
+
return 'low';
|
|
26
|
+
return 'low';
|
|
27
|
+
}
|
|
28
|
+
// Production-like files: upgrade risk for medium findings
|
|
29
|
+
if (isProductionContext(lowerPath)) {
|
|
30
|
+
if (originalRisk === 'medium' && entropy >= 4.5) {
|
|
31
|
+
return 'high';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return originalRisk;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Check if file is an example or template
|
|
38
|
+
*/
|
|
39
|
+
function isExampleOrTemplate(filePath) {
|
|
40
|
+
const patterns = [
|
|
41
|
+
/\.example$/,
|
|
42
|
+
/\.template$/,
|
|
43
|
+
/\.sample$/,
|
|
44
|
+
/\.dist$/,
|
|
45
|
+
/\.example\./,
|
|
46
|
+
/\.template\./,
|
|
47
|
+
/\.sample\./,
|
|
48
|
+
/env\.example/,
|
|
49
|
+
/config\.example/,
|
|
50
|
+
/settings\.example/,
|
|
51
|
+
/\/examples?\//,
|
|
52
|
+
/\/templates?\//,
|
|
53
|
+
/\/samples?\//,
|
|
54
|
+
/\/demo\//,
|
|
55
|
+
/\/fixtures?\//,
|
|
56
|
+
];
|
|
57
|
+
return patterns.some(p => p.test(filePath));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Check if file is in production context
|
|
61
|
+
*/
|
|
62
|
+
function isProductionContext(filePath) {
|
|
63
|
+
const patterns = [
|
|
64
|
+
/^\.env$/,
|
|
65
|
+
/\/\.env$/,
|
|
66
|
+
/\/config\/production\./,
|
|
67
|
+
/\/config\/prod\./,
|
|
68
|
+
/production\.config/,
|
|
69
|
+
/prod\.config/,
|
|
70
|
+
/\/src\/config\//,
|
|
71
|
+
/\/lib\/config\//,
|
|
72
|
+
/\/app\/config\//,
|
|
73
|
+
];
|
|
74
|
+
return patterns.some(p => p.test(filePath));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get context description for reporting
|
|
78
|
+
*/
|
|
79
|
+
function getContextDescription(filePath) {
|
|
80
|
+
const lowerPath = filePath.toLowerCase();
|
|
81
|
+
if (isExampleOrTemplate(lowerPath)) {
|
|
82
|
+
return 'example/template file';
|
|
83
|
+
}
|
|
84
|
+
if (isProductionContext(lowerPath)) {
|
|
85
|
+
return 'production configuration';
|
|
86
|
+
}
|
|
87
|
+
return 'source file';
|
|
88
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git-scanner.ts
|
|
3
|
+
* Scan git history for secrets in commit diffs
|
|
4
|
+
*/
|
|
5
|
+
import { SecretDetection, SecretsGuardian, ScanOptions } from './guardian';
|
|
6
|
+
export interface HistoricalDetection extends SecretDetection {
|
|
7
|
+
commitHash: string;
|
|
8
|
+
commitDate: string;
|
|
9
|
+
author: string;
|
|
10
|
+
}
|
|
11
|
+
export interface GitHistoryScanOptions extends ScanOptions {
|
|
12
|
+
depth?: number;
|
|
13
|
+
branch?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface GitHistoryScanResult {
|
|
16
|
+
projectId: string;
|
|
17
|
+
commitsScanned: number;
|
|
18
|
+
detections: HistoricalDetection[];
|
|
19
|
+
summary: {
|
|
20
|
+
totalSecrets: number;
|
|
21
|
+
byCommit: Record<string, number>;
|
|
22
|
+
byType: Record<string, number>;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Scan git history for secrets
|
|
27
|
+
*/
|
|
28
|
+
export declare function scanGitHistory(projectPath: string, projectId: string, guardian: SecretsGuardian, options?: GitHistoryScanOptions): Promise<GitHistoryScanResult>;
|
|
29
|
+
//# sourceMappingURL=git-scanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-scanner.d.ts","sourceRoot":"","sources":["../../src/secrets/git-scanner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE3E,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,mBAAmB,EAAE,CAAC;IAClC,OAAO,EAAE;QACP,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAChC,CAAC;CACH;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,eAAe,EACzB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,oBAAoB,CAAC,CAqD/B"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* git-scanner.ts
|
|
4
|
+
* Scan git history for secrets in commit diffs
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.scanGitHistory = scanGitHistory;
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
const path_1 = require("path");
|
|
11
|
+
/**
|
|
12
|
+
* Scan git history for secrets
|
|
13
|
+
*/
|
|
14
|
+
async function scanGitHistory(projectPath, projectId, guardian, options = {}) {
|
|
15
|
+
const depth = options.depth ?? 50;
|
|
16
|
+
const branch = options.branch ?? 'HEAD';
|
|
17
|
+
// Check if git repo exists
|
|
18
|
+
const gitDir = (0, path_1.join)(projectPath, '.git');
|
|
19
|
+
if (!(0, fs_1.existsSync)(gitDir)) {
|
|
20
|
+
throw new Error('Not a git repository');
|
|
21
|
+
}
|
|
22
|
+
// Get commit list
|
|
23
|
+
const commits = getRecentCommits(projectPath, depth, branch);
|
|
24
|
+
const allDetections = [];
|
|
25
|
+
const byCommit = {};
|
|
26
|
+
const byType = {};
|
|
27
|
+
for (const commit of commits) {
|
|
28
|
+
const diff = getCommitDiff(projectPath, commit.hash);
|
|
29
|
+
// Scan the diff content
|
|
30
|
+
const detections = await guardian.scanContent(diff, `commit:${commit.hash}`, projectId, options);
|
|
31
|
+
// Convert to historical detections
|
|
32
|
+
for (const detection of detections) {
|
|
33
|
+
const historical = {
|
|
34
|
+
...detection,
|
|
35
|
+
commitHash: commit.hash,
|
|
36
|
+
commitDate: commit.date,
|
|
37
|
+
author: commit.author,
|
|
38
|
+
};
|
|
39
|
+
allDetections.push(historical);
|
|
40
|
+
byCommit[commit.hash] = (byCommit[commit.hash] ?? 0) + 1;
|
|
41
|
+
byType[detection.secretType] = (byType[detection.secretType] ?? 0) + 1;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
projectId,
|
|
46
|
+
commitsScanned: commits.length,
|
|
47
|
+
detections: allDetections,
|
|
48
|
+
summary: {
|
|
49
|
+
totalSecrets: allDetections.length,
|
|
50
|
+
byCommit,
|
|
51
|
+
byType,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get recent commits
|
|
57
|
+
*/
|
|
58
|
+
function getRecentCommits(projectPath, depth, branch) {
|
|
59
|
+
try {
|
|
60
|
+
const output = (0, child_process_1.execSync)(`git log ${branch} --format=%H|%aI|%an -n ${depth}`, {
|
|
61
|
+
cwd: projectPath,
|
|
62
|
+
encoding: 'utf-8',
|
|
63
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
64
|
+
});
|
|
65
|
+
const commits = [];
|
|
66
|
+
const lines = output.trim().split('\n');
|
|
67
|
+
for (const line of lines) {
|
|
68
|
+
const parts = line.split('|');
|
|
69
|
+
if (parts.length >= 3) {
|
|
70
|
+
commits.push({
|
|
71
|
+
hash: parts[0] ?? '',
|
|
72
|
+
date: parts[1] ?? '',
|
|
73
|
+
author: parts[2] ?? '',
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return commits;
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
throw new Error(`Failed to get git commits: ${err.message}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Get diff for a commit
|
|
85
|
+
*/
|
|
86
|
+
function getCommitDiff(projectPath, commitHash) {
|
|
87
|
+
try {
|
|
88
|
+
// Get the diff for added lines only (+ lines)
|
|
89
|
+
const output = (0, child_process_1.execSync)(`git show ${commitHash} --format= --unified=0`, {
|
|
90
|
+
cwd: projectPath,
|
|
91
|
+
encoding: 'utf-8',
|
|
92
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
93
|
+
});
|
|
94
|
+
// Extract only added lines (lines starting with +)
|
|
95
|
+
const lines = output.split('\n');
|
|
96
|
+
const addedLines = [];
|
|
97
|
+
for (const line of lines) {
|
|
98
|
+
if (line.startsWith('+') && !line.startsWith('+++')) {
|
|
99
|
+
// Remove the leading + and add to content
|
|
100
|
+
addedLines.push(line.substring(1));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return addedLines.join('\n');
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
// If commit doesn't exist or error, return empty
|
|
107
|
+
return '';
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -1,30 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
PASSWORD = "password",
|
|
4
|
-
TOKEN = "token",
|
|
5
|
-
CERTIFICATE = "certificate",
|
|
6
|
-
PRIVATE_KEY = "private_key",
|
|
7
|
-
DATABASE_URL = "database_url",
|
|
8
|
-
JWT_SECRET = "jwt_secret",
|
|
9
|
-
AWS_ACCESS_KEY = "aws_access_key",
|
|
10
|
-
OTHER = "other",
|
|
11
|
-
AWS_SECRET_KEY = "aws_secret_key",
|
|
12
|
-
GITHUB_TOKEN = "github_token",
|
|
13
|
-
GOOGLE_API_KEY = "google_api_key",
|
|
14
|
-
STRIPE_KEY = "stripe_key",
|
|
15
|
-
JWT_TOKEN = "jwt_token",
|
|
16
|
-
SLACK_TOKEN = "slack_token",
|
|
17
|
-
API_KEY_GENERIC = "api_key_generic",
|
|
18
|
-
PASSWORD_GENERIC = "password_generic"
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Secret detection result
|
|
22
|
-
*/
|
|
1
|
+
import { SecretType, RiskLevel } from './patterns';
|
|
2
|
+
import { Allowlist } from './allowlist';
|
|
23
3
|
export interface SecretDetection {
|
|
24
4
|
id?: string;
|
|
5
|
+
projectId: string;
|
|
25
6
|
filePath: string;
|
|
26
7
|
secretType: SecretType;
|
|
8
|
+
risk: RiskLevel;
|
|
9
|
+
/** Safe for logs/UI */
|
|
27
10
|
maskedValue: string;
|
|
11
|
+
/** Hash of the raw value (never store raw secrets) */
|
|
12
|
+
valueHash: string;
|
|
13
|
+
/** Stable key for dedupe across runs */
|
|
14
|
+
fingerprint: string;
|
|
28
15
|
location: {
|
|
29
16
|
line: number;
|
|
30
17
|
column: number;
|
|
@@ -33,6 +20,7 @@ export interface SecretDetection {
|
|
|
33
20
|
confidence: number;
|
|
34
21
|
entropy: number;
|
|
35
22
|
isTest: boolean;
|
|
23
|
+
/** For future integrations (revocation checks) */
|
|
36
24
|
isRevoked: boolean;
|
|
37
25
|
recommendation: {
|
|
38
26
|
action: 'remove' | 'move_to_env' | 'use_vault' | 'revoke_and_rotate';
|
|
@@ -40,21 +28,25 @@ export interface SecretDetection {
|
|
|
40
28
|
remediation: string;
|
|
41
29
|
};
|
|
42
30
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Scan options
|
|
45
|
-
*/
|
|
46
31
|
export interface ScanOptions {
|
|
47
32
|
excludeTests?: boolean;
|
|
48
33
|
minConfidence?: number;
|
|
34
|
+
/** Additional glob excludes */
|
|
49
35
|
excludePatterns?: string[];
|
|
36
|
+
/** Safety/perf */
|
|
37
|
+
maxFileSizeBytes?: number;
|
|
38
|
+
concurrency?: number;
|
|
39
|
+
skipBinaryFiles?: boolean;
|
|
40
|
+
/** Custom patterns and allowlist */
|
|
41
|
+
useCustomPatterns?: boolean;
|
|
42
|
+
useAllowlist?: boolean;
|
|
43
|
+
useContextualRisk?: boolean;
|
|
50
44
|
}
|
|
51
|
-
/**
|
|
52
|
-
* Project scan report
|
|
53
|
-
*/
|
|
54
45
|
export interface ProjectScanReport {
|
|
55
46
|
projectId: string;
|
|
56
47
|
totalFiles: number;
|
|
57
48
|
scannedFiles: number;
|
|
49
|
+
skippedFiles: number;
|
|
58
50
|
detections: SecretDetection[];
|
|
59
51
|
summary: {
|
|
60
52
|
totalSecrets: number;
|
|
@@ -65,49 +57,70 @@ export interface ProjectScanReport {
|
|
|
65
57
|
low: number;
|
|
66
58
|
};
|
|
67
59
|
};
|
|
60
|
+
performance: {
|
|
61
|
+
skippedLarge: number;
|
|
62
|
+
skippedBinary: number;
|
|
63
|
+
allowlistSuppressed: number;
|
|
64
|
+
customPatternsLoaded: number;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export interface Logger {
|
|
68
|
+
debug(msg: string, meta?: Record<string, unknown>): void;
|
|
69
|
+
info(msg: string, meta?: Record<string, unknown>): void;
|
|
70
|
+
warn(msg: string, meta?: Record<string, unknown>): void;
|
|
71
|
+
error(msg: string, meta?: Record<string, unknown>): void;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Optional persistence contract (enterprise-grade).
|
|
75
|
+
* Implement with Prisma, SQL, or ship no-op in OSS/free tier.
|
|
76
|
+
*/
|
|
77
|
+
export interface SecretStore {
|
|
78
|
+
saveDetections(projectId: string, detections: SecretDetection[]): Promise<void>;
|
|
79
|
+
listDetections(projectId: string): Promise<SecretDetection[]>;
|
|
80
|
+
}
|
|
81
|
+
export declare class NoopSecretStore implements SecretStore {
|
|
82
|
+
saveDetections(): Promise<void>;
|
|
83
|
+
listDetections(): Promise<SecretDetection[]>;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Minimal Prisma adapter (safe: stores hashes + masked only).
|
|
87
|
+
* NOTE: adjust model/table/columns to match your schema.
|
|
88
|
+
*/
|
|
89
|
+
export declare class PrismaSecretStore implements SecretStore {
|
|
90
|
+
private readonly prisma;
|
|
91
|
+
constructor(prisma: any);
|
|
92
|
+
saveDetections(projectId: string, detections: SecretDetection[]): Promise<void>;
|
|
93
|
+
listDetections(projectId: string): Promise<SecretDetection[]>;
|
|
68
94
|
}
|
|
69
95
|
/**
|
|
70
96
|
* Secrets & Credential Guardian
|
|
71
|
-
*
|
|
72
|
-
* Detects exposed secrets and credentials in code
|
|
73
97
|
*/
|
|
74
98
|
export declare class SecretsGuardian {
|
|
99
|
+
private readonly store;
|
|
100
|
+
private readonly logger;
|
|
101
|
+
private compiledPatterns;
|
|
102
|
+
private customPatternsCount;
|
|
103
|
+
constructor(opts?: {
|
|
104
|
+
store?: SecretStore;
|
|
105
|
+
logger?: Logger;
|
|
106
|
+
});
|
|
75
107
|
/**
|
|
76
|
-
*
|
|
77
|
-
*/
|
|
78
|
-
scanContent(content: string, filePath: string, options?: ScanOptions): Promise<SecretDetection[]>;
|
|
79
|
-
/**
|
|
80
|
-
* Scan entire project
|
|
108
|
+
* Load custom patterns from project config
|
|
81
109
|
*/
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Calculate entropy for randomness detection
|
|
85
|
-
*/
|
|
86
|
-
private calculateEntropy;
|
|
110
|
+
loadCustomPatterns(projectPath: string): void;
|
|
87
111
|
/**
|
|
88
|
-
*
|
|
89
|
-
*/
|
|
90
|
-
private isTestValue;
|
|
91
|
-
/**
|
|
92
|
-
* Check for false positives
|
|
93
|
-
*/
|
|
94
|
-
private isFalsePositive;
|
|
95
|
-
/**
|
|
96
|
-
* Calculate confidence score
|
|
97
|
-
*/
|
|
98
|
-
private calculateConfidence;
|
|
99
|
-
/**
|
|
100
|
-
* Mask secret for safe logging
|
|
112
|
+
* Scan content for secrets
|
|
101
113
|
*/
|
|
102
|
-
|
|
114
|
+
scanContent(content: string, filePath: string, projectId: string, options?: ScanOptions, allowlist?: Allowlist): Promise<SecretDetection[]>;
|
|
103
115
|
/**
|
|
104
|
-
*
|
|
116
|
+
* Scan an entire project directory
|
|
105
117
|
*/
|
|
106
|
-
|
|
118
|
+
scanProject(projectPath: string, projectId: string, options?: ScanOptions): Promise<ProjectScanReport>;
|
|
107
119
|
/**
|
|
108
|
-
*
|
|
120
|
+
* Retrieve detections from store
|
|
109
121
|
*/
|
|
110
122
|
getProjectReport(projectId: string): Promise<SecretDetection[]>;
|
|
111
123
|
}
|
|
124
|
+
/** Singleton (uses Noop store unless you wire it) */
|
|
112
125
|
export declare const secretsGuardian: SecretsGuardian;
|
|
113
126
|
//# sourceMappingURL=guardian.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guardian.d.ts","sourceRoot":"","sources":["../../src/secrets/guardian.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"guardian.d.ts","sourceRoot":"","sources":["../../src/secrets/guardian.ts"],"names":[],"mappings":"AAeA,OAAO,EAML,UAAU,EACV,SAAS,EACV,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,WAAW,eAAe;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IAEjB,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,EAAE,SAAS,CAAC;IAEhB,uB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