@openai/codex-security 0.1.8 → 0.1.10
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/README.md +30 -14
- package/_bundled_plugin/.codex-plugin/plugin.json +1 -1
- package/_bundled_plugin/mcp/server.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-001 +0 -0
- package/_bundled_plugin/preflight/capability-profiles.toml +1 -1
- package/_bundled_plugin/references/scan-contract.md +1 -1
- package/_bundled_plugin/scripts/deep_scan_workbench.py +22 -0
- package/_bundled_plugin/scripts/generate_in_scope_files.py +102 -1
- package/_bundled_plugin/scripts/generate_rank_input.py +28 -2
- package/_bundled_plugin/scripts/normalize_candidates.py +20 -2
- package/_bundled_plugin/scripts/workbench_cli.py +4 -0
- package/_bundled_plugin/scripts/workbench_constants.py +0 -1
- package/_bundled_plugin/scripts/workbench_db.py +12 -8
- package/_bundled_plugin/scripts/workbench_native_indexes.py +100 -43
- package/_bundled_plugin/scripts/workbench_scan_history.py +8 -10
- package/_bundled_plugin/skills/finding-discovery/SKILL.md +8 -4
- package/_bundled_plugin/skills/security-diff-scan/SKILL.md +21 -140
- package/dist/api.d.ts +43 -4
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +164 -117
- package/dist/api.js.map +1 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +18 -71
- package/dist/auth.js.map +1 -1
- package/dist/cli.d.ts +2 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +112 -178
- package/dist/cli.js.map +1 -1
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +7 -228
- package/dist/contract.js.map +1 -1
- package/dist/cost.d.ts +1 -0
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +1 -5
- package/dist/cost.js.map +1 -1
- package/dist/errors.d.ts +4 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +10 -46
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/knowledge-base.js +4 -4
- package/dist/knowledge-base.js.map +1 -1
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +33 -7
- package/dist/multiscan.js.map +1 -1
- package/dist/result.d.ts +13 -1
- package/dist/result.d.ts.map +1 -1
- package/dist/result.js +3 -0
- package/dist/result.js.map +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +17 -153
- package/dist/runtime.js.map +1 -1
- package/dist/scan-comparison.d.ts +14 -0
- package/dist/scan-comparison.d.ts.map +1 -1
- package/dist/scan-comparison.js +89 -0
- package/dist/scan-comparison.js.map +1 -1
- package/dist/scan-dashboard.d.ts.map +1 -1
- package/dist/scan-dashboard.js +1 -0
- package/dist/scan-dashboard.js.map +1 -1
- package/dist/scan-history-renderer.d.ts +1 -1
- package/dist/scan-history-renderer.d.ts.map +1 -1
- package/dist/scan-history-renderer.js +10 -0
- package/dist/scan-history-renderer.js.map +1 -1
- package/dist/scan-logs.d.ts +17 -0
- package/dist/scan-logs.d.ts.map +1 -0
- package/dist/scan-logs.js +90 -0
- package/dist/scan-logs.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/worker-progress.d.ts.map +1 -1
- package/dist/worker-progress.js +8 -29
- package/dist/worker-progress.js.map +1 -1
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -4,33 +4,27 @@ import { accessSync, constants, existsSync, lstatSync, realpathSync, writeSync,
|
|
|
4
4
|
import { mkdir, readFile, realpath, stat, writeFile } from "node:fs/promises";
|
|
5
5
|
import { basename, dirname, isAbsolute, join, parse, relative, resolve, sep, win32, } from "node:path";
|
|
6
6
|
import { cwd } from "node:process";
|
|
7
|
-
import {
|
|
7
|
+
import { createInterface } from "node:readline";
|
|
8
|
+
import { Readable, Writable as NodeWritable } from "node:stream";
|
|
8
9
|
import { pipeline } from "node:stream/promises";
|
|
9
10
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
10
11
|
import { Cli, z } from "incur";
|
|
11
12
|
import { parse as parseToml } from "smol-toml";
|
|
12
|
-
import { classifyConnectionFailure,
|
|
13
|
+
import { classifyConnectionFailure, createSecurityInternal, listRepositoryFindings, scanAuthentication, } from "./api.js";
|
|
13
14
|
import { accountStatus } from "./auth.js";
|
|
14
15
|
import { createBulkScanDiscoveryDependencies, runBulkScanWizard, } from "./bulk-scan-discovery.js";
|
|
15
16
|
import { DEFAULT_CODEX_CONFIG, EXTERNAL_CODEX_PROVIDERS, isExternalModelProvider, mergedCodexConfig, scanModelConfiguration, scanModelProvider, } from "./config.js";
|
|
16
17
|
import { formatUsd } from "./cost.js";
|
|
17
|
-
import { CodexSecurityError, ConfigurationError, InvalidTargetError, OutputDirectoryError, OutputInsideProtectedRootError, PluginPythonUnavailableError,
|
|
18
|
+
import { CodexSecurityError, ConfigurationError, InvalidTargetError, OutputDirectoryError, OutputInsideProtectedRootError, PluginPythonUnavailableError, errorMessage, safeErrorMessage, ScanCostLimitExceededError, ScanInterruptedError, } from "./errors.js";
|
|
18
19
|
import { runMultiscan } from "./multiscan.js";
|
|
19
20
|
import { bundledPluginRoot, codexSecurityCredentialHome, codexSecurityStateDirectory, expandHome, prepareCodexSecurityCredentialHome, resolveCodexCommand, resolvePluginPython, runWorkbench, setCodexSecurityCredentialLogout, } from "./runtime.js";
|
|
20
|
-
import {
|
|
21
|
+
import { matchScanFindingsInternal, } from "./scan-comparison.js";
|
|
22
|
+
import { readScanLogs } from "./scan-logs.js";
|
|
21
23
|
import { renderScanHistory, } from "./scan-history-renderer.js";
|
|
22
24
|
import { ScanDashboard } from "./scan-dashboard.js";
|
|
23
25
|
import { DiffTarget } from "./targets.js";
|
|
24
26
|
import { BUNDLED_PLUGIN_VERSION, checkForUpdate, CODEX_EXECUTABLE_VERSION, CODEX_SDK_VERSION, formatUpdateNotice, updateNoticeEnabled, VERSION, } from "./version.js";
|
|
25
27
|
const PROGRESS_REFRESH_MILLISECONDS = 1_000;
|
|
26
|
-
const MAX_CODEX_OVERRIDE_KEY_LENGTH = 1_024;
|
|
27
|
-
const MAX_CODEX_OVERRIDE_VALUE_LENGTH = 64 * 1_024;
|
|
28
|
-
const MAX_CODEX_OVERRIDE_DEPTH = 64;
|
|
29
|
-
const MAX_SKILL_INPUT_BYTES = 1_024 * 1_024;
|
|
30
|
-
const MAX_SKILL_INPUT_COUNT = 64;
|
|
31
|
-
const MAX_SKILL_EVENT_BYTES = 1_024 * 1_024;
|
|
32
|
-
const MAX_SKILL_RESPONSE_BYTES = 256 * 1_024;
|
|
33
|
-
const SKILL_OUTPUT_LIMIT_MESSAGE = "Codex skill output exceeded the 1 MiB event or 256 KiB response safety limit.";
|
|
34
28
|
const WINDOWS_NETWORK_PATH = /^[\\/]{2}/u;
|
|
35
29
|
const WINDOWS_LOCAL_DEVICE_ROOT = /^[\\/]{2}[?.][\\/](?:[A-Za-z]:|Volume\{[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\}|GLOBALROOT[\\/]Device[\\/]HarddiskVolume[0-9]+)(?=[\\/]|$)/iu;
|
|
36
30
|
const SCAN_HISTORY_OUTPUT_OPTION = /^--(?:format|filter-output|full-output|token-count|token-limit|token-offset)(?:=|$)/u;
|
|
@@ -153,7 +147,7 @@ async function readPromptFiles(directory, scanPromptFile, postScanPromptFile) {
|
|
|
153
147
|
};
|
|
154
148
|
}
|
|
155
149
|
const DEFAULT_DEPENDENCIES = {
|
|
156
|
-
createSecurity: (config) =>
|
|
150
|
+
createSecurity: (config) => createSecurityInternal(config, { surface: "cli" }),
|
|
157
151
|
environment: process.env,
|
|
158
152
|
prepareAuthenticationHome: prepareCodexSecurityCredentialHome,
|
|
159
153
|
checkForUpdate: () => checkForUpdate({ environment: process.env }),
|
|
@@ -255,7 +249,7 @@ const DEFAULT_DEPENDENCIES = {
|
|
|
255
249
|
failureMessage: "Could not read Codex Security scan history",
|
|
256
250
|
}, args);
|
|
257
251
|
},
|
|
258
|
-
matchFindings:
|
|
252
|
+
matchFindings: (input, options) => matchScanFindingsInternal(input, options, { surface: "cli" }),
|
|
259
253
|
};
|
|
260
254
|
export async function runCodexSkillCommand(args, output, command = resolveCodexCommand(), processEnvironment = process.env) {
|
|
261
255
|
const configuredHome = processEnvironment["CODEX_HOME"];
|
|
@@ -274,7 +268,6 @@ export async function runCodexSkillCommand(args, output, command = resolveCodexC
|
|
|
274
268
|
windowsHide: true,
|
|
275
269
|
});
|
|
276
270
|
let requestedSignal = null;
|
|
277
|
-
let skillOutputLimitExceeded = false;
|
|
278
271
|
let forcedTermination;
|
|
279
272
|
let forceStatusCompletion = null;
|
|
280
273
|
let forceCaptureCompletion = null;
|
|
@@ -311,10 +304,7 @@ export async function runCodexSkillCommand(args, output, command = resolveCodexC
|
|
|
311
304
|
const captured = output === undefined || invocation.stdout === null
|
|
312
305
|
? Promise.resolve(undefined)
|
|
313
306
|
: Promise.race([
|
|
314
|
-
readSkillCommandOutput(invocation.stdout,
|
|
315
|
-
skillOutputLimitExceeded = true;
|
|
316
|
-
requestTermination("SIGTERM");
|
|
317
|
-
}),
|
|
307
|
+
readSkillCommandOutput(invocation.stdout),
|
|
318
308
|
new Promise((resolve) => {
|
|
319
309
|
forceCaptureCompletion = () => resolve(undefined);
|
|
320
310
|
}),
|
|
@@ -343,9 +333,6 @@ export async function runCodexSkillCommand(args, output, command = resolveCodexC
|
|
|
343
333
|
invocation.once(output === undefined ? "exit" : "close", complete);
|
|
344
334
|
});
|
|
345
335
|
const [status, events] = await Promise.all([invocationStatus, captured]);
|
|
346
|
-
if (skillOutputLimitExceeded) {
|
|
347
|
-
throw new CodexSecurityError(SKILL_OUTPUT_LIMIT_MESSAGE);
|
|
348
|
-
}
|
|
349
336
|
if (output === undefined || status === 130 || status === 143)
|
|
350
337
|
return status;
|
|
351
338
|
if (status !== 0) {
|
|
@@ -461,7 +448,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
461
448
|
return await select(await dependencies.runWorkbench(args));
|
|
462
449
|
}
|
|
463
450
|
catch (error) {
|
|
464
|
-
errorOutput.write(`codex-security: ${
|
|
451
|
+
errorOutput.write(`codex-security: ${errorMessage(error)}\n`);
|
|
465
452
|
exitCode = 2;
|
|
466
453
|
return undefined;
|
|
467
454
|
}
|
|
@@ -541,6 +528,27 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
541
528
|
]);
|
|
542
529
|
},
|
|
543
530
|
});
|
|
531
|
+
findingFeedback.command("list", {
|
|
532
|
+
description: "List open findings for a repository across its scans.",
|
|
533
|
+
mcp: false,
|
|
534
|
+
args: z.object({
|
|
535
|
+
repository: z
|
|
536
|
+
.string()
|
|
537
|
+
.optional()
|
|
538
|
+
.describe("Repository to inspect (default: current directory)."),
|
|
539
|
+
}),
|
|
540
|
+
output: z.record(z.string(), z.unknown()).optional(),
|
|
541
|
+
async run({ args, format }) {
|
|
542
|
+
const repository = resolve(dependencies.currentDirectory(), args.repository ?? ".");
|
|
543
|
+
return presentHistory(await history(["list-repositories"], async (value) => {
|
|
544
|
+
const target = value["repositories"].find((entry) => entry["targetPath"] === repository);
|
|
545
|
+
const findings = target === undefined
|
|
546
|
+
? []
|
|
547
|
+
: await listRepositoryFindings(dependencies.runWorkbench, target["targetId"]);
|
|
548
|
+
return { repository, findings: findings ?? [] };
|
|
549
|
+
}), "findings", format, { repository });
|
|
550
|
+
},
|
|
551
|
+
});
|
|
544
552
|
const scanHistory = Cli.create("scans", {
|
|
545
553
|
description: "List, inspect, rerun, match, and compare saved Codex Security scans.",
|
|
546
554
|
})
|
|
@@ -605,6 +613,31 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
605
613
|
};
|
|
606
614
|
}), "show", format, { showLinkedFindings: options.showLinkedFindings });
|
|
607
615
|
},
|
|
616
|
+
})
|
|
617
|
+
.command("logs", {
|
|
618
|
+
description: "Show saved activity for a scan and its workers.",
|
|
619
|
+
mcp: false,
|
|
620
|
+
args: z.object({
|
|
621
|
+
scanId: z
|
|
622
|
+
.string()
|
|
623
|
+
.min(1)
|
|
624
|
+
.describe("Saved scan identifier or unique prefix."),
|
|
625
|
+
}),
|
|
626
|
+
output: z.record(z.string(), z.unknown()).optional(),
|
|
627
|
+
async run({ args }) {
|
|
628
|
+
return await history(["get-scan", "--scan-id", args.scanId], async (value) => {
|
|
629
|
+
const scan = value["scan"];
|
|
630
|
+
const threadId = scan.continuationThreadId;
|
|
631
|
+
if (!threadId) {
|
|
632
|
+
throw new CodexSecurityError(`No session is associated with scan ${scan.scanId}.`);
|
|
633
|
+
}
|
|
634
|
+
return (await readScanLogs({
|
|
635
|
+
scanId: scan.scanId,
|
|
636
|
+
threadId,
|
|
637
|
+
codexHome: codexSecurityCredentialHome(dependencies.environment),
|
|
638
|
+
}));
|
|
639
|
+
});
|
|
640
|
+
},
|
|
608
641
|
})
|
|
609
642
|
.command("rerun", {
|
|
610
643
|
description: "Rerun a saved scan with its original configuration.",
|
|
@@ -632,7 +665,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
632
665
|
scanArguments.verbose = options.verbose;
|
|
633
666
|
}
|
|
634
667
|
catch (error) {
|
|
635
|
-
const message =
|
|
668
|
+
const message = errorMessage(error);
|
|
636
669
|
errorOutput.write(`codex-security: ${message}\n`);
|
|
637
670
|
exitCode = 2;
|
|
638
671
|
return incurError({
|
|
@@ -688,7 +721,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
688
721
|
return presentHistory(await matchScanPair(args.beforeId, args.afterId, options.force), "compare", format);
|
|
689
722
|
}
|
|
690
723
|
catch (error) {
|
|
691
|
-
errorOutput.write(`codex-security: ${
|
|
724
|
+
errorOutput.write(`codex-security: ${errorMessage(error)}\n`);
|
|
692
725
|
exitCode = 2;
|
|
693
726
|
return undefined;
|
|
694
727
|
}
|
|
@@ -734,7 +767,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
734
767
|
verbose: z
|
|
735
768
|
.boolean()
|
|
736
769
|
.default(false)
|
|
737
|
-
.describe("Print
|
|
770
|
+
.describe("Print scan diagnostics to stderr."),
|
|
738
771
|
path: z
|
|
739
772
|
.array(optionValue("--path"))
|
|
740
773
|
.default([])
|
|
@@ -748,7 +781,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
748
781
|
.describe("Append scan instructions from FILE."),
|
|
749
782
|
postScanPromptFile: optionValue("--post-scan-prompt-file")
|
|
750
783
|
.optional()
|
|
751
|
-
.describe("Run
|
|
784
|
+
.describe("Run FILE after each scan, including failures."),
|
|
752
785
|
diff: optionValue("--diff")
|
|
753
786
|
.optional()
|
|
754
787
|
.describe("Scan committed Git changes from BASE to --head."),
|
|
@@ -953,7 +986,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
953
986
|
};
|
|
954
987
|
}
|
|
955
988
|
catch (error) {
|
|
956
|
-
errorOutput.write(`codex-security: ${
|
|
989
|
+
errorOutput.write(`codex-security: ${errorMessage(error)}\n`);
|
|
957
990
|
exitCode = 2;
|
|
958
991
|
return undefined;
|
|
959
992
|
}
|
|
@@ -997,7 +1030,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
997
1030
|
.describe("Append instructions from FILE to every scan."),
|
|
998
1031
|
postScanPromptFile: optionValue("--post-scan-prompt-file")
|
|
999
1032
|
.optional()
|
|
1000
|
-
.describe("Run FILE after each
|
|
1033
|
+
.describe("Run FILE after each scan, including failures."),
|
|
1001
1034
|
model: optionValue("--model")
|
|
1002
1035
|
.optional()
|
|
1003
1036
|
.describe(`OpenAI model for each repository (default: ${DEFAULT_SCAN_MODEL_CONFIGURATION.model}).`),
|
|
@@ -1049,33 +1082,8 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
1049
1082
|
let outputDir;
|
|
1050
1083
|
let githubHost;
|
|
1051
1084
|
if (args.input === undefined) {
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
const argument = argv[optionIndex];
|
|
1055
|
-
if (argument === "--model" ||
|
|
1056
|
-
argument === "--effort" ||
|
|
1057
|
-
argument === "--provider" ||
|
|
1058
|
-
argument === "--codex" ||
|
|
1059
|
-
argument === "--knowledge-base" ||
|
|
1060
|
-
argument === "--scan-prompt-file" ||
|
|
1061
|
-
argument === "--post-scan-prompt-file") {
|
|
1062
|
-
optionIndex += 2;
|
|
1063
|
-
}
|
|
1064
|
-
else if (argument.startsWith("--model=") ||
|
|
1065
|
-
argument.startsWith("--effort=") ||
|
|
1066
|
-
argument.startsWith("--provider=") ||
|
|
1067
|
-
argument.startsWith("--codex=") ||
|
|
1068
|
-
argument.startsWith("--knowledge-base=") ||
|
|
1069
|
-
argument.startsWith("--scan-prompt-file=") ||
|
|
1070
|
-
argument.startsWith("--post-scan-prompt-file=")) {
|
|
1071
|
-
optionIndex += 1;
|
|
1072
|
-
}
|
|
1073
|
-
else {
|
|
1074
|
-
break;
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
if (argv[0] !== "bulk-scan" || optionIndex !== argv.length) {
|
|
1078
|
-
throw new Error("Run 'codex-security bulk-scan [--provider PROVIDER] [--model MODEL] [--effort EFFORT] [--codex KEY=VALUE] [--knowledge-base PATH]' to discover repositories, or provide a CSV and --output-dir.");
|
|
1085
|
+
if (options.outputDir !== undefined) {
|
|
1086
|
+
throw new Error("--output-dir can only be used with a repository CSV; omit it to choose an output directory interactively.");
|
|
1079
1087
|
}
|
|
1080
1088
|
const wizard = await runBulkScanWizard(dependencies.bulkScan ??
|
|
1081
1089
|
createBulkScanDiscoveryDependencies({
|
|
@@ -1114,7 +1122,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
1114
1122
|
signal: controller.signal,
|
|
1115
1123
|
onProgress: ({ repository, status, attempt, error, warning }) => {
|
|
1116
1124
|
const detail = error ?? warning;
|
|
1117
|
-
errorOutput.write(`codex-security: ${repository} ${status} (attempt ${attempt})${detail === undefined ? "" : `: ${
|
|
1125
|
+
errorOutput.write(`codex-security: ${repository} ${status} (attempt ${attempt})${detail === undefined ? "" : `: ${errorMessage(detail)}`}\n`);
|
|
1118
1126
|
},
|
|
1119
1127
|
});
|
|
1120
1128
|
exitCode =
|
|
@@ -1128,7 +1136,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
1128
1136
|
(error instanceof Error && error.name === "ExitPromptError"
|
|
1129
1137
|
? 130
|
|
1130
1138
|
: 2);
|
|
1131
|
-
errorOutput.write(`codex-security: ${
|
|
1139
|
+
errorOutput.write(`codex-security: ${errorMessage(error)}\n`);
|
|
1132
1140
|
}
|
|
1133
1141
|
finally {
|
|
1134
1142
|
dependencies.removeSignalListener("SIGINT", onInterrupt);
|
|
@@ -1204,7 +1212,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
1204
1212
|
}
|
|
1205
1213
|
catch (error) {
|
|
1206
1214
|
exitCode = 2;
|
|
1207
|
-
errorOutput.write(`codex-security: ${
|
|
1215
|
+
errorOutput.write(`codex-security: ${errorMessage(error)}\n`);
|
|
1208
1216
|
}
|
|
1209
1217
|
},
|
|
1210
1218
|
})
|
|
@@ -1231,7 +1239,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
1231
1239
|
}
|
|
1232
1240
|
catch (error) {
|
|
1233
1241
|
exitCode = 2;
|
|
1234
|
-
errorOutput.write(`codex-security: ${
|
|
1242
|
+
errorOutput.write(`codex-security: ${errorMessage(error)}\n`);
|
|
1235
1243
|
}
|
|
1236
1244
|
},
|
|
1237
1245
|
})
|
|
@@ -1380,7 +1388,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
1380
1388
|
if (frameworkExit !== undefined) {
|
|
1381
1389
|
if (exitCode !== 0)
|
|
1382
1390
|
return exitCode;
|
|
1383
|
-
errorOutput.write(`codex-security: ${
|
|
1391
|
+
errorOutput.write(`codex-security: ${errorMessage(incurErrorMessage(frameworkOutput))}\n`);
|
|
1384
1392
|
return 2;
|
|
1385
1393
|
}
|
|
1386
1394
|
if (frameworkOutput.length === 0)
|
|
@@ -1390,7 +1398,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
1390
1398
|
return exitCode;
|
|
1391
1399
|
}
|
|
1392
1400
|
catch (error) {
|
|
1393
|
-
errorOutput.write(`codex-security: ${
|
|
1401
|
+
errorOutput.write(`codex-security: ${errorMessage(error)}\n`);
|
|
1394
1402
|
return 2;
|
|
1395
1403
|
}
|
|
1396
1404
|
}
|
|
@@ -1692,24 +1700,17 @@ function staysWithinWindowsDeviceRoot(input, root) {
|
|
|
1692
1700
|
return true;
|
|
1693
1701
|
}
|
|
1694
1702
|
async function runSkill(skill, inputs, codexOverrides, effort, stdout, stderr, dependencies) {
|
|
1695
|
-
if (inputs.length > MAX_SKILL_INPUT_COUNT) {
|
|
1696
|
-
throw new CodexSecurityError("Skill inputs exceed the 64-item limit.");
|
|
1697
|
-
}
|
|
1698
1703
|
const overrides = parseCodexOverrides(codexOverrides, undefined, effort);
|
|
1699
1704
|
if (Object.keys(overrides).some((key) => key !== "model" && key !== "model_reasoning_effort")) {
|
|
1700
1705
|
throw new CodexSecurityError("Validation and patching only support model and model_reasoning_effort overrides.");
|
|
1701
1706
|
}
|
|
1702
1707
|
const { model, reasoningEffort } = scanModelConfiguration(await mergedCodexConfig({ codexOverrides: overrides }));
|
|
1703
1708
|
const directory = dependencies.currentDirectory();
|
|
1704
|
-
let totalBytes = 0;
|
|
1705
1709
|
const contents = [];
|
|
1706
1710
|
for (const input of inputs) {
|
|
1707
1711
|
if (input.trim().length === 0) {
|
|
1708
1712
|
throw new CodexSecurityError("Finding or issue inputs must not be empty.");
|
|
1709
1713
|
}
|
|
1710
|
-
if (Buffer.byteLength(input, "utf8") > MAX_SKILL_INPUT_BYTES) {
|
|
1711
|
-
throw new CodexSecurityError("Skill input exceeds the 1 MiB limit.");
|
|
1712
|
-
}
|
|
1713
1714
|
let contentsOrLiteral = input;
|
|
1714
1715
|
const windowsNamespace = process.platform === "win32" || input.startsWith("\\");
|
|
1715
1716
|
const rawDeviceRoot = WINDOWS_LOCAL_DEVICE_ROOT.exec(input)?.[0];
|
|
@@ -1742,9 +1743,6 @@ async function runSkill(skill, inputs, codexOverrides, effort, stdout, stderr, d
|
|
|
1742
1743
|
if (!metadata.isFile()) {
|
|
1743
1744
|
throw new CodexSecurityError("Finding and issue inputs must be files or literal text.");
|
|
1744
1745
|
}
|
|
1745
|
-
if (metadata.size > MAX_SKILL_INPUT_BYTES) {
|
|
1746
|
-
throw new CodexSecurityError("Skill input exceeds the 1 MiB limit.");
|
|
1747
|
-
}
|
|
1748
1746
|
try {
|
|
1749
1747
|
contentsOrLiteral = await readFile(path, "utf8");
|
|
1750
1748
|
}
|
|
@@ -1756,10 +1754,6 @@ async function runSkill(skill, inputs, codexOverrides, effort, stdout, stderr, d
|
|
|
1756
1754
|
}
|
|
1757
1755
|
}
|
|
1758
1756
|
}
|
|
1759
|
-
totalBytes += Buffer.byteLength(contentsOrLiteral, "utf8");
|
|
1760
|
-
if (totalBytes > MAX_SKILL_INPUT_BYTES) {
|
|
1761
|
-
throw new CodexSecurityError("Skill input exceeds the 1 MiB limit.");
|
|
1762
|
-
}
|
|
1763
1757
|
contents.push(contentsOrLiteral);
|
|
1764
1758
|
}
|
|
1765
1759
|
const plugin = await bundledPluginRoot();
|
|
@@ -1779,6 +1773,8 @@ async function runSkill(skill, inputs, codexOverrides, effort, stdout, stderr, d
|
|
|
1779
1773
|
`model_reasoning_effort=${JSON.stringify(reasoningEffort)}`,
|
|
1780
1774
|
"--config",
|
|
1781
1775
|
'approval_policy="never"',
|
|
1776
|
+
"--config",
|
|
1777
|
+
'responses_api_metadata.codex_security_surface="cli"',
|
|
1782
1778
|
"--sandbox",
|
|
1783
1779
|
"workspace-write",
|
|
1784
1780
|
"--skip-git-repo-check",
|
|
@@ -1795,33 +1791,24 @@ async function runSkill(skill, inputs, codexOverrides, effort, stdout, stderr, d
|
|
|
1795
1791
|
stderr,
|
|
1796
1792
|
});
|
|
1797
1793
|
}
|
|
1798
|
-
export async function readSkillCommandOutput(stream
|
|
1794
|
+
export async function readSkillCommandOutput(stream) {
|
|
1799
1795
|
let message;
|
|
1800
1796
|
let error;
|
|
1801
1797
|
let malformed = false;
|
|
1802
|
-
|
|
1803
|
-
const markExceeded = () => {
|
|
1804
|
-
if (exceeded)
|
|
1805
|
-
return;
|
|
1806
|
-
exceeded = true;
|
|
1807
|
-
onLimitExceeded?.();
|
|
1808
|
-
};
|
|
1809
|
-
const readLine = (bytes) => {
|
|
1810
|
-
const content = bytes.at(-1) === 0x0d ? bytes.subarray(0, bytes.length - 1) : bytes;
|
|
1811
|
-
const line = content.toString("utf8");
|
|
1798
|
+
for await (const line of createInterface({ input: Readable.from(stream) })) {
|
|
1812
1799
|
if (line.trim().length === 0)
|
|
1813
|
-
|
|
1800
|
+
continue;
|
|
1814
1801
|
let event;
|
|
1815
1802
|
try {
|
|
1816
1803
|
event = JSON.parse(line);
|
|
1817
1804
|
}
|
|
1818
1805
|
catch {
|
|
1819
1806
|
malformed = true;
|
|
1820
|
-
|
|
1807
|
+
continue;
|
|
1821
1808
|
}
|
|
1822
1809
|
if (typeof event !== "object" || event === null) {
|
|
1823
1810
|
malformed = true;
|
|
1824
|
-
|
|
1811
|
+
continue;
|
|
1825
1812
|
}
|
|
1826
1813
|
const value = event;
|
|
1827
1814
|
if (value["type"] === "item.completed") {
|
|
@@ -1832,12 +1819,7 @@ export async function readSkillCommandOutput(stream, onLimitExceeded) {
|
|
|
1832
1819
|
item.type === "agent_message" &&
|
|
1833
1820
|
"text" in item &&
|
|
1834
1821
|
typeof item.text === "string") {
|
|
1835
|
-
|
|
1836
|
-
markExceeded();
|
|
1837
|
-
}
|
|
1838
|
-
else {
|
|
1839
|
-
message = item.text;
|
|
1840
|
-
}
|
|
1822
|
+
message = item.text;
|
|
1841
1823
|
}
|
|
1842
1824
|
}
|
|
1843
1825
|
else if (value["type"] === "turn.failed") {
|
|
@@ -1846,62 +1828,14 @@ export async function readSkillCommandOutput(stream, onLimitExceeded) {
|
|
|
1846
1828
|
detail !== null &&
|
|
1847
1829
|
"message" in detail &&
|
|
1848
1830
|
typeof detail.message === "string") {
|
|
1849
|
-
|
|
1850
|
-
markExceeded();
|
|
1851
|
-
}
|
|
1852
|
-
else {
|
|
1853
|
-
error = detail.message;
|
|
1854
|
-
}
|
|
1831
|
+
error = detail.message;
|
|
1855
1832
|
}
|
|
1856
1833
|
}
|
|
1857
1834
|
else if (value["type"] === "error" &&
|
|
1858
1835
|
typeof value["message"] === "string") {
|
|
1859
|
-
|
|
1860
|
-
markExceeded();
|
|
1861
|
-
}
|
|
1862
|
-
else {
|
|
1863
|
-
error = value["message"];
|
|
1864
|
-
}
|
|
1865
|
-
}
|
|
1866
|
-
};
|
|
1867
|
-
const pending = Buffer.alloc(MAX_SKILL_EVENT_BYTES);
|
|
1868
|
-
let pendingBytes = 0;
|
|
1869
|
-
let discardingOversizedLine = false;
|
|
1870
|
-
for await (const rawChunk of stream) {
|
|
1871
|
-
const chunk = Buffer.isBuffer(rawChunk)
|
|
1872
|
-
? rawChunk
|
|
1873
|
-
: Buffer.from(rawChunk, "utf8");
|
|
1874
|
-
let start = 0;
|
|
1875
|
-
while (start < chunk.length) {
|
|
1876
|
-
const newline = chunk.indexOf(0x0a, start);
|
|
1877
|
-
const end = newline === -1 ? chunk.length : newline;
|
|
1878
|
-
const segment = chunk.subarray(start, end);
|
|
1879
|
-
if (!discardingOversizedLine) {
|
|
1880
|
-
if (pendingBytes + segment.length > MAX_SKILL_EVENT_BYTES) {
|
|
1881
|
-
markExceeded();
|
|
1882
|
-
discardingOversizedLine = true;
|
|
1883
|
-
pendingBytes = 0;
|
|
1884
|
-
}
|
|
1885
|
-
else if (segment.length > 0) {
|
|
1886
|
-
segment.copy(pending, pendingBytes);
|
|
1887
|
-
pendingBytes += segment.length;
|
|
1888
|
-
}
|
|
1889
|
-
}
|
|
1890
|
-
if (newline === -1)
|
|
1891
|
-
break;
|
|
1892
|
-
if (!discardingOversizedLine) {
|
|
1893
|
-
readLine(pending.subarray(0, pendingBytes));
|
|
1894
|
-
}
|
|
1895
|
-
pendingBytes = 0;
|
|
1896
|
-
discardingOversizedLine = false;
|
|
1897
|
-
start = newline + 1;
|
|
1836
|
+
error = value["message"];
|
|
1898
1837
|
}
|
|
1899
1838
|
}
|
|
1900
|
-
if (!discardingOversizedLine && pendingBytes > 0) {
|
|
1901
|
-
readLine(pending.subarray(0, pendingBytes));
|
|
1902
|
-
}
|
|
1903
|
-
if (exceeded)
|
|
1904
|
-
throw new CodexSecurityError(SKILL_OUTPUT_LIMIT_MESSAGE);
|
|
1905
1839
|
return {
|
|
1906
1840
|
...(message === undefined ? {} : { message }),
|
|
1907
1841
|
...(error === undefined ? {} : { error }),
|
|
@@ -1987,14 +1921,12 @@ async function runExport(arguments_, output, errorOutput, dependencies) {
|
|
|
1987
1921
|
return 0;
|
|
1988
1922
|
}
|
|
1989
1923
|
catch (error) {
|
|
1990
|
-
errorOutput.write(`codex-security: ${
|
|
1924
|
+
errorOutput.write(`codex-security: ${errorMessage(error)}\n`);
|
|
1991
1925
|
return 2;
|
|
1992
1926
|
}
|
|
1993
1927
|
}
|
|
1994
|
-
function
|
|
1995
|
-
return
|
|
1996
|
-
.replaceAll(/(\b(?:tenant(?:[_-]?id)?|org(?:anization)?(?:[_-]?id)?|project(?:[_-]?id)?|(?:x[_-]?)?(?:request|trace|correlation)[_-]?id)\b(?:\\*["'])?\s*[:=]\s*)(?!\[redacted\])(?:(\\*)(['"])(?:(?!(?<!\\)\2\3)(?:\\.|[^\\]))*(?:(?<!\\)\2\3|$)|[^\s"',;&}\]]+)/giu, "$1$2$3[redacted]$2$3")
|
|
1997
|
-
.replaceAll(/[\u0000-\u001F\u007F\u0085\u2028\u2029]/gu, " ");
|
|
1928
|
+
function diagnosticValue(value) {
|
|
1929
|
+
return errorMessage(value).replaceAll(/[\u0000-\u001F\u007F\u0085\u2028\u2029]/gu, " ");
|
|
1998
1930
|
}
|
|
1999
1931
|
async function runScan(arguments_, errorOutput, dependencies, interactive = true) {
|
|
2000
1932
|
let scanDir = null;
|
|
@@ -2026,7 +1958,7 @@ async function runScan(arguments_, errorOutput, dependencies, interactive = true
|
|
|
2026
1958
|
const attributes = Object.entries(fields).flatMap(([name, value]) => value === undefined
|
|
2027
1959
|
? []
|
|
2028
1960
|
: [
|
|
2029
|
-
`${name}=${JSON.stringify(typeof value === "string" ?
|
|
1961
|
+
`${name}=${JSON.stringify(typeof value === "string" ? diagnosticValue(value) : value)}`,
|
|
2030
1962
|
]);
|
|
2031
1963
|
writeAboveProgress(() => {
|
|
2032
1964
|
errorOutput.write(`codex-security: debug: ${event}${attributes.length === 0 ? "" : ` ${attributes.join(" ")}`}\n`);
|
|
@@ -2154,7 +2086,7 @@ async function runScan(arguments_, errorOutput, dependencies, interactive = true
|
|
|
2154
2086
|
: { maxCostUsd: arguments_.maxCostUsd }),
|
|
2155
2087
|
clock: dependencies,
|
|
2156
2088
|
color: dependencies.environment["NO_COLOR"] === undefined,
|
|
2157
|
-
sanitize:
|
|
2089
|
+
sanitize: safeErrorMessage,
|
|
2158
2090
|
input: process.stdin,
|
|
2159
2091
|
onInterrupt,
|
|
2160
2092
|
});
|
|
@@ -2243,11 +2175,11 @@ async function runScan(arguments_, errorOutput, dependencies, interactive = true
|
|
|
2243
2175
|
onOutputArchived: (archiveDir) => {
|
|
2244
2176
|
diagnostic("scan.output_archived", { archive_dir: archiveDir });
|
|
2245
2177
|
if (dashboard !== null) {
|
|
2246
|
-
dashboard.note(`Moved existing results to: ${
|
|
2178
|
+
dashboard.note(`Moved existing results to: ${errorMessage(archiveDir)}`);
|
|
2247
2179
|
return;
|
|
2248
2180
|
}
|
|
2249
2181
|
progress?.stopTimer();
|
|
2250
|
-
errorOutput.write(`Moved existing results to: ${
|
|
2182
|
+
errorOutput.write(`Moved existing results to: ${errorMessage(archiveDir)}\n`);
|
|
2251
2183
|
},
|
|
2252
2184
|
signal: preparationAbortController.signal,
|
|
2253
2185
|
onOutputDirReady: (path) => {
|
|
@@ -2392,7 +2324,7 @@ async function runScan(arguments_, errorOutput, dependencies, interactive = true
|
|
|
2392
2324
|
progress.startTimer(runningMessage());
|
|
2393
2325
|
},
|
|
2394
2326
|
onWarning: (warning, details) => {
|
|
2395
|
-
const message =
|
|
2327
|
+
const message = diagnosticValue(warning);
|
|
2396
2328
|
if (details?.kind === "target_changed") {
|
|
2397
2329
|
targetWarnings.push(message);
|
|
2398
2330
|
}
|
|
@@ -2406,7 +2338,7 @@ async function runScan(arguments_, errorOutput, dependencies, interactive = true
|
|
|
2406
2338
|
observer,
|
|
2407
2339
|
classification: classifyConnectionFailure(error),
|
|
2408
2340
|
});
|
|
2409
|
-
const warning = `${observer} observer failed: ${
|
|
2341
|
+
const warning = `${observer} observer failed: ${diagnosticValue(error)}`;
|
|
2410
2342
|
if (dashboard === null) {
|
|
2411
2343
|
writeAboveProgress(() => {
|
|
2412
2344
|
errorOutput.write(`codex-security: warning: ${warning}\n`);
|
|
@@ -2461,7 +2393,7 @@ async function runScan(arguments_, errorOutput, dependencies, interactive = true
|
|
|
2461
2393
|
if (failed) {
|
|
2462
2394
|
const costLimitFailure = failure instanceof ScanCostLimitExceededError ? failure : undefined;
|
|
2463
2395
|
const message = failure instanceof OutputInsideProtectedRootError
|
|
2464
|
-
?
|
|
2396
|
+
? errorMessage(protectedRootErrorMessage(failure))
|
|
2465
2397
|
: scanFailureMessage(failure, selectedAuthentication);
|
|
2466
2398
|
diagnostic("scan.failed", {
|
|
2467
2399
|
classification: costLimitFailure !== undefined
|
|
@@ -2478,7 +2410,7 @@ async function runScan(arguments_, errorOutput, dependencies, interactive = true
|
|
|
2478
2410
|
return { exitCode: 2, error: message };
|
|
2479
2411
|
}
|
|
2480
2412
|
if (scanDir !== null) {
|
|
2481
|
-
errorOutput.write(`Partial output was kept at ${
|
|
2413
|
+
errorOutput.write(`Partial output was kept at ${errorMessage(scanDir)}.\n`);
|
|
2482
2414
|
}
|
|
2483
2415
|
return { exitCode: 2, error: message };
|
|
2484
2416
|
}
|
|
@@ -2586,7 +2518,7 @@ function scanFailureMessage(error, authentication) {
|
|
|
2586
2518
|
// errors can name the organization or project, which must not reach stderr or
|
|
2587
2519
|
// the JSON error field.
|
|
2588
2520
|
if (isLocalScanFailure(error))
|
|
2589
|
-
return
|
|
2521
|
+
return diagnosticValue(error);
|
|
2590
2522
|
switch (classifyConnectionFailure(error)) {
|
|
2591
2523
|
case "unauthorized":
|
|
2592
2524
|
if (authentication?.method === "aws_credentials") {
|
|
@@ -2614,7 +2546,7 @@ function scanFailureMessage(error, authentication) {
|
|
|
2614
2546
|
case "network_error":
|
|
2615
2547
|
case "timeout":
|
|
2616
2548
|
case "unknown":
|
|
2617
|
-
return
|
|
2549
|
+
return diagnosticValue(error);
|
|
2618
2550
|
}
|
|
2619
2551
|
}
|
|
2620
2552
|
function scanScope(arguments_) {
|
|
@@ -2626,7 +2558,7 @@ function scanScope(arguments_) {
|
|
|
2626
2558
|
portable.startsWith("//")
|
|
2627
2559
|
? portable.split("/").at(-1) ?? portable
|
|
2628
2560
|
: portable;
|
|
2629
|
-
return
|
|
2561
|
+
return errorMessage(scoped.replaceAll(/[\u0000-\u001F\u007F]/gu, " "));
|
|
2630
2562
|
});
|
|
2631
2563
|
return `${displayed.join(", ")}${arguments_.paths.length > displayed.length ? `, +${arguments_.paths.length - displayed.length} more` : ""}`;
|
|
2632
2564
|
}
|
|
@@ -2650,8 +2582,10 @@ function scanPhase(value) {
|
|
|
2650
2582
|
}
|
|
2651
2583
|
function printScanSummary(result, progress, errorOutput, color) {
|
|
2652
2584
|
const paint = (value, code) => color ? `\u001B[${code}m${value}\u001B[0m` : value;
|
|
2585
|
+
const repositoryFindings = result.repositoryFindings;
|
|
2586
|
+
const findings = repositoryFindings ?? result.findings.findings;
|
|
2653
2587
|
const severities = new Map();
|
|
2654
|
-
for (const finding of
|
|
2588
|
+
for (const finding of findings) {
|
|
2655
2589
|
severities.set(finding.severity.level, (severities.get(finding.severity.level) ?? 0) + 1);
|
|
2656
2590
|
}
|
|
2657
2591
|
const severitySummary = DISPLAY_SEVERITIES.map((severity) => {
|
|
@@ -2670,7 +2604,12 @@ function printScanSummary(result, progress, errorOutput, color) {
|
|
|
2670
2604
|
const duration = elapsed < 60
|
|
2671
2605
|
? `${elapsed}s`
|
|
2672
2606
|
: `${Math.floor(elapsed / 60)}m ${elapsed % 60}s`;
|
|
2673
|
-
const findingCount =
|
|
2607
|
+
const findingCount = findings.length;
|
|
2608
|
+
const confirmedCount = repositoryFindings?.filter((finding) => finding.confirmedInLatestScan)
|
|
2609
|
+
.length ?? 0;
|
|
2610
|
+
const findingSummary = repositoryFindings?.length
|
|
2611
|
+
? `${confirmedCount} confirmed this scan; ${findingCount - confirmedCount} previously found; ${severitySummary}`
|
|
2612
|
+
: severitySummary;
|
|
2674
2613
|
const findingColor = findingCount === 0
|
|
2675
2614
|
? 32
|
|
2676
2615
|
: severities.has("critical") || severities.has("high")
|
|
@@ -2678,8 +2617,8 @@ function printScanSummary(result, progress, errorOutput, color) {
|
|
|
2678
2617
|
: severities.has("medium")
|
|
2679
2618
|
? 33
|
|
2680
2619
|
: 36;
|
|
2681
|
-
errorOutput.write(`\n ${paint("REPORT", "1;36")} ${paint(
|
|
2682
|
-
` ${paint("FINDINGS", 1)} ${paint(`${findingCount}${
|
|
2620
|
+
errorOutput.write(`\n ${paint("REPORT", "1;36")} ${paint(errorMessage(result.reportPath), 4)}\n\n` +
|
|
2621
|
+
` ${paint("FINDINGS", 1)} ${paint(`${findingCount}${findingSummary === "" ? "" : ` (${findingSummary})`}`, findingColor)}\n` +
|
|
2683
2622
|
` ${paint("COVERAGE", 1)} ${result.coverage.completeness}\n` +
|
|
2684
2623
|
` ${paint("ELAPSED", 1)} ${duration}\n`);
|
|
2685
2624
|
const tokenSummary = formatTokenUsage(result.turnResult.usage);
|
|
@@ -2689,7 +2628,7 @@ function printScanSummary(result, progress, errorOutput, color) {
|
|
|
2689
2628
|
if (result.cost !== null) {
|
|
2690
2629
|
errorOutput.write(` ${paint("COST", 1)} ${formatUsd(result.cost.estimatedUsd)}\n`);
|
|
2691
2630
|
}
|
|
2692
|
-
errorOutput.write(` ${paint("RESULTS", 1)} ${
|
|
2631
|
+
errorOutput.write(` ${paint("RESULTS", 1)} ${errorMessage(result.scanDir)}\n`);
|
|
2693
2632
|
}
|
|
2694
2633
|
function formatTokenUsage(usage) {
|
|
2695
2634
|
if (usage === null || typeof usage !== "object")
|
|
@@ -2807,16 +2746,11 @@ export function parseCodexOverrides(values, model, effort, provider) {
|
|
|
2807
2746
|
if (key.length === 0 || literal.length === 0) {
|
|
2808
2747
|
throw new CodexSecurityError("--codex expects KEY=VALUE");
|
|
2809
2748
|
}
|
|
2810
|
-
if (Buffer.byteLength(key, "utf8") > MAX_CODEX_OVERRIDE_KEY_LENGTH ||
|
|
2811
|
-
Buffer.byteLength(literal, "utf8") > MAX_CODEX_OVERRIDE_VALUE_LENGTH) {
|
|
2812
|
-
throw new CodexSecurityError("--codex key or value exceeds the limit");
|
|
2813
|
-
}
|
|
2814
2749
|
const parts = key.split(".");
|
|
2815
|
-
if (parts.length
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
part === "constructor")) {
|
|
2750
|
+
if (parts.some((part) => part.length === 0 ||
|
|
2751
|
+
part === "__proto__" ||
|
|
2752
|
+
part === "prototype" ||
|
|
2753
|
+
part === "constructor")) {
|
|
2820
2754
|
throw new CodexSecurityError("Invalid --codex key");
|
|
2821
2755
|
}
|
|
2822
2756
|
let parsed;
|
|
@@ -2964,7 +2898,7 @@ function interruptedExit(signal, scanDir, errorOutput) {
|
|
|
2964
2898
|
errorOutput.write(`codex-security: Scan ${ctrlC ? "canceled by Ctrl-C" : "terminated by SIGTERM"}.\n`);
|
|
2965
2899
|
errorOutput.write(scanDir === null
|
|
2966
2900
|
? "codex-security: No partial output was kept.\n"
|
|
2967
|
-
: `codex-security: Partial output was kept at ${
|
|
2901
|
+
: `codex-security: Partial output was kept at ${errorMessage(scanDir)}.\n`);
|
|
2968
2902
|
return ctrlC ? 130 : 143;
|
|
2969
2903
|
}
|
|
2970
2904
|
function isJsonObject(value) {
|
|
@@ -2987,7 +2921,7 @@ if (invokedAsMain()) {
|
|
|
2987
2921
|
void main().then((exitCode) => {
|
|
2988
2922
|
process.exitCode = exitCode;
|
|
2989
2923
|
}, (error) => {
|
|
2990
|
-
process.stderr.write(`codex-security: ${
|
|
2924
|
+
process.stderr.write(`codex-security: ${errorMessage(error)}\n`);
|
|
2991
2925
|
process.exitCode = 2;
|
|
2992
2926
|
});
|
|
2993
2927
|
}
|