Skip to content

Commit 0d95912

Browse files
fix: javascript.lang.security.detect-child-process.detect-child-process security vulnerability
Automated security fix generated by Orbis Security AI
1 parent f350b52 commit 0d95912

1 file changed

Lines changed: 31 additions & 31 deletions

File tree

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
// This file requires a modern version of node 14+, and grep to be available.
2-
3-
// node scripts/find-unused-diagnostic-messages.mjs
4-
import { execSync } from "child_process";
5-
import { readFileSync } from "fs";
6-
import { EOL } from "os";
7-
8-
const diags = readFileSync("src/compiler/diagnosticInformationMap.generated.ts", "utf8");
9-
const startOfDiags = diags.split("export const Diagnostics")[1];
10-
11-
/** @type {string[]} */
12-
const missingNames = [];
13-
startOfDiags.split(EOL).forEach(line => {
14-
if (!line.includes(":")) return;
15-
const diagName = line.split(":")[0].trim();
16-
17-
try {
18-
execSync(`grep -rnw 'src' -e 'Diagnostics.${diagName}'`).toString();
19-
process.stdout.write(".");
20-
}
21-
catch {
22-
missingNames.push(diagName);
23-
process.stdout.write("x");
24-
}
25-
});
26-
27-
if (missingNames.length) {
28-
process.exitCode = 1;
29-
console.log("Could not find usage of these diagnostics in the codebase:");
30-
console.log(missingNames);
31-
}
1+
// This file requires a modern version of node 14+, and grep to be available.
2+
3+
// node scripts/find-unused-diagnostic-messages.mjs
4+
import { execFileSync } from "child_process";
5+
import { readFileSync } from "fs";
6+
import { EOL } from "os";
7+
8+
const diags = readFileSync("src/compiler/diagnosticInformationMap.generated.ts", "utf8");
9+
const startOfDiags = diags.split("export const Diagnostics")[1];
10+
11+
/** @type {string[]} */
12+
const missingNames = [];
13+
startOfDiags.split(EOL).forEach(line => {
14+
if (!line.includes(":")) return;
15+
const diagName = line.split(":")[0].trim();
16+
17+
try {
18+
execFileSync("grep", ["-rnw", "src", "-e", `Diagnostics.${diagName}`]);
19+
process.stdout.write(".");
20+
}
21+
catch {
22+
missingNames.push(diagName);
23+
process.stdout.write("x");
24+
}
25+
});
26+
27+
if (missingNames.length) {
28+
process.exitCode = 1;
29+
console.log("Could not find usage of these diagnostics in the codebase:");
30+
console.log(missingNames);
31+
}

0 commit comments

Comments
 (0)