code-secret-handler 1.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/LICENSE +79 -0
- package/README.md +221 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +121 -0
- package/dist/cli.js.map +1 -0
- package/dist/env/envWriter.d.ts +9 -0
- package/dist/env/envWriter.d.ts.map +1 -0
- package/dist/env/envWriter.js +76 -0
- package/dist/env/envWriter.js.map +1 -0
- package/dist/env/keyNamer.d.ts +13 -0
- package/dist/env/keyNamer.d.ts.map +1 -0
- package/dist/env/keyNamer.js +33 -0
- package/dist/env/keyNamer.js.map +1 -0
- package/dist/interactive/confirm.d.ts +16 -0
- package/dist/interactive/confirm.d.ts.map +1 -0
- package/dist/interactive/confirm.js +72 -0
- package/dist/interactive/confirm.js.map +1 -0
- package/dist/license/gitContext.d.ts +16 -0
- package/dist/license/gitContext.d.ts.map +1 -0
- package/dist/license/gitContext.js +117 -0
- package/dist/license/gitContext.js.map +1 -0
- package/dist/license/licenseCheck.d.ts +22 -0
- package/dist/license/licenseCheck.d.ts.map +1 -0
- package/dist/license/licenseCheck.js +119 -0
- package/dist/license/licenseCheck.js.map +1 -0
- package/dist/license/telemetry.d.ts +17 -0
- package/dist/license/telemetry.d.ts.map +1 -0
- package/dist/license/telemetry.js +87 -0
- package/dist/license/telemetry.js.map +1 -0
- package/dist/reporter/console.d.ts +3 -0
- package/dist/reporter/console.d.ts.map +1 -0
- package/dist/reporter/console.js +96 -0
- package/dist/reporter/console.js.map +1 -0
- package/dist/reporter/csv.d.ts +6 -0
- package/dist/reporter/csv.d.ts.map +1 -0
- package/dist/reporter/csv.js +56 -0
- package/dist/reporter/csv.js.map +1 -0
- package/dist/reporter/index.d.ts +13 -0
- package/dist/reporter/index.d.ts.map +1 -0
- package/dist/reporter/index.js +52 -0
- package/dist/reporter/index.js.map +1 -0
- package/dist/reporter/json.d.ts +7 -0
- package/dist/reporter/json.d.ts.map +1 -0
- package/dist/reporter/json.js +39 -0
- package/dist/reporter/json.js.map +1 -0
- package/dist/reporter/markdown.d.ts +6 -0
- package/dist/reporter/markdown.d.ts.map +1 -0
- package/dist/reporter/markdown.js +106 -0
- package/dist/reporter/markdown.js.map +1 -0
- package/dist/rewriter/index.d.ts +9 -0
- package/dist/rewriter/index.d.ts.map +1 -0
- package/dist/rewriter/index.js +95 -0
- package/dist/rewriter/index.js.map +1 -0
- package/dist/rewriter/langDetector.d.ts +7 -0
- package/dist/rewriter/langDetector.d.ts.map +1 -0
- package/dist/rewriter/langDetector.js +96 -0
- package/dist/rewriter/langDetector.js.map +1 -0
- package/dist/rewriter/templates/csharp.d.ts +8 -0
- package/dist/rewriter/templates/csharp.d.ts.map +1 -0
- package/dist/rewriter/templates/csharp.js +36 -0
- package/dist/rewriter/templates/csharp.js.map +1 -0
- package/dist/rewriter/templates/generic.d.ts +7 -0
- package/dist/rewriter/templates/generic.d.ts.map +1 -0
- package/dist/rewriter/templates/generic.js +40 -0
- package/dist/rewriter/templates/generic.js.map +1 -0
- package/dist/rewriter/templates/go.d.ts +8 -0
- package/dist/rewriter/templates/go.d.ts.map +1 -0
- package/dist/rewriter/templates/go.js +56 -0
- package/dist/rewriter/templates/go.js.map +1 -0
- package/dist/rewriter/templates/java.d.ts +7 -0
- package/dist/rewriter/templates/java.d.ts.map +1 -0
- package/dist/rewriter/templates/java.js +31 -0
- package/dist/rewriter/templates/java.js.map +1 -0
- package/dist/rewriter/templates/javascript.d.ts +10 -0
- package/dist/rewriter/templates/javascript.d.ts.map +1 -0
- package/dist/rewriter/templates/javascript.js +54 -0
- package/dist/rewriter/templates/javascript.js.map +1 -0
- package/dist/rewriter/templates/php.d.ts +8 -0
- package/dist/rewriter/templates/php.d.ts.map +1 -0
- package/dist/rewriter/templates/php.js +41 -0
- package/dist/rewriter/templates/php.js.map +1 -0
- package/dist/rewriter/templates/properties.d.ts +9 -0
- package/dist/rewriter/templates/properties.d.ts.map +1 -0
- package/dist/rewriter/templates/properties.js +39 -0
- package/dist/rewriter/templates/properties.js.map +1 -0
- package/dist/rewriter/templates/python.d.ts +8 -0
- package/dist/rewriter/templates/python.d.ts.map +1 -0
- package/dist/rewriter/templates/python.js +48 -0
- package/dist/rewriter/templates/python.js.map +1 -0
- package/dist/rewriter/templates/ruby.d.ts +8 -0
- package/dist/rewriter/templates/ruby.d.ts.map +1 -0
- package/dist/rewriter/templates/ruby.js +40 -0
- package/dist/rewriter/templates/ruby.js.map +1 -0
- package/dist/rewriter/templates/rust.d.ts +7 -0
- package/dist/rewriter/templates/rust.d.ts.map +1 -0
- package/dist/rewriter/templates/rust.js +27 -0
- package/dist/rewriter/templates/rust.js.map +1 -0
- package/dist/rewriter/templates/shell.d.ts +7 -0
- package/dist/rewriter/templates/shell.d.ts.map +1 -0
- package/dist/rewriter/templates/shell.js +42 -0
- package/dist/rewriter/templates/shell.js.map +1 -0
- package/dist/rewriter/templates/toml.d.ts +9 -0
- package/dist/rewriter/templates/toml.d.ts.map +1 -0
- package/dist/rewriter/templates/toml.js +34 -0
- package/dist/rewriter/templates/toml.js.map +1 -0
- package/dist/rewriter/templates/yaml.d.ts +8 -0
- package/dist/rewriter/templates/yaml.d.ts.map +1 -0
- package/dist/rewriter/templates/yaml.js +37 -0
- package/dist/rewriter/templates/yaml.js.map +1 -0
- package/dist/scanner/detector.d.ts +18 -0
- package/dist/scanner/detector.d.ts.map +1 -0
- package/dist/scanner/detector.js +156 -0
- package/dist/scanner/detector.js.map +1 -0
- package/dist/scanner/fileWalker.d.ts +6 -0
- package/dist/scanner/fileWalker.d.ts.map +1 -0
- package/dist/scanner/fileWalker.js +146 -0
- package/dist/scanner/fileWalker.js.map +1 -0
- package/dist/scanner/index.d.ts +8 -0
- package/dist/scanner/index.d.ts.map +1 -0
- package/dist/scanner/index.js +74 -0
- package/dist/scanner/index.js.map +1 -0
- package/dist/scanner/rules/aws.d.ts +6 -0
- package/dist/scanner/rules/aws.d.ts.map +1 -0
- package/dist/scanner/rules/aws.js +90 -0
- package/dist/scanner/rules/aws.js.map +1 -0
- package/dist/scanner/rules/azure.d.ts +6 -0
- package/dist/scanner/rules/azure.d.ts.map +1 -0
- package/dist/scanner/rules/azure.js +86 -0
- package/dist/scanner/rules/azure.js.map +1 -0
- package/dist/scanner/rules/cloud.d.ts +11 -0
- package/dist/scanner/rules/cloud.d.ts.map +1 -0
- package/dist/scanner/rules/cloud.js +1066 -0
- package/dist/scanner/rules/cloud.js.map +1 -0
- package/dist/scanner/rules/database.d.ts +6 -0
- package/dist/scanner/rules/database.d.ts.map +1 -0
- package/dist/scanner/rules/database.js +283 -0
- package/dist/scanner/rules/database.js.map +1 -0
- package/dist/scanner/rules/gcp.d.ts +6 -0
- package/dist/scanner/rules/gcp.d.ts.map +1 -0
- package/dist/scanner/rules/gcp.js +108 -0
- package/dist/scanner/rules/gcp.js.map +1 -0
- package/dist/scanner/rules/generic.d.ts +13 -0
- package/dist/scanner/rules/generic.d.ts.map +1 -0
- package/dist/scanner/rules/generic.js +305 -0
- package/dist/scanner/rules/generic.js.map +1 -0
- package/dist/scanner/rules/index.d.ts +18 -0
- package/dist/scanner/rules/index.d.ts.map +1 -0
- package/dist/scanner/rules/index.js +40 -0
- package/dist/scanner/rules/index.js.map +1 -0
- package/dist/scanner/rules/jwt.d.ts +6 -0
- package/dist/scanner/rules/jwt.d.ts.map +1 -0
- package/dist/scanner/rules/jwt.js +97 -0
- package/dist/scanner/rules/jwt.js.map +1 -0
- package/dist/scanner/rules/network.d.ts +7 -0
- package/dist/scanner/rules/network.d.ts.map +1 -0
- package/dist/scanner/rules/network.js +166 -0
- package/dist/scanner/rules/network.js.map +1 -0
- package/dist/scanner/rules/privateKey.d.ts +6 -0
- package/dist/scanner/rules/privateKey.d.ts.map +1 -0
- package/dist/scanner/rules/privateKey.js +60 -0
- package/dist/scanner/rules/privateKey.js.map +1 -0
- package/dist/scanner/rules/ssh.d.ts +6 -0
- package/dist/scanner/rules/ssh.d.ts.map +1 -0
- package/dist/scanner/rules/ssh.js +49 -0
- package/dist/scanner/rules/ssh.js.map +1 -0
- package/dist/types.d.ts +78 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.writeCsvReport = writeCsvReport;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
function escapeCsv(value) {
|
|
10
|
+
// If value contains comma, newline, or double quote, wrap in quotes
|
|
11
|
+
if (/[",\n\r]/.test(value)) {
|
|
12
|
+
return `"${value.replace(/"/g, '""')}"`;
|
|
13
|
+
}
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
function maskValue(value) {
|
|
17
|
+
if (value.length <= 8)
|
|
18
|
+
return '*'.repeat(value.length);
|
|
19
|
+
return value.slice(0, 4) + '*'.repeat(Math.min(value.length - 8, 20)) + value.slice(-4);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Writes a CSV report of the scan findings.
|
|
23
|
+
*/
|
|
24
|
+
function writeCsvReport(summary, outputPath) {
|
|
25
|
+
const headers = [
|
|
26
|
+
'File',
|
|
27
|
+
'Line',
|
|
28
|
+
'Column',
|
|
29
|
+
'Severity',
|
|
30
|
+
'Rule ID',
|
|
31
|
+
'Description',
|
|
32
|
+
'Env Key',
|
|
33
|
+
'Masked Value',
|
|
34
|
+
'Line Content',
|
|
35
|
+
];
|
|
36
|
+
const rows = summary.findings.map(f => [
|
|
37
|
+
f.file,
|
|
38
|
+
String(f.line),
|
|
39
|
+
String(f.column),
|
|
40
|
+
f.rule.severity,
|
|
41
|
+
f.rule.id,
|
|
42
|
+
f.rule.description,
|
|
43
|
+
f.envKey,
|
|
44
|
+
maskValue(f.rawValue),
|
|
45
|
+
f.lineContent.trim(),
|
|
46
|
+
]);
|
|
47
|
+
const csvLines = [
|
|
48
|
+
headers.map(escapeCsv).join(','),
|
|
49
|
+
...rows.map(row => row.map(escapeCsv).join(',')),
|
|
50
|
+
];
|
|
51
|
+
const dir = path_1.default.dirname(outputPath);
|
|
52
|
+
if (!fs_1.default.existsSync(dir))
|
|
53
|
+
fs_1.default.mkdirSync(dir, { recursive: true });
|
|
54
|
+
fs_1.default.writeFileSync(outputPath, csvLines.join('\n'), 'utf-8');
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=csv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csv.js","sourceRoot":"","sources":["../../src/reporter/csv.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAGxB,SAAS,SAAS,CAAC,KAAa;IAC9B,oEAAoE;IACpE,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC;IAC1C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC9B,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACvD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1F,CAAC;AAED;;GAEG;AACH,wB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
|
3
|
+
* Derives the default output file path for a given report format.
|
|
4
|
+
*/
|
|
5
|
+
export declare function defaultOutputPath(format: ReportFormat, targetDir: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Runs the appropriate reporter(s) based on the chosen format.
|
|
8
|
+
* Always prints a console summary; file reporters write to outputPath.
|
|
9
|
+
*
|
|
10
|
+
* @returns The output file path (empty string for console-only).
|
|
11
|
+
*/
|
|
12
|
+
export declare function runReporter(format: ReportFormat, summary: ScanSummary, outputPath?: string): string;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reporter/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAYrD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAIjF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,WAAW,EACpB,UAAU,CAAC,EAAE,MAAM,GAClB,MAAM,CAqBR"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.defaultOutputPath = defaultOutputPath;
|
|
7
|
+
exports.runReporter = runReporter;
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const console_1 = require("./console");
|
|
10
|
+
const json_1 = require("./json");
|
|
11
|
+
const csv_1 = require("./csv");
|
|
12
|
+
const markdown_1 = require("./markdown");
|
|
13
|
+
const EXT_MAP = {
|
|
14
|
+
json: 'json',
|
|
15
|
+
csv: 'csv',
|
|
16
|
+
markdown: 'md',
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Derives the default output file path for a given report format.
|
|
20
|
+
*/
|
|
21
|
+
function defaultOutputPath(format, targetDir) {
|
|
22
|
+
if (format === 'console')
|
|
23
|
+
return '';
|
|
24
|
+
const ext = EXT_MAP[format];
|
|
25
|
+
return path_1.default.join(targetDir, `secret-scan-report.${ext}`);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Runs the appropriate reporter(s) based on the chosen format.
|
|
29
|
+
* Always prints a console summary; file reporters write to outputPath.
|
|
30
|
+
*
|
|
31
|
+
* @returns The output file path (empty string for console-only).
|
|
32
|
+
*/
|
|
33
|
+
function runReporter(format, summary, outputPath) {
|
|
34
|
+
// Always print the console report
|
|
35
|
+
(0, console_1.printConsoleReport)(summary);
|
|
36
|
+
if (format === 'console')
|
|
37
|
+
return '';
|
|
38
|
+
const filePath = outputPath || defaultOutputPath(format, summary.targetDir);
|
|
39
|
+
switch (format) {
|
|
40
|
+
case 'json':
|
|
41
|
+
(0, json_1.writeJsonReport)(summary, filePath);
|
|
42
|
+
break;
|
|
43
|
+
case 'csv':
|
|
44
|
+
(0, csv_1.writeCsvReport)(summary, filePath);
|
|
45
|
+
break;
|
|
46
|
+
case 'markdown':
|
|
47
|
+
(0, markdown_1.writeMarkdownReport)(summary, filePath);
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
return filePath;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reporter/index.ts"],"names":[],"mappings":";;;;;;;AAAA,gDAAwB;AAExB,uCAA+C;AAC/C,iCAAyC;AACzC,+BAAuC;AACvC,yCAAiD;AAEjD,MAAM,OAAO,GAAqD;IAChE,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,IAAI;CACf,CAAC;AAEF;;GAEG;AACH,2BAAkC,MAAoB,EAAE,SAAiB;IACvE,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACpC,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5B,OAAO,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,sBAAsB,GAAG,EAAE,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;GAKG;AACH,qBACE,MAAoB,EACpB,OAAoB,EACpB,UAAmB;IAEnB,kCAAkC;IAClC,IAAA,4BAAkB,EAAC,OAAO,CAAC,CAAC;IAE5B,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IAEpC,MAAM,QAAQ,GAAG,UAAU,IAAI,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAE5E,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,MAAM;YACT,IAAA,sBAAe,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YACnC,MAAM;QACR,KAAK,KAAK;YACR,IAAA,oBAAc,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YAClC,MAAM;QACR,KAAK,UAAU;YACb,IAAA,8BAAmB,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YACvC,MAAM;IACV,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ScanSummary } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Writes a JSON report of the scan summary to disk.
|
|
4
|
+
* The raw secret values are masked in the report.
|
|
5
|
+
*/
|
|
6
|
+
export declare function writeJsonReport(summary: ScanSummary, outputPath: string): void;
|
|
7
|
+
//# sourceMappingURL=json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/reporter/json.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAqB9E"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.writeJsonReport = writeJsonReport;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
/**
|
|
10
|
+
* Writes a JSON report of the scan summary to disk.
|
|
11
|
+
* The raw secret values are masked in the report.
|
|
12
|
+
*/
|
|
13
|
+
function writeJsonReport(summary, outputPath) {
|
|
14
|
+
const sanitized = {
|
|
15
|
+
...summary,
|
|
16
|
+
findings: summary.findings.map(f => ({
|
|
17
|
+
file: f.file,
|
|
18
|
+
line: f.line,
|
|
19
|
+
column: f.column,
|
|
20
|
+
envKey: f.envKey,
|
|
21
|
+
ruleId: f.rule.id,
|
|
22
|
+
description: f.rule.description,
|
|
23
|
+
severity: f.rule.severity,
|
|
24
|
+
// Mask the value in the report
|
|
25
|
+
maskedValue: maskValue(f.rawValue),
|
|
26
|
+
lineContent: f.lineContent.trim(),
|
|
27
|
+
})),
|
|
28
|
+
};
|
|
29
|
+
const dir = path_1.default.dirname(outputPath);
|
|
30
|
+
if (!fs_1.default.existsSync(dir))
|
|
31
|
+
fs_1.default.mkdirSync(dir, { recursive: true });
|
|
32
|
+
fs_1.default.writeFileSync(outputPath, JSON.stringify(sanitized, null, 2), 'utf-8');
|
|
33
|
+
}
|
|
34
|
+
function maskValue(value) {
|
|
35
|
+
if (value.length <= 8)
|
|
36
|
+
return '*'.repeat(value.length);
|
|
37
|
+
return value.slice(0, 4) + '*'.repeat(Math.min(value.length - 8, 20)) + value.slice(-4);
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O,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACvD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/reporter/markdown.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAqB,MAAM,UAAU,CAAC;AA+B1D;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CA0ElF"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.writeMarkdownReport = writeMarkdownReport;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const SEVERITY_BADGE = {
|
|
10
|
+
critical: '',
|
|
11
|
+
high: '',
|
|
12
|
+
medium: '',
|
|
13
|
+
low: '',
|
|
14
|
+
};
|
|
15
|
+
const SEVERITY_EMOJI = {
|
|
16
|
+
critical: '🚨',
|
|
17
|
+
high: '🔴',
|
|
18
|
+
medium: '🟡',
|
|
19
|
+
low: '🔵',
|
|
20
|
+
};
|
|
21
|
+
function maskValue(value) {
|
|
22
|
+
if (value.length <= 8)
|
|
23
|
+
return '`' + '*'.repeat(value.length) + '`';
|
|
24
|
+
const masked = value.slice(0, 4) + '*'.repeat(Math.min(value.length - 8, 20)) + value.slice(-4);
|
|
25
|
+
return '`' + masked + '`';
|
|
26
|
+
}
|
|
27
|
+
function groupByFile(findings) {
|
|
28
|
+
const map = new Map();
|
|
29
|
+
for (const f of findings) {
|
|
30
|
+
if (!map.has(f.file))
|
|
31
|
+
map.set(f.file, []);
|
|
32
|
+
map.get(f.file).push(f);
|
|
33
|
+
}
|
|
34
|
+
return map;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Writes a Markdown report suitable for GitHub/GitLab issue or PR comments.
|
|
38
|
+
*/
|
|
39
|
+
function writeMarkdownReport(summary, outputPath) {
|
|
40
|
+
const { findings, filesScanned, filesWithSecrets, totalFindings, dryRun, envFile, scannedAt, targetDir } = summary;
|
|
41
|
+
const lines = [];
|
|
42
|
+
lines.push('# 🔐 Code Secret Handler — Scan Report\n');
|
|
43
|
+
lines.push(`> Generated: \`${scannedAt}\`\n`);
|
|
44
|
+
lines.push(`- **Target directory:** \`${targetDir}\` `);
|
|
45
|
+
lines.push(`- **Files scanned:** ${filesScanned} `);
|
|
46
|
+
lines.push(`- **Files with secrets:** ${filesWithSecrets} `);
|
|
47
|
+
lines.push(`- **Total secrets found:** **${totalFindings}** `);
|
|
48
|
+
lines.push(`- **Env file:** \`${envFile}\` `);
|
|
49
|
+
if (dryRun)
|
|
50
|
+
lines.push(`- ⚠️ **DRY RUN** — no files were modified`);
|
|
51
|
+
lines.push('');
|
|
52
|
+
if (totalFindings === 0) {
|
|
53
|
+
lines.push('## ✅ No hardcoded secrets detected!\n');
|
|
54
|
+
lines.push('Great job keeping your codebase clean.\n');
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
// Severity summary table
|
|
58
|
+
const bySeverity = { critical: 0, high: 0, medium: 0, low: 0 };
|
|
59
|
+
for (const f of findings)
|
|
60
|
+
bySeverity[f.rule.severity]++;
|
|
61
|
+
lines.push('## Summary\n');
|
|
62
|
+
lines.push('| Severity | Count |');
|
|
63
|
+
lines.push('|----------|-------|');
|
|
64
|
+
for (const [sev, count] of Object.entries(bySeverity)) {
|
|
65
|
+
if (count === 0)
|
|
66
|
+
continue;
|
|
67
|
+
lines.push(`| ${SEVERITY_EMOJI[sev]} ${sev.toUpperCase()} | ${count} |`);
|
|
68
|
+
}
|
|
69
|
+
lines.push('');
|
|
70
|
+
// Findings by file
|
|
71
|
+
lines.push('## Findings\n');
|
|
72
|
+
const byFile = groupByFile(findings);
|
|
73
|
+
for (const [filePath, fileFindings] of byFile) {
|
|
74
|
+
const relPath = path_1.default.relative(targetDir, filePath);
|
|
75
|
+
lines.push(`### 📄 \`${relPath}\`\n`);
|
|
76
|
+
lines.push('| Line | Col | Severity | Rule | Description | Env Key | Masked Value |');
|
|
77
|
+
lines.push('|------|-----|----------|------|-------------|---------|--------------|');
|
|
78
|
+
for (const f of fileFindings) {
|
|
79
|
+
lines.push(`| ${f.line} | ${f.column} | ${SEVERITY_EMOJI[f.rule.severity]} ${f.rule.severity.toUpperCase()} | \`${f.rule.id}\` | ${f.rule.description} | \`${f.envKey}\` | ${maskValue(f.rawValue)} |`);
|
|
80
|
+
}
|
|
81
|
+
lines.push('');
|
|
82
|
+
// Code snippet for each finding
|
|
83
|
+
for (const f of fileFindings) {
|
|
84
|
+
lines.push('<details>');
|
|
85
|
+
lines.push(`<summary>Line ${f.line} — <code>${f.rule.id}</code></summary>\n`);
|
|
86
|
+
lines.push('```');
|
|
87
|
+
lines.push(f.lineContent);
|
|
88
|
+
lines.push('```\n');
|
|
89
|
+
lines.push('</details>\n');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// Recommendations
|
|
93
|
+
lines.push('## 🛡️ Recommendations\n');
|
|
94
|
+
lines.push('1. Verify the changes made to your source files.');
|
|
95
|
+
lines.push('2. Ensure `.env` is listed in `.gitignore`.');
|
|
96
|
+
lines.push('3. Rotate any secrets that may have been exposed in git history.');
|
|
97
|
+
lines.push('4. Consider using a secrets manager (AWS Secrets Manager, HashiCorp Vault, etc.).');
|
|
98
|
+
lines.push('5. Set up a pre-commit hook to prevent future secret leaks.');
|
|
99
|
+
lines.push('');
|
|
100
|
+
}
|
|
101
|
+
const dir = path_1.default.dirname(outputPath);
|
|
102
|
+
if (!fs_1.default.existsSync(dir))
|
|
103
|
+
fs_1.default.mkdirSync(dir, { recursive: true });
|
|
104
|
+
fs_1.default.writeFileSync(outputPath, lines.join('\n'), 'utf-8');
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=markdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../src/reporter/markdown.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAGxB,MAAM,cAAc,GAA6B;IAC/C,QAAQ,EAAE,iEAAiE;IAC3E,IAAI,EAAE,4DAA4D;IAClE,MAAM,EAAE,gEAAgE;IACxE,GAAG,EAAE,wDAAwD;CAC9D,CAAC;AAEF,MAAM,cAAc,GAA6B;IAC/C,QAAQ,EAAE,IAAI;IACd,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,IAAI;IACZ,GAAG,EAAE,IAAI;CACV,CAAC;AAEF,SAAS,SAAS,CAAC,KAAa;IAC9B,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC;IACnE,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAChG,OAAO,GAAG,GAAG,MAAM,GAAG,GAAG,CAAC;AAC5B,CAAC;AAED,SAAS,WAAW,CAAC,QAAmB;IACtC,MAAM,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D,CAAC,CAAC;QAC1E,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,MAAM,GAAG,GAAG,cAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,YAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAEhE,YAAE,CAAC,aAAa,CAAC,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Finding, RewriteResult } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Groups findings by file, applies the correct language rewriter to each file,
|
|
4
|
+
* and writes the updated content back to disk.
|
|
5
|
+
*
|
|
6
|
+
* @returns Array of RewriteResult, one per modified file.
|
|
7
|
+
*/
|
|
8
|
+
export declare function rewriteFiles(findings: Finding[], dryRun?: boolean): RewriteResult[];
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rewriter/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAA4B,aAAa,EAAE,MAAM,UAAU,CAAC;AAmC5E;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,MAAM,UAAQ,GAAG,aAAa,EAAE,CAyDjF"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.rewriteFiles = rewriteFiles;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const langDetector_1 = require("./langDetector");
|
|
9
|
+
const javascript_1 = require("./templates/javascript");
|
|
10
|
+
const python_1 = require("./templates/python");
|
|
11
|
+
const java_1 = require("./templates/java");
|
|
12
|
+
const go_1 = require("./templates/go");
|
|
13
|
+
const ruby_1 = require("./templates/ruby");
|
|
14
|
+
const php_1 = require("./templates/php");
|
|
15
|
+
const csharp_1 = require("./templates/csharp");
|
|
16
|
+
const rust_1 = require("./templates/rust");
|
|
17
|
+
const shell_1 = require("./templates/shell");
|
|
18
|
+
const yaml_1 = require("./templates/yaml");
|
|
19
|
+
const properties_1 = require("./templates/properties");
|
|
20
|
+
const toml_1 = require("./templates/toml");
|
|
21
|
+
const generic_1 = require("./templates/generic");
|
|
22
|
+
const REWRITERS = {
|
|
23
|
+
javascript: javascript_1.rewriteJavaScript,
|
|
24
|
+
typescript: javascript_1.rewriteJavaScript, // TS uses same accessor as JS
|
|
25
|
+
python: python_1.rewritePython,
|
|
26
|
+
java: java_1.rewriteJava,
|
|
27
|
+
go: go_1.rewriteGo,
|
|
28
|
+
ruby: ruby_1.rewriteRuby,
|
|
29
|
+
php: php_1.rewritePhp,
|
|
30
|
+
csharp: csharp_1.rewriteCSharp,
|
|
31
|
+
rust: rust_1.rewriteRust,
|
|
32
|
+
shell: shell_1.rewriteShell,
|
|
33
|
+
yaml: yaml_1.rewriteYaml,
|
|
34
|
+
toml: toml_1.rewriteToml,
|
|
35
|
+
properties: properties_1.rewriteProperties,
|
|
36
|
+
generic: generic_1.rewriteGeneric,
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Groups findings by file, applies the correct language rewriter to each file,
|
|
40
|
+
* and writes the updated content back to disk.
|
|
41
|
+
*
|
|
42
|
+
* @returns Array of RewriteResult, one per modified file.
|
|
43
|
+
*/
|
|
44
|
+
function rewriteFiles(findings, dryRun = false) {
|
|
45
|
+
// Group findings by file
|
|
46
|
+
const byFile = new Map();
|
|
47
|
+
for (const finding of findings) {
|
|
48
|
+
if (!byFile.has(finding.file))
|
|
49
|
+
byFile.set(finding.file, []);
|
|
50
|
+
byFile.get(finding.file).push(finding);
|
|
51
|
+
}
|
|
52
|
+
const results = [];
|
|
53
|
+
for (const [filePath, fileFindings] of byFile) {
|
|
54
|
+
let fileContent;
|
|
55
|
+
try {
|
|
56
|
+
fileContent = fs_1.default.readFileSync(filePath, 'utf-8');
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const language = (0, langDetector_1.detectLanguage)(filePath);
|
|
62
|
+
const rewriterFn = REWRITERS[language];
|
|
63
|
+
// Apply each finding's rewrite sequentially on the evolving content
|
|
64
|
+
let currentContent = fileContent;
|
|
65
|
+
let totalReplacements = 0;
|
|
66
|
+
let dotenvInjected = false;
|
|
67
|
+
for (const finding of fileFindings) {
|
|
68
|
+
const ctx = {
|
|
69
|
+
finding,
|
|
70
|
+
language,
|
|
71
|
+
fileContent: currentContent,
|
|
72
|
+
};
|
|
73
|
+
const result = rewriterFn(ctx);
|
|
74
|
+
if (result.replacements > 0) {
|
|
75
|
+
currentContent = result.rewrittenContent;
|
|
76
|
+
totalReplacements += result.replacements;
|
|
77
|
+
if (result.dotenvInjected)
|
|
78
|
+
dotenvInjected = true;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const finalResult = {
|
|
82
|
+
filePath,
|
|
83
|
+
originalContent: fileContent,
|
|
84
|
+
rewrittenContent: currentContent,
|
|
85
|
+
replacements: totalReplacements,
|
|
86
|
+
dotenvInjected,
|
|
87
|
+
};
|
|
88
|
+
results.push(finalResult);
|
|
89
|
+
if (!dryRun && totalReplacements > 0) {
|
|
90
|
+
fs_1.default.writeFileSync(filePath, currentContent, 'utf-8');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return results;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"langDetector.d.ts","sourceRoot":"","sources":["../../src/rewriter/langDetector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AA6EpC;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAWzD"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.detectLanguage = detectLanguage;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
/**
|
|
9
|
+
* Maps file extensions to language identifiers.
|
|
10
|
+
*/
|
|
11
|
+
const EXT_MAP = {
|
|
12
|
+
// JavaScript / TypeScript
|
|
13
|
+
'.js': 'javascript',
|
|
14
|
+
'.jsx': 'javascript',
|
|
15
|
+
'.mjs': 'javascript',
|
|
16
|
+
'.cjs': 'javascript',
|
|
17
|
+
'.ts': 'typescript',
|
|
18
|
+
'.tsx': 'typescript',
|
|
19
|
+
'.vue': 'javascript', // Vue SFCs use JS/TS — use JS accessor
|
|
20
|
+
'.svelte': 'javascript', // Svelte uses JS
|
|
21
|
+
// Python
|
|
22
|
+
'.py': 'python',
|
|
23
|
+
'.pyw': 'python',
|
|
24
|
+
// Java / Kotlin / Scala
|
|
25
|
+
'.java': 'java',
|
|
26
|
+
'.kt': 'java',
|
|
27
|
+
'.kts': 'java',
|
|
28
|
+
'.scala': 'java',
|
|
29
|
+
'.groovy': 'java',
|
|
30
|
+
// Go
|
|
31
|
+
'.go': 'go',
|
|
32
|
+
// Ruby
|
|
33
|
+
'.rb': 'ruby',
|
|
34
|
+
'.rake': 'ruby',
|
|
35
|
+
'.gemspec': 'ruby',
|
|
36
|
+
// PHP
|
|
37
|
+
'.php': 'php',
|
|
38
|
+
'.php3': 'php',
|
|
39
|
+
'.php4': 'php',
|
|
40
|
+
'.php5': 'php',
|
|
41
|
+
'.phtml': 'php',
|
|
42
|
+
// C# / .NET
|
|
43
|
+
'.cs': 'csharp',
|
|
44
|
+
'.vb': 'csharp',
|
|
45
|
+
'.fs': 'csharp',
|
|
46
|
+
'.fsx': 'csharp',
|
|
47
|
+
// Rust
|
|
48
|
+
'.rs': 'rust',
|
|
49
|
+
// Shell
|
|
50
|
+
'.sh': 'shell',
|
|
51
|
+
'.bash': 'shell',
|
|
52
|
+
'.zsh': 'shell',
|
|
53
|
+
'.fish': 'shell',
|
|
54
|
+
'.ps1': 'shell',
|
|
55
|
+
'.psm1': 'shell',
|
|
56
|
+
'.bat': 'shell',
|
|
57
|
+
'.cmd': 'shell',
|
|
58
|
+
// Config formats (YAML, TOML, properties)
|
|
59
|
+
'.yaml': 'yaml',
|
|
60
|
+
'.yml': 'yaml',
|
|
61
|
+
'.toml': 'toml',
|
|
62
|
+
'.ini': 'properties',
|
|
63
|
+
'.properties': 'properties',
|
|
64
|
+
'.conf': 'properties',
|
|
65
|
+
'.env': 'properties',
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Exact filename mappings (no extension or special names).
|
|
69
|
+
*/
|
|
70
|
+
const FILENAME_MAP = {
|
|
71
|
+
Dockerfile: 'shell',
|
|
72
|
+
Makefile: 'shell',
|
|
73
|
+
'.env': 'properties',
|
|
74
|
+
'.envrc': 'shell',
|
|
75
|
+
'.bashrc': 'shell',
|
|
76
|
+
'.zshrc': 'shell',
|
|
77
|
+
'.profile': 'shell',
|
|
78
|
+
Gemfile: 'ruby',
|
|
79
|
+
Rakefile: 'ruby',
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Detects the programming language of a file by its path.
|
|
83
|
+
* Falls back to 'generic' if unknown.
|
|
84
|
+
*/
|
|
85
|
+
function detectLanguage(filePath) {
|
|
86
|
+
const basename = path_1.default.basename(filePath);
|
|
87
|
+
const ext = path_1.default.extname(filePath).toLowerCase();
|
|
88
|
+
// Check exact filename first
|
|
89
|
+
if (FILENAME_MAP[basename])
|
|
90
|
+
return FILENAME_MAP[basename];
|
|
91
|
+
// Check extension
|
|
92
|
+
if (ext && EXT_MAP[ext])
|
|
93
|
+
return EXT_MAP[ext];
|
|
94
|
+
return 'generic';
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=langDetector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"langDetector.js","sourceRoot":"","sources":["../../src/rewriter/langDetector.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAGxB;;GAEG;AACH,MAAM,OAAO,GAA6B;IACxC,0BAA0B;IAC1B,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY,EAAM,uCAAuC;IACjE,SAAS,EAAE,YAAY,EAAG,iBAAiB;IAC3C,SAAS;IACT,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,QAAQ;IAChB,wBAAwB;IACxB,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,MAAM;IACjB,KAAK;IACL,KAAK,EAAE,IAAI;IACX,OAAO;IACP,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,MAAM;IAClB,MAAM;IACN,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,KAAK;IACf,YAAY;IACZ,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,QAAQ;IACf,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|
|
3
|
+
* Rewrites C# / .NET files:
|
|
4
|
+
* - Replaces literal secret with `Environment.GetEnvironmentVariable("KEY")`
|
|
5
|
+
* - Adds `using System;` if not present
|
|
6
|
+
*/
|
|
7
|
+
export declare function rewriteCSharp(ctx: RewriteContext): RewriteResult;
|
|
8
|
+
//# sourceMappingURL=csharp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csharp.d.ts","sourceRoot":"","sources":["../../../src/rewriter/templates/csharp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,aAAa,CA8BhE"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rewriteCSharp = rewriteCSharp;
|
|
4
|
+
/**
|
|
5
|
+
* Rewrites C# / .NET files:
|
|
6
|
+
* - Replaces literal secret with `Environment.GetEnvironmentVariable("KEY")`
|
|
7
|
+
* - Adds `using System;` if not present
|
|
8
|
+
*/
|
|
9
|
+
function rewriteCSharp(ctx) {
|
|
10
|
+
const { finding, fileContent } = ctx;
|
|
11
|
+
const { rawValue, envKey } = finding;
|
|
12
|
+
let rewrittenContent = fileContent;
|
|
13
|
+
let replacements = 0;
|
|
14
|
+
let dotenvInjected = false;
|
|
15
|
+
const escaped = rawValue.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
16
|
+
const re = new RegExp(`"${escaped}"`, 'g');
|
|
17
|
+
if (re.test(rewrittenContent)) {
|
|
18
|
+
rewrittenContent = rewrittenContent.replace(re, `Environment.GetEnvironmentVariable("${envKey}")`);
|
|
19
|
+
replacements++;
|
|
20
|
+
}
|
|
21
|
+
if (replacements === 0)
|
|
22
|
+
return { filePath: finding.file, originalContent: fileContent, rewrittenContent: fileContent, replacements: 0, dotenvInjected: false };
|
|
23
|
+
const hasSystemUsing = /^using System;/m.test(rewrittenContent);
|
|
24
|
+
if (!hasSystemUsing) {
|
|
25
|
+
rewrittenContent = `using System;\n` + rewrittenContent;
|
|
26
|
+
dotenvInjected = true;
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
filePath: finding.file,
|
|
30
|
+
originalContent: fileContent,
|
|
31
|
+
rewrittenContent,
|
|
32
|
+
replacements,
|
|
33
|
+
dotenvInjected,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=csharp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csharp.js","sourceRoot":"","sources":["../../../src/rewriter/templates/csharp.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACH,uBAA8B,GAAmB;IAC/C,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC;IACrC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAErC,IAAI,gBAAgB,GAAG,WAAW,CAAC;IACnC,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,cAAc,GAAG,KAAK,CAAC;IAE3B,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IAChE,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,IAAI,OAAO,GAAG,EAAE,GAAG,CAAC,CAAC;IAC3C,IAAI,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC9B,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CAAC,EAAE,EAAE,uCAAuC,MAAM,IAAI,CAAC,CAAC;QACnG,YAAY,EAAE,CAAC;IACjB,CAAC;IAED,IAAI,YAAY,KAAK,CAAC;QAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,gBAAgB,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;IAE/J,MAAM,cAAc,GAAG,iBAAiB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAChE,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,gBAAgB,GAAG,iBAAiB,GAAG,gBAAgB,CAAC;QACxD,cAAc,GAAG,IAAI,CAAC;IACxB,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,IAAI;QACtB,eAAe,EAAE,WAAW;QAC5B,gBAAgB;QAChB,YAAY;QACZ,cAAc;KACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RewriteContext, RewriteResult } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Generic fallback rewriter:
|
|
4
|
+
* - Replaces the literal secret with `${KEY}` wherever it appears as a quoted string.
|
|
5
|
+
*/
|
|
6
|
+
export declare function rewriteGeneric(ctx: RewriteContext): RewriteResult;
|
|
7
|
+
//# sourceMappingURL=generic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic.d.ts","sourceRoot":"","sources":["../../../src/rewriter/templates/generic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5D;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,cAAc,GAAG,aAAa,CAmCjE"}
|