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,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rewriteGeneric = rewriteGeneric;
|
|
4
|
+
/**
|
|
5
|
+
* Generic fallback rewriter:
|
|
6
|
+
* - Replaces the literal secret with `${KEY}` wherever it appears as a quoted string.
|
|
7
|
+
*/
|
|
8
|
+
function rewriteGeneric(ctx) {
|
|
9
|
+
const { finding, fileContent } = ctx;
|
|
10
|
+
const { rawValue, envKey } = finding;
|
|
11
|
+
let rewrittenContent = fileContent;
|
|
12
|
+
let replacements = 0;
|
|
13
|
+
const quoteStyles = ["'", '"', '`'];
|
|
14
|
+
for (const q of quoteStyles) {
|
|
15
|
+
const escaped = rawValue.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
16
|
+
const re = new RegExp(`${q}${escaped}${q}`, 'g');
|
|
17
|
+
if (re.test(rewrittenContent)) {
|
|
18
|
+
rewrittenContent = rewrittenContent.replace(re, `"\${${envKey}}"`);
|
|
19
|
+
replacements++;
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
// Fallback: unquoted occurrence
|
|
24
|
+
if (replacements === 0) {
|
|
25
|
+
const escaped = rawValue.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
26
|
+
const re = new RegExp(escaped, 'g');
|
|
27
|
+
if (re.test(rewrittenContent)) {
|
|
28
|
+
rewrittenContent = rewrittenContent.replace(re, `\${${envKey}}`);
|
|
29
|
+
replacements++;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
filePath: finding.file,
|
|
34
|
+
originalContent: fileContent,
|
|
35
|
+
rewrittenContent,
|
|
36
|
+
replacements,
|
|
37
|
+
dotenvInjected: false,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=generic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic.js","sourceRoot":"","sources":["../../../src/rewriter/templates/generic.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,wBAA+B,GAAmB;IAChD,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;IAErB,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACpC,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;QAChE,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QACjD,IAAI,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC9B,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,MAAM,IAAI,CAAC,CAAC;YACnE,YAAY,EAAE,CAAC;YACf,MAAM;QACR,CAAC;IACH,CAAC;IAED,gCAAgC;IAChC,IAAI,YAAY,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;QAChE,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QACpC,IAAI,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC9B,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,MAAM,GAAG,CAAC,CAAC;YACjE,YAAY,EAAE,CAAC;QACjB,CAAC;IACH,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,IAAI;QACtB,eAAe,EAAE,WAAW;QAC5B,gBAAgB;QAChB,YAAY;QACZ,cAAc,EAAE,KAAK;KACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RewriteContext, RewriteResult } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Rewrites Go files:
|
|
4
|
+
* - Replaces literal secret with `os.Getenv("KEY")`
|
|
5
|
+
* - Injects `"os"` import if not already present
|
|
6
|
+
*/
|
|
7
|
+
export declare function rewriteGo(ctx: RewriteContext): RewriteResult;
|
|
8
|
+
//# sourceMappingURL=go.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"go.d.ts","sourceRoot":"","sources":["../../../src/rewriter/templates/go.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,cAAc,GAAG,aAAa,CAuD5D"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rewriteGo = rewriteGo;
|
|
4
|
+
/**
|
|
5
|
+
* Rewrites Go files:
|
|
6
|
+
* - Replaces literal secret with `os.Getenv("KEY")`
|
|
7
|
+
* - Injects `"os"` import if not already present
|
|
8
|
+
*/
|
|
9
|
+
function rewriteGo(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, `os.Getenv("${envKey}")`);
|
|
19
|
+
replacements++;
|
|
20
|
+
}
|
|
21
|
+
if (replacements === 0) {
|
|
22
|
+
// Try backtick strings (raw string literals in Go)
|
|
23
|
+
const reBacktick = new RegExp('`' + escaped + '`', 'g');
|
|
24
|
+
if (reBacktick.test(rewrittenContent)) {
|
|
25
|
+
rewrittenContent = rewrittenContent.replace(reBacktick, `os.Getenv("${envKey}")`);
|
|
26
|
+
replacements++;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (replacements === 0)
|
|
30
|
+
return { filePath: finding.file, originalContent: fileContent, rewrittenContent: fileContent, replacements: 0, dotenvInjected: false };
|
|
31
|
+
// Inject "os" import if not present
|
|
32
|
+
const hasOsImport = /import\s+(?:"os"|[\s\S]*?"os"[\s\S]*?\))/.test(rewrittenContent);
|
|
33
|
+
if (!hasOsImport) {
|
|
34
|
+
// Add to existing import block if present
|
|
35
|
+
if (/^import\s*\(/.test(rewrittenContent)) {
|
|
36
|
+
rewrittenContent = rewrittenContent.replace(/^(import\s*\()/, '$1\n\t"os"');
|
|
37
|
+
}
|
|
38
|
+
else if (/^import\s+"/.test(rewrittenContent)) {
|
|
39
|
+
// Single import — convert to block
|
|
40
|
+
rewrittenContent = rewrittenContent.replace(/^(import\s+"[^"]+")$/m, '$1\nimport "os"');
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
// No import block yet — find package statement and insert after
|
|
44
|
+
rewrittenContent = rewrittenContent.replace(/^(package\s+\w+\s*\n)/m, '$1\nimport "os"\n');
|
|
45
|
+
}
|
|
46
|
+
dotenvInjected = true; // "os" counts as env-access injection
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
filePath: finding.file,
|
|
50
|
+
originalContent: fileContent,
|
|
51
|
+
rewrittenContent,
|
|
52
|
+
replacements,
|
|
53
|
+
dotenvInjected,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=go.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"go.js","sourceRoot":"","sources":["../../../src/rewriter/templates/go.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACH,mBAA0B,GAAmB;IAC3C,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,cAAc,MAAM,IAAI,CAAC,CAAC;QAC1E,YAAY,EAAE,CAAC;IACjB,CAAC;IAED,IAAI,YAAY,KAAK,CAAC,EAAE,CAAC;QACvB,mDAAmD;QACnD,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,GAAG,GAAG,OAAO,GAAG,GAAG,EAAE,GAAG,CAAC,CAAC;QACxD,IAAI,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACtC,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,MAAM,IAAI,CAAC,CAAC;YAClF,YAAY,EAAE,CAAC;QACjB,CAAC;IACH,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,oCAAoC;IACpC,MAAM,WAAW,GAAG,0CAA0C,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACtF,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,0CAA0C;QAC1C,IAAI,cAAc,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC1C,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;QAC9E,CAAC;aAAM,IAAI,aAAa,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAChD,mCAAmC;YACnC,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CACzC,uBAAuB,EACvB,iBAAiB,CAClB,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,gEAAgE;YAChE,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CACzC,wBAAwB,EACxB,mBAAmB,CACpB,CAAC;QACJ,CAAC;QACD,cAAc,GAAG,IAAI,CAAC,CAAC,sCAAsC;IAC/D,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
|
+
* Rewrites Java/Kotlin/Scala files:
|
|
4
|
+
* - Replaces literal secret with `System.getenv("KEY")`
|
|
5
|
+
*/
|
|
6
|
+
export declare function rewriteJava(ctx: RewriteContext): RewriteResult;
|
|
7
|
+
//# sourceMappingURL=java.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"java.d.ts","sourceRoot":"","sources":["../../../src/rewriter/templates/java.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5D;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,aAAa,CAyB9D"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rewriteJava = rewriteJava;
|
|
4
|
+
/**
|
|
5
|
+
* Rewrites Java/Kotlin/Scala files:
|
|
6
|
+
* - Replaces literal secret with `System.getenv("KEY")`
|
|
7
|
+
*/
|
|
8
|
+
function rewriteJava(ctx) {
|
|
9
|
+
const { finding, fileContent } = ctx;
|
|
10
|
+
const { rawValue, envKey } = finding;
|
|
11
|
+
let rewrittenContent = fileContent;
|
|
12
|
+
let replacements = 0;
|
|
13
|
+
const quoteStyles = ['"', "'"];
|
|
14
|
+
for (const q of quoteStyles) {
|
|
15
|
+
const escaped = rawValue.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
16
|
+
const re = new RegExp(`${q}${escaped}${q}`, 'g');
|
|
17
|
+
if (re.test(rewrittenContent)) {
|
|
18
|
+
rewrittenContent = rewrittenContent.replace(re, `System.getenv("${envKey}")`);
|
|
19
|
+
replacements++;
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
filePath: finding.file,
|
|
25
|
+
originalContent: fileContent,
|
|
26
|
+
rewrittenContent,
|
|
27
|
+
replacements,
|
|
28
|
+
dotenvInjected: false,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=java.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"java.js","sourceRoot":"","sources":["../../../src/rewriter/templates/java.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,qBAA4B,GAAmB;IAC7C,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;IAErB,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC/B,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;QAChE,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QACjD,IAAI,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC9B,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CAAC,EAAE,EAAE,kBAAkB,MAAM,IAAI,CAAC,CAAC;YAC9E,YAAY,EAAE,CAAC;YACf,MAAM;QACR,CAAC;IACH,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,IAAI;QACtB,eAAe,EAAE,WAAW;QAC5B,gBAAgB;QAChB,YAAY;QACZ,cAAc,EAAE,KAAK;KACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RewriteContext, RewriteResult } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Rewrites JavaScript/TypeScript files:
|
|
4
|
+
* - Replaces the literal secret value with `process.env.KEY`
|
|
5
|
+
* - Injects `require('dotenv').config()` if not already present and the file
|
|
6
|
+
* is a CommonJS module (no import/export keywords), OR
|
|
7
|
+
* leaves an ESM hint comment if the file uses import/export.
|
|
8
|
+
*/
|
|
9
|
+
export declare function rewriteJavaScript(ctx: RewriteContext): RewriteResult;
|
|
10
|
+
//# sourceMappingURL=javascript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"javascript.d.ts","sourceRoot":"","sources":["../../../src/rewriter/templates/javascript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,aAAa,CA8CpE"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rewriteJavaScript = rewriteJavaScript;
|
|
4
|
+
/**
|
|
5
|
+
* Rewrites JavaScript/TypeScript files:
|
|
6
|
+
* - Replaces the literal secret value with `process.env.KEY`
|
|
7
|
+
* - Injects `require('dotenv').config()` if not already present and the file
|
|
8
|
+
* is a CommonJS module (no import/export keywords), OR
|
|
9
|
+
* leaves an ESM hint comment if the file uses import/export.
|
|
10
|
+
*/
|
|
11
|
+
function rewriteJavaScript(ctx) {
|
|
12
|
+
const { finding, fileContent } = ctx;
|
|
13
|
+
const { rawValue, envKey } = finding;
|
|
14
|
+
let rewrittenContent = fileContent;
|
|
15
|
+
let replacements = 0;
|
|
16
|
+
let dotenvInjected = false;
|
|
17
|
+
// Build the replacement string — replace the quoted secret with process.env.KEY
|
|
18
|
+
// We need to handle all quote styles: ', ", `
|
|
19
|
+
const quoteStyles = ["'", '"', '`'];
|
|
20
|
+
for (const q of quoteStyles) {
|
|
21
|
+
const escaped = rawValue.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
22
|
+
const re = new RegExp(`${q}${escaped}${q}`, 'g');
|
|
23
|
+
if (re.test(rewrittenContent)) {
|
|
24
|
+
rewrittenContent = rewrittenContent.replace(re, `process.env.${envKey}`);
|
|
25
|
+
replacements++;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (replacements === 0)
|
|
30
|
+
return { filePath: finding.file, originalContent: fileContent, rewrittenContent: fileContent, replacements: 0, dotenvInjected: false };
|
|
31
|
+
// Detect module style
|
|
32
|
+
const isESM = /^import\s+|^export\s+/m.test(fileContent);
|
|
33
|
+
const hasDotenvRequire = /require\s*\(\s*['"`]dotenv['"`]\s*\)/i.test(rewrittenContent);
|
|
34
|
+
const hasDotenvImport = /import\s+.*['"`]dotenv['"`]/i.test(rewrittenContent);
|
|
35
|
+
if (!hasDotenvRequire && !hasDotenvImport) {
|
|
36
|
+
if (isESM) {
|
|
37
|
+
// For ESM, add a comment hint at the top (dotenv/config import)
|
|
38
|
+
rewrittenContent = `// TODO: Add \`import 'dotenv/config';\` at the top of your entry point.\n` + rewrittenContent;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
// CommonJS — inject require at top
|
|
42
|
+
rewrittenContent = `require('dotenv').config();\n` + rewrittenContent;
|
|
43
|
+
}
|
|
44
|
+
dotenvInjected = true;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
filePath: finding.file,
|
|
48
|
+
originalContent: fileContent,
|
|
49
|
+
rewrittenContent,
|
|
50
|
+
replacements,
|
|
51
|
+
dotenvInjected,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=javascript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"javascript.js","sourceRoot":"","sources":["../../../src/rewriter/templates/javascript.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACH,2BAAkC,GAAmB;IACnD,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,gFAAgF;IAChF,8CAA8C;IAC9C,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACpC,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;QAChE,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QACjD,IAAI,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC9B,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CAAC,EAAE,EAAE,eAAe,MAAM,EAAE,CAAC,CAAC;YACzE,YAAY,EAAE,CAAC;YACf,MAAM;QACR,CAAC;IACH,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,sBAAsB;IACtB,MAAM,KAAK,GAAG,wBAAwB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACzD,MAAM,gBAAgB,GAAG,uCAAuC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACxF,MAAM,eAAe,GAAG,8BAA8B,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAE9E,IAAI,CAAC,gBAAgB,IAAI,CAAC,eAAe,EAAE,CAAC;QAC1C,IAAI,KAAK,EAAE,CAAC;YACV,gEAAgE;YAChE,gBAAgB,GAAG,4EAA4E,GAAG,gBAAgB,CAAC;QACrH,CAAC;aAAM,CAAC;YACN,mCAAmC;YACnC,gBAAgB,GAAG,+BAA+B,GAAG,gBAAgB,CAAC;QACxE,CAAC;QACD,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,8 @@
|
|
|
1
|
+
import { RewriteContext, RewriteResult } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Rewrites PHP files:
|
|
4
|
+
* - Replaces literal secret with `getenv('KEY')`
|
|
5
|
+
* - Optionally adds a comment about vlucas/phpdotenv
|
|
6
|
+
*/
|
|
7
|
+
export declare function rewritePhp(ctx: RewriteContext): RewriteResult;
|
|
8
|
+
//# sourceMappingURL=php.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"php.d.ts","sourceRoot":"","sources":["../../../src/rewriter/templates/php.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,cAAc,GAAG,aAAa,CAsC7D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rewritePhp = rewritePhp;
|
|
4
|
+
/**
|
|
5
|
+
* Rewrites PHP files:
|
|
6
|
+
* - Replaces literal secret with `getenv('KEY')`
|
|
7
|
+
* - Optionally adds a comment about vlucas/phpdotenv
|
|
8
|
+
*/
|
|
9
|
+
function rewritePhp(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 quoteStyles = ["'", '"'];
|
|
16
|
+
for (const q of quoteStyles) {
|
|
17
|
+
const escaped = rawValue.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
18
|
+
const re = new RegExp(`${q}${escaped}${q}`, 'g');
|
|
19
|
+
if (re.test(rewrittenContent)) {
|
|
20
|
+
rewrittenContent = rewrittenContent.replace(re, `getenv('${envKey}')`);
|
|
21
|
+
replacements++;
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (replacements === 0)
|
|
26
|
+
return { filePath: finding.file, originalContent: fileContent, rewrittenContent: fileContent, replacements: 0, dotenvInjected: false };
|
|
27
|
+
const hasDotenv = /Dotenv\\Dotenv|vlucas\/phpdotenv|Dotenv::createImmutable/i.test(rewrittenContent);
|
|
28
|
+
if (!hasDotenv) {
|
|
29
|
+
// Insert after opening <?php tag
|
|
30
|
+
rewrittenContent = rewrittenContent.replace(/^<\?php\s*/, `<?php\n// TODO: Load .env via vlucas/phpdotenv: $dotenv = Dotenv\\Dotenv::createImmutable(__DIR__); $dotenv->load();\n`);
|
|
31
|
+
dotenvInjected = true;
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
filePath: finding.file,
|
|
35
|
+
originalContent: fileContent,
|
|
36
|
+
rewrittenContent,
|
|
37
|
+
replacements,
|
|
38
|
+
dotenvInjected,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=php.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"php.js","sourceRoot":"","sources":["../../../src/rewriter/templates/php.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACH,oBAA2B,GAAmB;IAC5C,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,WAAW,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC/B,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;QAChE,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QACjD,IAAI,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC9B,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CAAC,EAAE,EAAE,WAAW,MAAM,IAAI,CAAC,CAAC;YACvE,YAAY,EAAE,CAAC;YACf,MAAM;QACR,CAAC;IACH,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,SAAS,GAAG,2DAA2D,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACrG,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,iCAAiC;QACjC,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CACzC,YAAY,EACZ,wHAAwH,CACzH,CAAC;QACF,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,9 @@
|
|
|
1
|
+
import { RewriteContext, RewriteResult } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Rewrites .properties / .ini / .conf / .env files:
|
|
4
|
+
* - If the file IS the .env file, we skip rewriting (it is the target).
|
|
5
|
+
* - Otherwise replaces the literal value with `${KEY}` interpolation syntax
|
|
6
|
+
* (supported by Spring Boot, dotenv-expand, etc.).
|
|
7
|
+
*/
|
|
8
|
+
export declare function rewriteProperties(ctx: RewriteContext): RewriteResult;
|
|
9
|
+
//# sourceMappingURL=properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../../src/rewriter/templates/properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,aAAa,CAgCpE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rewriteProperties = rewriteProperties;
|
|
4
|
+
/**
|
|
5
|
+
* Rewrites .properties / .ini / .conf / .env files:
|
|
6
|
+
* - If the file IS the .env file, we skip rewriting (it is the target).
|
|
7
|
+
* - Otherwise replaces the literal value with `${KEY}` interpolation syntax
|
|
8
|
+
* (supported by Spring Boot, dotenv-expand, etc.).
|
|
9
|
+
*/
|
|
10
|
+
function rewriteProperties(ctx) {
|
|
11
|
+
const { finding, fileContent } = ctx;
|
|
12
|
+
const { rawValue, envKey, file } = finding;
|
|
13
|
+
// Skip if this is the .env file itself
|
|
14
|
+
if (file.endsWith('.env') || file.endsWith('.envrc')) {
|
|
15
|
+
return {
|
|
16
|
+
filePath: file,
|
|
17
|
+
originalContent: fileContent,
|
|
18
|
+
rewrittenContent: fileContent,
|
|
19
|
+
replacements: 0,
|
|
20
|
+
dotenvInjected: false,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
let rewrittenContent = fileContent;
|
|
24
|
+
let replacements = 0;
|
|
25
|
+
const escaped = rawValue.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
26
|
+
const re = new RegExp(escaped, 'g');
|
|
27
|
+
if (re.test(rewrittenContent)) {
|
|
28
|
+
rewrittenContent = rewrittenContent.replace(re, `\${${envKey}}`);
|
|
29
|
+
replacements++;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
filePath: file,
|
|
33
|
+
originalContent: fileContent,
|
|
34
|
+
rewrittenContent,
|
|
35
|
+
replacements,
|
|
36
|
+
dotenvInjected: false,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../src/rewriter/templates/properties.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACH,2BAAkC,GAAmB;IACnD,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC;IACrC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IAE3C,uCAAuC;IACvC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrD,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,eAAe,EAAE,WAAW;YAC5B,gBAAgB,EAAE,WAAW;YAC7B,YAAY,EAAE,CAAC;YACf,cAAc,EAAE,KAAK;SACtB,CAAC;IACJ,CAAC;IAED,IAAI,gBAAgB,GAAG,WAAW,CAAC;IACnC,IAAI,YAAY,GAAG,CAAC,CAAC;IAErB,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IAChE,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACpC,IAAI,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC9B,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,MAAM,GAAG,CAAC,CAAC;QACjE,YAAY,EAAE,CAAC;IACjB,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,IAAI;QACd,eAAe,EAAE,WAAW;QAC5B,gBAAgB;QAChB,YAAY;QACZ,cAAc,EAAE,KAAK;KACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RewriteContext, RewriteResult } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Rewrites Python files:
|
|
4
|
+
* - Replaces literal secret with `os.environ.get('KEY')`
|
|
5
|
+
* - Injects `import os` and optionally `from dotenv import load_dotenv; load_dotenv()`
|
|
6
|
+
*/
|
|
7
|
+
export declare function rewritePython(ctx: RewriteContext): RewriteResult;
|
|
8
|
+
//# sourceMappingURL=python.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../../src/rewriter/templates/python.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,aAAa,CA8ChE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rewritePython = rewritePython;
|
|
4
|
+
/**
|
|
5
|
+
* Rewrites Python files:
|
|
6
|
+
* - Replaces literal secret with `os.environ.get('KEY')`
|
|
7
|
+
* - Injects `import os` and optionally `from dotenv import load_dotenv; load_dotenv()`
|
|
8
|
+
*/
|
|
9
|
+
function rewritePython(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 quoteStyles = ["'", '"', '"""', "'''"];
|
|
16
|
+
for (const q of quoteStyles) {
|
|
17
|
+
const escaped = rawValue.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
18
|
+
const re = new RegExp(`${q}${escaped}${q}`, 'g');
|
|
19
|
+
if (re.test(rewrittenContent)) {
|
|
20
|
+
rewrittenContent = rewrittenContent.replace(re, `os.environ.get('${envKey}')`);
|
|
21
|
+
replacements++;
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (replacements === 0)
|
|
26
|
+
return { filePath: finding.file, originalContent: fileContent, rewrittenContent: fileContent, replacements: 0, dotenvInjected: false };
|
|
27
|
+
const hasOsImport = /^import os$/m.test(rewrittenContent) || /^import os\b/m.test(rewrittenContent);
|
|
28
|
+
const hasDotenvImport = /from dotenv import/i.test(rewrittenContent) || /import dotenv/i.test(rewrittenContent);
|
|
29
|
+
let preamble = '';
|
|
30
|
+
if (!hasOsImport) {
|
|
31
|
+
preamble += 'import os\n';
|
|
32
|
+
}
|
|
33
|
+
if (!hasDotenvImport) {
|
|
34
|
+
preamble += 'from dotenv import load_dotenv\nload_dotenv()\n';
|
|
35
|
+
dotenvInjected = true;
|
|
36
|
+
}
|
|
37
|
+
if (preamble) {
|
|
38
|
+
rewrittenContent = preamble + rewrittenContent;
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
filePath: finding.file,
|
|
42
|
+
originalContent: fileContent,
|
|
43
|
+
rewrittenContent,
|
|
44
|
+
replacements,
|
|
45
|
+
dotenvInjected,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=python.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python.js","sourceRoot":"","sources":["../../../src/rewriter/templates/python.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,WAAW,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC7C,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;QAChE,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QACjD,IAAI,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC9B,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CAAC,EAAE,EAAE,mBAAmB,MAAM,IAAI,CAAC,CAAC;YAC/E,YAAY,EAAE,CAAC;YACf,MAAM;QACR,CAAC;IACH,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,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACpG,MAAM,eAAe,GAAG,qBAAqB,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAEhH,IAAI,QAAQ,GAAG,EAAE,CAAC;IAElB,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,QAAQ,IAAI,aAAa,CAAC;IAC5B,CAAC;IAED,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,QAAQ,IAAI,iDAAiD,CAAC;QAC9D,cAAc,GAAG,IAAI,CAAC;IACxB,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACb,gBAAgB,GAAG,QAAQ,GAAG,gBAAgB,CAAC;IACjD,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,8 @@
|
|
|
1
|
+
import { RewriteContext, RewriteResult } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Rewrites Ruby files:
|
|
4
|
+
* - Replaces literal secret with `ENV['KEY']`
|
|
5
|
+
* - Injects `require 'dotenv/load'` if not present (when dotenv gem is used)
|
|
6
|
+
*/
|
|
7
|
+
export declare function rewriteRuby(ctx: RewriteContext): RewriteResult;
|
|
8
|
+
//# sourceMappingURL=ruby.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ruby.d.ts","sourceRoot":"","sources":["../../../src/rewriter/templates/ruby.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,aAAa,CAkC9D"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rewriteRuby = rewriteRuby;
|
|
4
|
+
/**
|
|
5
|
+
* Rewrites Ruby files:
|
|
6
|
+
* - Replaces literal secret with `ENV['KEY']`
|
|
7
|
+
* - Injects `require 'dotenv/load'` if not present (when dotenv gem is used)
|
|
8
|
+
*/
|
|
9
|
+
function rewriteRuby(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 quoteStyles = ["'", '"'];
|
|
16
|
+
for (const q of quoteStyles) {
|
|
17
|
+
const escaped = rawValue.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
18
|
+
const re = new RegExp(`${q}${escaped}${q}`, 'g');
|
|
19
|
+
if (re.test(rewrittenContent)) {
|
|
20
|
+
rewrittenContent = rewrittenContent.replace(re, `ENV['${envKey}']`);
|
|
21
|
+
replacements++;
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (replacements === 0)
|
|
26
|
+
return { filePath: finding.file, originalContent: fileContent, rewrittenContent: fileContent, replacements: 0, dotenvInjected: false };
|
|
27
|
+
const hasDotenv = /require\s+['"]dotenv/.test(rewrittenContent);
|
|
28
|
+
if (!hasDotenv) {
|
|
29
|
+
rewrittenContent = `require 'dotenv/load'\n` + rewrittenContent;
|
|
30
|
+
dotenvInjected = true;
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
filePath: finding.file,
|
|
34
|
+
originalContent: fileContent,
|
|
35
|
+
rewrittenContent,
|
|
36
|
+
replacements,
|
|
37
|
+
dotenvInjected,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=ruby.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ruby.js","sourceRoot":"","sources":["../../../src/rewriter/templates/ruby.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACH,qBAA4B,GAAmB;IAC7C,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,WAAW,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC/B,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;QAChE,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QACjD,IAAI,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC9B,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CAAC,EAAE,EAAE,QAAQ,MAAM,IAAI,CAAC,CAAC;YACpE,YAAY,EAAE,CAAC;YACf,MAAM;QACR,CAAC;IACH,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,SAAS,GAAG,sBAAsB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAChE,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,gBAAgB,GAAG,yBAAyB,GAAG,gBAAgB,CAAC;QAChE,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
|
+
* Rewrites Rust files:
|
|
4
|
+
* - Replaces literal secret with `std::env::var("KEY").expect("KEY not set")`
|
|
5
|
+
*/
|
|
6
|
+
export declare function rewriteRust(ctx: RewriteContext): RewriteResult;
|
|
7
|
+
//# sourceMappingURL=rust.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rust.d.ts","sourceRoot":"","sources":["../../../src/rewriter/templates/rust.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5D;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,aAAa,CAwB9D"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rewriteRust = rewriteRust;
|
|
4
|
+
/**
|
|
5
|
+
* Rewrites Rust files:
|
|
6
|
+
* - Replaces literal secret with `std::env::var("KEY").expect("KEY not set")`
|
|
7
|
+
*/
|
|
8
|
+
function rewriteRust(ctx) {
|
|
9
|
+
const { finding, fileContent } = ctx;
|
|
10
|
+
const { rawValue, envKey } = finding;
|
|
11
|
+
let rewrittenContent = fileContent;
|
|
12
|
+
let replacements = 0;
|
|
13
|
+
const escaped = rawValue.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
14
|
+
const re = new RegExp(`"${escaped}"`, 'g');
|
|
15
|
+
if (re.test(rewrittenContent)) {
|
|
16
|
+
rewrittenContent = rewrittenContent.replace(re, `std::env::var("${envKey}").expect("${envKey} not set")`);
|
|
17
|
+
replacements++;
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
filePath: finding.file,
|
|
21
|
+
originalContent: fileContent,
|
|
22
|
+
rewrittenContent,
|
|
23
|
+
replacements,
|
|
24
|
+
dotenvInjected: false,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=rust.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rust.js","sourceRoot":"","sources":["../../../src/rewriter/templates/rust.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,qBAA4B,GAAmB;IAC7C,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;IAErB,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,CACzC,EAAE,EACF,kBAAkB,MAAM,cAAc,MAAM,YAAY,CACzD,CAAC;QACF,YAAY,EAAE,CAAC;IACjB,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,IAAI;QACtB,eAAe,EAAE,WAAW;QAC5B,gBAAgB;QAChB,YAAY;QACZ,cAAc,EAAE,KAAK;KACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RewriteContext, RewriteResult } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Rewrites Shell / Bash / PowerShell files:
|
|
4
|
+
* - Replaces literal secret with `$KEY` (bash) or `$env:KEY` (PowerShell .ps1)
|
|
5
|
+
*/
|
|
6
|
+
export declare function rewriteShell(ctx: RewriteContext): RewriteResult;
|
|
7
|
+
//# sourceMappingURL=shell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../src/rewriter/templates/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5D;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,cAAc,GAAG,aAAa,CAsC/D"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rewriteShell = rewriteShell;
|
|
4
|
+
/**
|
|
5
|
+
* Rewrites Shell / Bash / PowerShell files:
|
|
6
|
+
* - Replaces literal secret with `$KEY` (bash) or `$env:KEY` (PowerShell .ps1)
|
|
7
|
+
*/
|
|
8
|
+
function rewriteShell(ctx) {
|
|
9
|
+
const { finding, fileContent } = ctx;
|
|
10
|
+
const { rawValue, envKey } = finding;
|
|
11
|
+
const isPowerShell = finding.file.endsWith('.ps1') || finding.file.endsWith('.psm1');
|
|
12
|
+
const replacement = isPowerShell ? `$env:${envKey}` : `$${envKey}`;
|
|
13
|
+
let rewrittenContent = fileContent;
|
|
14
|
+
let replacements = 0;
|
|
15
|
+
const quoteStyles = ["'", '"'];
|
|
16
|
+
for (const q of quoteStyles) {
|
|
17
|
+
const escaped = rawValue.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
18
|
+
const re = new RegExp(`${q}${escaped}${q}`, 'g');
|
|
19
|
+
if (re.test(rewrittenContent)) {
|
|
20
|
+
rewrittenContent = rewrittenContent.replace(re, replacement);
|
|
21
|
+
replacements++;
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
// Also try unquoted (direct assignment VALUE)
|
|
26
|
+
if (replacements === 0) {
|
|
27
|
+
const escapedRaw = rawValue.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
28
|
+
const reRaw = new RegExp(`(?<==)${escapedRaw}(?=\\s|$)`, 'gm');
|
|
29
|
+
if (reRaw.test(rewrittenContent)) {
|
|
30
|
+
rewrittenContent = rewrittenContent.replace(reRaw, replacement);
|
|
31
|
+
replacements++;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
filePath: finding.file,
|
|
36
|
+
originalContent: fileContent,
|
|
37
|
+
rewrittenContent,
|
|
38
|
+
replacements,
|
|
39
|
+
dotenvInjected: false,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../../src/rewriter/templates/shell.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,sBAA6B,GAAmB;IAC9C,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC;IACrC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAErC,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACrF,MAAM,WAAW,GAAG,YAAY,CAAC,CAAC,CAAC,QAAQ,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC;IAEnE,IAAI,gBAAgB,GAAG,WAAW,CAAC;IACnC,IAAI,YAAY,GAAG,CAAC,CAAC;IAErB,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC/B,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;QAChE,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;QACjD,IAAI,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC9B,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC;YAC7D,YAAY,EAAE,CAAC;YACf,MAAM;QACR,CAAC;IACH,CAAC;IAED,8CAA8C;IAC9C,IAAI,YAAY,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;QACnE,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,SAAS,UAAU,WAAW,EAAE,IAAI,CAAC,CAAC;QAC/D,IAAI,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACjC,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;YAChE,YAAY,EAAE,CAAC;QACjB,CAAC;IACH,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,IAAI;QACtB,eAAe,EAAE,WAAW;QAC5B,gBAAgB;QAChB,YAAY;QACZ,cAAc,EAAE,KAAK;KACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RewriteContext, RewriteResult } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Rewrites TOML files:
|
|
4
|
+
* - Replaces literal secret with a reference comment and env var placeholder.
|
|
5
|
+
* - TOML does not support env var interpolation natively, so we replace
|
|
6
|
+
* the value with "${KEY}" and add a guidance comment.
|
|
7
|
+
*/
|
|
8
|
+
export declare function rewriteToml(ctx: RewriteContext): RewriteResult;
|
|
9
|
+
//# sourceMappingURL=toml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toml.d.ts","sourceRoot":"","sources":["../../../src/rewriter/templates/toml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,aAAa,CA0B9D"}
|