@openai/codex-security 0.1.24 → 0.1.26
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 +399 -27
- package/_bundled_plugin/.app.json +0 -5
- package/_bundled_plugin/.codex-plugin/plugin.json +1 -1
- package/_bundled_plugin/.mcp.json +1 -0
- 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/references/config-preflight.md +2 -2
- package/_bundled_plugin/references/final-report.md +5 -3
- package/_bundled_plugin/references/scan-artifacts.md +5 -1
- package/_bundled_plugin/references/scan-contract.md +7 -3
- package/_bundled_plugin/schemas/tools/deep-reducer.schema.json +27 -1
- package/_bundled_plugin/scripts/deep_scan_workbench.py +6 -1
- package/_bundled_plugin/scripts/finalize_scan_contract.py +2 -5
- package/_bundled_plugin/scripts/rank_preview.py +11 -1
- package/_bundled_plugin/scripts/report_projection.py +1 -1
- package/_bundled_plugin/scripts/workbench_cli.py +11 -1
- package/_bundled_plugin/scripts/workbench_db.py +55 -4
- package/_bundled_plugin/scripts/workbench_saved_results.py +41 -22
- package/_bundled_plugin/scripts/workbench_scan_history.py +374 -66
- package/_bundled_plugin/scripts/workbench_scan_usage.py +7 -6
- package/_bundled_plugin/scripts/workbench_schema.py +46 -0
- package/_bundled_plugin/scripts/workbench_severity.py +119 -0
- package/_bundled_plugin/scripts/workbench_target.py +86 -12
- package/_bundled_plugin/skills/deep-security-scan/SKILL.md +5 -3
- package/_bundled_plugin/skills/verify-fix/SKILL.md +5 -1
- package/dist/api.d.ts +15 -2
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +333 -32
- package/dist/api.js.map +1 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +35 -3
- package/dist/auth.js.map +1 -1
- package/dist/classify-scan-severity.d.ts +16 -0
- package/dist/classify-scan-severity.d.ts.map +1 -0
- package/dist/classify-scan-severity.js +96 -0
- package/dist/classify-scan-severity.js.map +1 -0
- package/dist/classify-severity.d.ts +38 -0
- package/dist/classify-severity.d.ts.map +1 -0
- package/dist/classify-severity.js +185 -0
- package/dist/classify-severity.js.map +1 -0
- package/dist/cli.d.ts +7 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +403 -116
- package/dist/cli.js.map +1 -1
- package/dist/component-plan.d.ts.map +1 -1
- package/dist/component-plan.js +4 -2
- package/dist/component-plan.js.map +1 -1
- package/dist/component-scan.d.ts.map +1 -1
- package/dist/component-scan.js +21 -6
- package/dist/component-scan.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +46 -2
- package/dist/config.js.map +1 -1
- package/dist/cost.d.ts +1 -0
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +43 -17
- package/dist/cost.js.map +1 -1
- package/dist/deduplication/checkpointed-review.d.ts.map +1 -1
- package/dist/deduplication/checkpointed-review.js +2 -1
- package/dist/deduplication/checkpointed-review.js.map +1 -1
- package/dist/deduplication/codex-review.d.ts +3 -0
- package/dist/deduplication/codex-review.d.ts.map +1 -1
- package/dist/deduplication/codex-review.js +122 -36
- package/dist/deduplication/codex-review.js.map +1 -1
- package/dist/deduplication/deduplication-prompts.d.ts +4 -3
- package/dist/deduplication/deduplication-prompts.d.ts.map +1 -1
- package/dist/deduplication/deduplication-prompts.js +18 -9
- package/dist/deduplication/deduplication-prompts.js.map +1 -1
- package/dist/deduplication/deduplication-reviewer.d.ts +2 -7
- package/dist/deduplication/deduplication-reviewer.d.ts.map +1 -1
- package/dist/deduplication/deduplication-reviewer.js +47 -25
- package/dist/deduplication/deduplication-reviewer.js.map +1 -1
- package/dist/deduplication/deduplication.d.ts.map +1 -1
- package/dist/deduplication/deduplication.js +186 -23
- package/dist/deduplication/deduplication.js.map +1 -1
- package/dist/deduplication/scan.d.ts +9 -1
- package/dist/deduplication/scan.d.ts.map +1 -1
- package/dist/deduplication/scan.js +24 -7
- package/dist/deduplication/scan.js.map +1 -1
- package/dist/errors.d.ts +13 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +7 -0
- package/dist/errors.js.map +1 -1
- package/dist/finding-catalogue.d.ts +11 -0
- package/dist/finding-catalogue.d.ts.map +1 -0
- package/dist/finding-catalogue.js +150 -0
- package/dist/finding-catalogue.js.map +1 -0
- package/dist/index.d.ts +11 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/mock-scan.d.ts +4 -0
- package/dist/mock-scan.d.ts.map +1 -0
- package/dist/mock-scan.js +210 -0
- package/dist/mock-scan.js.map +1 -0
- package/dist/patch-tui.js +1 -1
- package/dist/patch-tui.js.map +1 -1
- package/dist/publication-store.d.ts.map +1 -1
- package/dist/publication-store.js +9 -4
- package/dist/publication-store.js.map +1 -1
- package/dist/publication.d.ts +9 -0
- package/dist/publication.d.ts.map +1 -1
- package/dist/publication.js +45 -5
- package/dist/publication.js.map +1 -1
- package/dist/publish.d.ts +4 -2
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +4 -4
- package/dist/publish.js.map +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +49 -14
- package/dist/runtime.js.map +1 -1
- package/dist/scan-comparison.d.ts +44 -30
- package/dist/scan-comparison.d.ts.map +1 -1
- package/dist/scan-comparison.js +673 -101
- package/dist/scan-comparison.js.map +1 -1
- package/dist/scan-dashboard.d.ts +3 -1
- package/dist/scan-dashboard.d.ts.map +1 -1
- package/dist/scan-dashboard.js +70 -3
- package/dist/scan-dashboard.js.map +1 -1
- package/dist/scan-history-renderer.d.ts.map +1 -1
- package/dist/scan-history-renderer.js +26 -0
- package/dist/scan-history-renderer.js.map +1 -1
- package/dist/server/api.d.ts +6 -0
- package/dist/server/api.d.ts.map +1 -0
- package/dist/server/api.js +4 -0
- package/dist/server/api.js.map +1 -0
- package/dist/server/dashboard/app.css +1 -1
- package/dist/server/embeddings.d.ts +2 -1
- package/dist/server/embeddings.d.ts.map +1 -1
- package/dist/server/embeddings.js +8 -3
- package/dist/server/embeddings.js.map +1 -1
- package/dist/server/serve.d.ts.map +1 -1
- package/dist/server/serve.js +1 -1
- package/dist/server/serve.js.map +1 -1
- package/dist/severity-store.d.ts +2 -0
- package/dist/severity-store.d.ts.map +1 -0
- package/dist/severity-store.js +111 -0
- package/dist/severity-store.js.map +1 -0
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +3 -5
- package/dist/targets.js.map +1 -1
- package/dist/thread-source.d.ts +1 -0
- package/dist/thread-source.d.ts.map +1 -1
- package/dist/thread-source.js +1 -0
- package/dist/thread-source.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +11 -6
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ import { execFile as execFileCallback, execFileSync, spawn, } from "node:child_p
|
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
import { accessSync, constants, createReadStream, existsSync, lstatSync, realpathSync, writeSync, } from "node:fs";
|
|
5
5
|
import { chmod, lstat, mkdir, mkdtemp, open, readFile, realpath, rm, writeFile, } from "node:fs/promises";
|
|
6
|
-
import { tmpdir } from "node:os";
|
|
6
|
+
import { homedir, tmpdir } from "node:os";
|
|
7
7
|
import { basename, dirname, isAbsolute, join, parse, relative, resolve, sep, win32, } from "node:path";
|
|
8
8
|
import { cwd } from "node:process";
|
|
9
9
|
import { createInterface } from "node:readline";
|
|
@@ -13,10 +13,11 @@ import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
13
13
|
import { promisify, stripVTControlCharacters } from "node:util";
|
|
14
14
|
import { Cli, z } from "incur";
|
|
15
15
|
import { parse as parseToml } from "smol-toml";
|
|
16
|
-
import { classifyConnectionFailure, createSecurityInternal, environmentValue, listRepositoryFindings, SCAN_AUTH_MODES, scanAuthentication, } from "./api.js";
|
|
16
|
+
import { classifyConnectionFailure, createSecurityInternal, environmentValue, formatEnvironmentVariableRemovalGuidance, initialCredentialsAvailable, listRepositoryFindings, SCAN_AUTH_MODES, scanAuthentication, } from "./api.js";
|
|
17
17
|
import { accountStatus } from "./auth.js";
|
|
18
18
|
import { publishScanToCustom } from "./custom-publish.js";
|
|
19
19
|
import { deduplicateScanInternal } from "./deduplication/scan.js";
|
|
20
|
+
import { classifyScanSeverityInternal, classifyScanDirectorySeverityInternal, } from "./classify-scan-severity.js";
|
|
20
21
|
import { resolveCompletedScan, resolveWorkflowScan, } from "./saved-scan.js";
|
|
21
22
|
import { publishFindingsCsvToCloud, publishScanToCloud, } from "./cloud-publish.js";
|
|
22
23
|
import { createBulkScanDiscoveryDependencies, runBulkScanWizard, } from "./bulk-scan-discovery.js";
|
|
@@ -27,10 +28,10 @@ import { GITHUB_ALERT_STATES, importGitHubCodeScanningAlerts, } from "./github.j
|
|
|
27
28
|
import { importLinearIssues, isLinearIssueIdentifier, resolveLinearApiKey, } from "./linear.js";
|
|
28
29
|
import { runMultiscan } from "./multiscan.js";
|
|
29
30
|
import { componentPlanSchema } from "./component-plan.js";
|
|
30
|
-
import { runComponentScans } from "./component-scan.js";
|
|
31
|
+
import { runComponentScans, } from "./component-scan.js";
|
|
31
32
|
import { checkScanPublication, forceTerminatePublicationProcesses as terminatePublishers, publishScan, } from "./publish.js";
|
|
32
|
-
import { bundledPluginRoot, canonicalizeModelSafePath, codexSecurityCredentialHome, codexSecurityStateDirectory, expandHome, prepareCodexSecurityCredentialHome, pythonUtf8Environment, resolveCodexCommand, resolvePluginPython, runWorkbench, setCodexSecurityCredentialLogout, } from "./runtime.js";
|
|
33
|
-
import { matchScanFindingsInternal, } from "./scan-comparison.js";
|
|
33
|
+
import { bundledPluginRoot, canonicalizeModelSafePath, codexSecurityCredentialHome, codexSecurityStateDirectory, executablePathForSpawn, expandHome, prepareCodexSecurityCredentialHome, pythonUtf8Environment, resolveCodexCommand, resolvePluginPython, runWorkbench, setCodexSecurityCredentialLogout, } from "./runtime.js";
|
|
34
|
+
import { comparisonFindingGroups, comparisonForScan, matchScanFindingsInternal, unionFindingGroups, } from "./scan-comparison.js";
|
|
34
35
|
import { scanActivitiesFromEvent } from "./scan-activity.js";
|
|
35
36
|
import { CODEX_SECURITY_THREAD_SOURCES, } from "./thread-source.js";
|
|
36
37
|
import { readScanLogs } from "./scan-logs.js";
|
|
@@ -48,6 +49,7 @@ const OUTPUT_OPTION = /^--(?:format|filter-output|full-output|token-count|token-
|
|
|
48
49
|
const HIDE_CURSOR = "\u001B[?25l";
|
|
49
50
|
const SHOW_CURSOR = "\u001B[?25h";
|
|
50
51
|
const CHILD_TERMINATION_GRACE_MS = 1_000;
|
|
52
|
+
const DUPLICATE_SIGNAL_WINDOW_MS = 500;
|
|
51
53
|
const PUBLICATION_GRAPHEME_SEGMENTER = new Intl.Segmenter(undefined, {
|
|
52
54
|
granularity: "grapheme",
|
|
53
55
|
});
|
|
@@ -87,6 +89,8 @@ const VALUE_OPTIONS = new Set([
|
|
|
87
89
|
"--component",
|
|
88
90
|
"--components-file",
|
|
89
91
|
"--knowledge-base",
|
|
92
|
+
"--rubric",
|
|
93
|
+
"--finding-id",
|
|
90
94
|
"--scan-prompt-file",
|
|
91
95
|
"--validation-prompt-file",
|
|
92
96
|
"--post-scan-prompt-file",
|
|
@@ -144,7 +148,7 @@ const PROVIDER_OPTION = z
|
|
|
144
148
|
const CREATE_PR_OPTION = z
|
|
145
149
|
.boolean()
|
|
146
150
|
.default(false)
|
|
147
|
-
.describe("Create a draft GitHub pull request after verified patches.");
|
|
151
|
+
.describe("Create a draft GitHub pull request or GitLab merge request after verified patches.");
|
|
148
152
|
const ASSESS_PATCH_RISK_OPTION = z
|
|
149
153
|
.boolean()
|
|
150
154
|
.default(false)
|
|
@@ -799,16 +803,17 @@ const DEFAULT_DEPENDENCIES = {
|
|
|
799
803
|
}
|
|
800
804
|
return undefined;
|
|
801
805
|
},
|
|
802
|
-
runWorkbench: async (args, input) => {
|
|
806
|
+
runWorkbench: async (args, input, signal) => {
|
|
803
807
|
const environment = {
|
|
804
808
|
...exportEnvironment(),
|
|
805
809
|
CODEX_SECURITY_STATE_DIR: codexSecurityStateDirectory(),
|
|
806
810
|
};
|
|
807
|
-
const python = await resolvePluginPython({ environment });
|
|
811
|
+
const python = await resolvePluginPython({ environment, signal });
|
|
808
812
|
return await runWorkbench({
|
|
809
813
|
python,
|
|
810
814
|
pluginRoot: await bundledPluginRoot(),
|
|
811
815
|
environment,
|
|
816
|
+
signal,
|
|
812
817
|
failureMessage: "Could not read Codex Security scan history",
|
|
813
818
|
}, args, input);
|
|
814
819
|
},
|
|
@@ -826,7 +831,7 @@ export async function runCodexSkillCommand(args, output, command = resolveCodexC
|
|
|
826
831
|
if (configuredHome?.trim()) {
|
|
827
832
|
environment["CODEX_HOME"] = resolve(expandHome(configuredHome, processEnvironment));
|
|
828
833
|
}
|
|
829
|
-
const invocation = spawn(command.command, [...args], {
|
|
834
|
+
const invocation = spawn(executablePathForSpawn(command.command), [...args], {
|
|
830
835
|
env: environment,
|
|
831
836
|
cwd: output?.appServer?.directory ?? parse(process.execPath).root,
|
|
832
837
|
stdio: output === undefined
|
|
@@ -1069,16 +1074,82 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
1069
1074
|
});
|
|
1070
1075
|
return result?.["scans"];
|
|
1071
1076
|
};
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1077
|
+
const runMatching = async (operation) => {
|
|
1078
|
+
const controller = new AbortController();
|
|
1079
|
+
let firstSignalAt = 0;
|
|
1080
|
+
const cancel = (signal) => {
|
|
1081
|
+
if (controller.signal.aborted) {
|
|
1082
|
+
if (signal === controller.signal.reason &&
|
|
1083
|
+
dependencies.now() - firstSignalAt < DUPLICATE_SIGNAL_WINDOW_MS) {
|
|
1084
|
+
return;
|
|
1085
|
+
}
|
|
1086
|
+
removeListeners();
|
|
1087
|
+
dependencies.forceExit(signal);
|
|
1088
|
+
}
|
|
1089
|
+
else {
|
|
1090
|
+
firstSignalAt = dependencies.now();
|
|
1091
|
+
controller.abort(signal);
|
|
1092
|
+
}
|
|
1093
|
+
};
|
|
1094
|
+
const onInterrupt = () => cancel("SIGINT");
|
|
1095
|
+
const onTerminate = () => cancel("SIGTERM");
|
|
1096
|
+
const removeListeners = () => {
|
|
1097
|
+
dependencies.removeSignalListener("SIGINT", onInterrupt);
|
|
1098
|
+
dependencies.removeSignalListener("SIGTERM", onTerminate);
|
|
1099
|
+
};
|
|
1100
|
+
dependencies.addSignalListener("SIGINT", onInterrupt);
|
|
1101
|
+
dependencies.addSignalListener("SIGTERM", onTerminate);
|
|
1102
|
+
let previousProgress = "";
|
|
1103
|
+
try {
|
|
1104
|
+
const result = await operation({
|
|
1105
|
+
environment: dependencies.environment,
|
|
1106
|
+
workingDirectory: dependencies.currentDirectory(),
|
|
1107
|
+
signal: controller.signal,
|
|
1108
|
+
onProgress(progress) {
|
|
1109
|
+
if (errorOutput.isTTY !== true || progress.phase === "complete")
|
|
1110
|
+
return;
|
|
1111
|
+
const message = progress.phase === "evidence"
|
|
1112
|
+
? "Reading selected finding evidence."
|
|
1113
|
+
: `Matching ${progress.afterFindings} findings against ${progress.beforeIssues} known issues${(progress.pages ?? 1) > 1 ? ` (catalogue page ${progress.page}/${progress.pages})` : ""}.`;
|
|
1114
|
+
if (message === previousProgress)
|
|
1115
|
+
return;
|
|
1116
|
+
previousProgress = message;
|
|
1117
|
+
errorOutput.write(`codex-security: ${message}\n`);
|
|
1118
|
+
},
|
|
1119
|
+
});
|
|
1120
|
+
controller.signal.throwIfAborted();
|
|
1121
|
+
return result;
|
|
1122
|
+
}
|
|
1123
|
+
catch (error) {
|
|
1124
|
+
const interrupted = controller.signal.reason;
|
|
1125
|
+
exitCode =
|
|
1126
|
+
interrupted === "SIGINT" ? 130 : interrupted === "SIGTERM" ? 143 : 2;
|
|
1127
|
+
const message = interrupted === "SIGINT"
|
|
1128
|
+
? "Finding matching canceled by Ctrl-C. Saved comparisons are preserved."
|
|
1129
|
+
: interrupted === "SIGTERM"
|
|
1130
|
+
? "Finding matching terminated by SIGTERM. Saved comparisons are preserved."
|
|
1131
|
+
: errorMessage(error);
|
|
1132
|
+
errorOutput.write(`codex-security: ${message}\n`);
|
|
1133
|
+
throw error;
|
|
1134
|
+
}
|
|
1135
|
+
finally {
|
|
1136
|
+
removeListeners();
|
|
1137
|
+
}
|
|
1138
|
+
};
|
|
1139
|
+
const matchScanPair = async (beforeId, afterId, force = false) => runMatching(async (options) => {
|
|
1140
|
+
const { matchingCached, matchingInputs, ...comparison } = await dependencies.runWorkbench([
|
|
1141
|
+
"compare-scans",
|
|
1142
|
+
"--before-scan-id",
|
|
1143
|
+
beforeId,
|
|
1144
|
+
"--after-scan-id",
|
|
1145
|
+
afterId,
|
|
1146
|
+
"--include-matching-inputs",
|
|
1147
|
+
], undefined, options.signal);
|
|
1080
1148
|
if (matchingCached && !force)
|
|
1081
1149
|
return comparison;
|
|
1150
|
+
const input = matchingInputs;
|
|
1151
|
+
const matching = await dependencies.matchFindings(input, options);
|
|
1152
|
+
options.signal?.throwIfAborted();
|
|
1082
1153
|
return await dependencies.runWorkbench([
|
|
1083
1154
|
"save-scan-comparison",
|
|
1084
1155
|
"--before-scan-id",
|
|
@@ -1086,7 +1157,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
1086
1157
|
"--after-scan-id",
|
|
1087
1158
|
afterId,
|
|
1088
1159
|
"--matches-json-stdin",
|
|
1089
|
-
], JSON.stringify(
|
|
1160
|
+
], JSON.stringify(matching), options.signal);
|
|
1090
1161
|
});
|
|
1091
1162
|
const presentHistory = (result, command, format, settings = {}) => {
|
|
1092
1163
|
if (result === undefined ||
|
|
@@ -1356,17 +1427,10 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
1356
1427
|
}),
|
|
1357
1428
|
output: z.record(z.string(), z.unknown()).optional(),
|
|
1358
1429
|
async run({ args, format, options }) {
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
return presentHistory(await matchAllScans(dependencies, options.force), "match-all", format);
|
|
1362
|
-
}
|
|
1363
|
-
return presentHistory(await matchScanPair(args.beforeId, args.afterId, options.force), "compare", format);
|
|
1364
|
-
}
|
|
1365
|
-
catch (error) {
|
|
1366
|
-
errorOutput.write(`codex-security: ${errorMessage(error)}\n`);
|
|
1367
|
-
exitCode = 2;
|
|
1368
|
-
throw error;
|
|
1430
|
+
if (options.all) {
|
|
1431
|
+
return presentHistory(await runMatching((matchingOptions) => matchAllScans(dependencies, options.force, matchingOptions)), "match-all", format);
|
|
1369
1432
|
}
|
|
1433
|
+
return presentHistory(await matchScanPair(args.beforeId, args.afterId, options.force), "compare", format);
|
|
1370
1434
|
},
|
|
1371
1435
|
})
|
|
1372
1436
|
.command("compare", {
|
|
@@ -1430,6 +1494,10 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
1430
1494
|
.describe("Completed scan directory; omit to select a saved scan."),
|
|
1431
1495
|
}),
|
|
1432
1496
|
options: PUBLICATION_DESTINATION_OPTIONS.extend({
|
|
1497
|
+
findingId: z
|
|
1498
|
+
.array(optionValue("--finding-id"))
|
|
1499
|
+
.default([])
|
|
1500
|
+
.describe("Publish only this finding ID; repeat to select deduplicated findings (Linear only)."),
|
|
1433
1501
|
workflowId: optionValue("--workflow-id")
|
|
1434
1502
|
.optional()
|
|
1435
1503
|
.describe("Resume the named local scan, custom publication, and dedupe workflow."),
|
|
@@ -1517,6 +1585,9 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
1517
1585
|
};
|
|
1518
1586
|
try {
|
|
1519
1587
|
const currentDirectory = dependencies.currentDirectory();
|
|
1588
|
+
if (options.findingId.length > 0 && options.to !== "linear") {
|
|
1589
|
+
throw new CodexSecurityError("--finding-id is only supported with --to linear.");
|
|
1590
|
+
}
|
|
1520
1591
|
const csvPath = options.csv === undefined
|
|
1521
1592
|
? undefined
|
|
1522
1593
|
: resolveCliPath(currentDirectory, options.csv);
|
|
@@ -1826,6 +1897,9 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
1826
1897
|
try {
|
|
1827
1898
|
result = await (dependencies.publishScan ?? publishScan)(resolveCliPath(currentDirectory, scanDir), {
|
|
1828
1899
|
...destination,
|
|
1900
|
+
...(options.findingId.length === 0
|
|
1901
|
+
? {}
|
|
1902
|
+
: { findingIds: options.findingId }),
|
|
1829
1903
|
...(selectedScans[0]?.scanId === undefined
|
|
1830
1904
|
? {}
|
|
1831
1905
|
: { expectedScanId: selectedScans[0].scanId }),
|
|
@@ -2084,7 +2158,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
2084
2158
|
.number()
|
|
2085
2159
|
.positive()
|
|
2086
2160
|
.optional()
|
|
2087
|
-
.describe("Stop
|
|
2161
|
+
.describe("Stop above AMOUNT in estimated USD; the dashboard offers increases near the limit."),
|
|
2088
2162
|
headless: z
|
|
2089
2163
|
.boolean()
|
|
2090
2164
|
.default(false)
|
|
@@ -2093,6 +2167,10 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
2093
2167
|
.boolean()
|
|
2094
2168
|
.default(false)
|
|
2095
2169
|
.describe("Validate local scan inputs without starting a scan."),
|
|
2170
|
+
mock: z
|
|
2171
|
+
.boolean()
|
|
2172
|
+
.default(false)
|
|
2173
|
+
.describe("Save synthetic Standard scan findings without calling an LLM."),
|
|
2096
2174
|
})
|
|
2097
2175
|
.refine((options) => Number(options.path.length > 0) +
|
|
2098
2176
|
Number(options.diff !== undefined) +
|
|
@@ -2113,6 +2191,9 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
2113
2191
|
})
|
|
2114
2192
|
.refine((options) => !options.patch || !options.dryRun, {
|
|
2115
2193
|
message: "--patch cannot be combined with --dry-run.",
|
|
2194
|
+
})
|
|
2195
|
+
.refine((options) => !options.mock || (!options.dryRun && !options.patch), {
|
|
2196
|
+
message: "--mock cannot be combined with --dry-run or --patch.",
|
|
2116
2197
|
})
|
|
2117
2198
|
.refine((options) => options.mode === "deep" ||
|
|
2118
2199
|
(options.workers === undefined &&
|
|
@@ -2181,6 +2262,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
2181
2262
|
maxCostUsd: options.maxCost,
|
|
2182
2263
|
headless: options.headless,
|
|
2183
2264
|
dryRun: options.dryRun,
|
|
2265
|
+
mock: options.mock,
|
|
2184
2266
|
}, errorOutput, dependencies, format !== "json" && format !== "jsonl");
|
|
2185
2267
|
exitCode = outcome.exitCode;
|
|
2186
2268
|
if (outcome.error !== undefined) {
|
|
@@ -2266,6 +2348,82 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
2266
2348
|
.command(scanHistory)
|
|
2267
2349
|
.command(findingFeedback)
|
|
2268
2350
|
.command(publication)
|
|
2351
|
+
.command("classify-severity", {
|
|
2352
|
+
description: "Classify saved findings using an optional rubric and save a separate severity assessment.",
|
|
2353
|
+
destructive: true,
|
|
2354
|
+
mcp: false,
|
|
2355
|
+
options: z.object({
|
|
2356
|
+
reprocess: z
|
|
2357
|
+
.boolean()
|
|
2358
|
+
.default(false)
|
|
2359
|
+
.describe("Reclassify selected findings even when a matching assessment is saved."),
|
|
2360
|
+
scan: optionValue("--scan")
|
|
2361
|
+
.optional()
|
|
2362
|
+
.describe("Saved scan ID, unique prefix, or latest."),
|
|
2363
|
+
scanDir: optionValue("--scan-dir")
|
|
2364
|
+
.optional()
|
|
2365
|
+
.describe("External completed scan directory."),
|
|
2366
|
+
rubric: optionValue("--rubric")
|
|
2367
|
+
.optional()
|
|
2368
|
+
.describe("Classification policy document; omit to inherit existing severity without a model call."),
|
|
2369
|
+
knowledgeBase: z
|
|
2370
|
+
.array(optionValue("--knowledge-base"))
|
|
2371
|
+
.default([])
|
|
2372
|
+
.describe("Supporting security context; repeat for more files or directories."),
|
|
2373
|
+
findingId: z
|
|
2374
|
+
.array(optionValue("--finding-id"))
|
|
2375
|
+
.default([])
|
|
2376
|
+
.describe("Classify only this finding ID; repeat to select deduplicated findings."),
|
|
2377
|
+
model: optionValue("--model")
|
|
2378
|
+
.optional()
|
|
2379
|
+
.describe("Model for rubric classification."),
|
|
2380
|
+
effort: effortOption().describe("Classification reasoning effort (default: medium)."),
|
|
2381
|
+
}),
|
|
2382
|
+
output: z.record(z.string(), z.unknown()).optional(),
|
|
2383
|
+
async run({ options }) {
|
|
2384
|
+
const controller = new AbortController();
|
|
2385
|
+
const onInterrupt = () => controller.abort("SIGINT");
|
|
2386
|
+
const onTerminate = () => controller.abort("SIGTERM");
|
|
2387
|
+
dependencies.addSignalListener("SIGINT", onInterrupt);
|
|
2388
|
+
dependencies.addSignalListener("SIGTERM", onTerminate);
|
|
2389
|
+
try {
|
|
2390
|
+
if ((options.scan === undefined) ===
|
|
2391
|
+
(options.scanDir === undefined)) {
|
|
2392
|
+
throw new CodexSecurityError("Severity classification requires exactly one of --scan or --scan-dir.");
|
|
2393
|
+
}
|
|
2394
|
+
const currentDirectory = dependencies.currentDirectory();
|
|
2395
|
+
const settings = {
|
|
2396
|
+
environment: dependencies.environment,
|
|
2397
|
+
workingDirectory: currentDirectory,
|
|
2398
|
+
signal: controller.signal,
|
|
2399
|
+
rubricPath: options.rubric === undefined
|
|
2400
|
+
? undefined
|
|
2401
|
+
: resolveCliPath(currentDirectory, options.rubric),
|
|
2402
|
+
knowledgeBasePaths: options.knowledgeBase.map((path) => resolveCliPath(currentDirectory, path)),
|
|
2403
|
+
findingIds: options.findingId.length === 0 ? undefined : options.findingId,
|
|
2404
|
+
reprocess: options.reprocess,
|
|
2405
|
+
model: options.model,
|
|
2406
|
+
reasoningEffort: options.effort,
|
|
2407
|
+
};
|
|
2408
|
+
const result = options.scan !== undefined
|
|
2409
|
+
? await (dependencies.classifyScanSeverity ??
|
|
2410
|
+
classifyScanSeverityInternal)(options.scan, settings, dependencies, "cli")
|
|
2411
|
+
: await (dependencies.classifyScanDirectorySeverity ??
|
|
2412
|
+
classifyScanDirectorySeverityInternal)(resolveCliPath(currentDirectory, options.scanDir), settings, "cli");
|
|
2413
|
+
return { ...result };
|
|
2414
|
+
}
|
|
2415
|
+
catch (error) {
|
|
2416
|
+
const signal = controller.signal.reason;
|
|
2417
|
+
errorOutput.write(`codex-security: ${signal === "SIGINT" || signal === "SIGTERM" ? "Severity classification canceled." : safeErrorMessage(error)}\n`);
|
|
2418
|
+
exitCode = signal === "SIGINT" ? 130 : signal === "SIGTERM" ? 143 : 2;
|
|
2419
|
+
return undefined;
|
|
2420
|
+
}
|
|
2421
|
+
finally {
|
|
2422
|
+
dependencies.removeSignalListener("SIGINT", onInterrupt);
|
|
2423
|
+
dependencies.removeSignalListener("SIGTERM", onTerminate);
|
|
2424
|
+
}
|
|
2425
|
+
},
|
|
2426
|
+
})
|
|
2269
2427
|
.command("dedupe", {
|
|
2270
2428
|
description: "Review a saved scan with local Codex and save duplicate groups to the findings API.",
|
|
2271
2429
|
destructive: true,
|
|
@@ -2420,6 +2578,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
2420
2578
|
async run({ args, options }) {
|
|
2421
2579
|
const controller = new AbortController();
|
|
2422
2580
|
let dashboard = null;
|
|
2581
|
+
const componentNames = new Map();
|
|
2423
2582
|
const stopDashboard = () => {
|
|
2424
2583
|
try {
|
|
2425
2584
|
dashboard?.stop();
|
|
@@ -2492,9 +2651,19 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
2492
2651
|
createSecurity: dependencies.createSecurity,
|
|
2493
2652
|
planComponents: dependencies.planComponents,
|
|
2494
2653
|
matchFindings: dependencies.matchFindings,
|
|
2495
|
-
onPlan: (components) =>
|
|
2654
|
+
onPlan: (components) => {
|
|
2655
|
+
for (const component of components)
|
|
2656
|
+
componentNames.set(component.id, component.name);
|
|
2657
|
+
dashboard?.setComponents(components);
|
|
2658
|
+
},
|
|
2496
2659
|
onScanEvent: dashboard === null
|
|
2497
|
-
?
|
|
2660
|
+
? (event) => {
|
|
2661
|
+
const componentName = componentNames.get(event.componentId) ??
|
|
2662
|
+
event.componentId;
|
|
2663
|
+
const line = componentScanEventLine(componentName, event);
|
|
2664
|
+
if (line !== null)
|
|
2665
|
+
errorOutput.write(line);
|
|
2666
|
+
}
|
|
2498
2667
|
: (event) => dashboard?.recordComponentEvent(event),
|
|
2499
2668
|
onDeduplicationStarted: () => {
|
|
2500
2669
|
if (dashboard !== null)
|
|
@@ -2764,7 +2933,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
2764
2933
|
codex: z
|
|
2765
2934
|
.array(optionValue("--codex"))
|
|
2766
2935
|
.default([])
|
|
2767
|
-
.describe('Repeat TOML model="gpt-5.6-terra"
|
|
2936
|
+
.describe('Repeat TOML model="gpt-5.6-terra", model_reasoning_effort="high", or analytics.enabled=false.'),
|
|
2768
2937
|
}),
|
|
2769
2938
|
async run({ options }) {
|
|
2770
2939
|
try {
|
|
@@ -2810,7 +2979,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
2810
2979
|
codex: z
|
|
2811
2980
|
.array(optionValue("--codex"))
|
|
2812
2981
|
.default([])
|
|
2813
|
-
.describe('Repeat TOML model="gpt-5.6-terra"
|
|
2982
|
+
.describe('Repeat TOML model="gpt-5.6-terra", model_reasoning_effort="high", or analytics.enabled=false.'),
|
|
2814
2983
|
}),
|
|
2815
2984
|
output: z.record(z.string(), z.unknown()).optional(),
|
|
2816
2985
|
async run({ format, options }) {
|
|
@@ -2973,7 +3142,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
2973
3142
|
codex: z
|
|
2974
3143
|
.array(optionValue("--codex"))
|
|
2975
3144
|
.default([])
|
|
2976
|
-
.describe('Repeat TOML model="gpt-5.6-terra"
|
|
3145
|
+
.describe('Repeat TOML model="gpt-5.6-terra", model_reasoning_effort="high", or analytics.enabled=false.'),
|
|
2977
3146
|
}),
|
|
2978
3147
|
output: z.record(z.string(), z.unknown()).optional(),
|
|
2979
3148
|
async run({ format, options }) {
|
|
@@ -3128,6 +3297,11 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
3128
3297
|
const credentialHome = dependencies.prepareAuthenticationHome !== undefined
|
|
3129
3298
|
? await dependencies.prepareAuthenticationHome(dependencies.environment)
|
|
3130
3299
|
: await prepareCodexSecurityCredentialHome(dependencies.environment);
|
|
3300
|
+
if (args.action === "status" && existsSync(credentialHome)) {
|
|
3301
|
+
const ambientHome = environmentValue(dependencies.environment, "CODEX_HOME") ??
|
|
3302
|
+
join(homedir(), ".codex");
|
|
3303
|
+
await initialCredentialsAvailable(dependencies.environment, ambientHome, credentialHome);
|
|
3304
|
+
}
|
|
3131
3305
|
const authenticationEnvironment = {
|
|
3132
3306
|
...dependencies.environment,
|
|
3133
3307
|
CODEX_HOME: credentialHome,
|
|
@@ -3150,7 +3324,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
3150
3324
|
(exitCode === 0 || exitCode === 1)) {
|
|
3151
3325
|
exitCode = 0;
|
|
3152
3326
|
errorOutput.write(`Effective scan authentication: API key from ${authentication.source}.\n`);
|
|
3153
|
-
errorOutput.write(
|
|
3327
|
+
errorOutput.write(`To use a ChatGPT sign-in, ${formatEnvironmentVariableRemovalGuidance(["OPENAI_API_KEY", "CODEX_API_KEY"])}.\n`);
|
|
3154
3328
|
}
|
|
3155
3329
|
}
|
|
3156
3330
|
else if (exitCode === 0 && !options.withApiKey) {
|
|
@@ -3169,8 +3343,8 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
3169
3343
|
? "your stored credentials"
|
|
3170
3344
|
: "your ChatGPT sign-in";
|
|
3171
3345
|
errorOutput.write(loginWarning +
|
|
3172
|
-
`To use ${storedCredentials}, pass '--auth chatgpt' or
|
|
3173
|
-
|
|
3346
|
+
`To use ${storedCredentials}, pass '--auth chatgpt' or ` +
|
|
3347
|
+
`${formatEnvironmentVariableRemovalGuidance(configuredApiKeyVariables)}.\n`);
|
|
3174
3348
|
}
|
|
3175
3349
|
}
|
|
3176
3350
|
},
|
|
@@ -3195,7 +3369,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
3195
3369
|
},
|
|
3196
3370
|
})
|
|
3197
3371
|
.command("serve", {
|
|
3198
|
-
description: "Start the findings HTTP service (HOST=127.0.0.1, PORT=3000).",
|
|
3372
|
+
description: "Start the findings HTTP service (HOST=127.0.0.1, PORT=3000). CODEX_SECURITY_EMBEDDINGS_URL overrides the embeddings endpoint (default: https://api.openai.com/v1/embeddings).",
|
|
3199
3373
|
destructive: true,
|
|
3200
3374
|
mcp: false,
|
|
3201
3375
|
options: z.object({
|
|
@@ -3410,6 +3584,7 @@ function scanArgumentsFromRecipe(recipe, parentScanId, validationPromptFile) {
|
|
|
3410
3584
|
maxCostUsd,
|
|
3411
3585
|
dryRun: false,
|
|
3412
3586
|
parentScanId,
|
|
3587
|
+
...(recipe["mock"] === true ? { mock: true } : {}),
|
|
3413
3588
|
expectedPluginVersion: typeof recipe["pluginVersion"] === "string"
|
|
3414
3589
|
? recipe["pluginVersion"]
|
|
3415
3590
|
: undefined,
|
|
@@ -3539,37 +3714,43 @@ function validateCliArguments(argv, positionals) {
|
|
|
3539
3714
|
return `Unexpected positional argument for ${command}${subcommand === undefined ? "" : ` ${subcommand}`}.`;
|
|
3540
3715
|
}
|
|
3541
3716
|
}
|
|
3542
|
-
async function matchAllScans(dependencies, force) {
|
|
3717
|
+
async function matchAllScans(dependencies, force, options = {}) {
|
|
3543
3718
|
const result = (await dependencies.runWorkbench([
|
|
3544
3719
|
"list-unmatched-scan-pairs",
|
|
3545
3720
|
"--repository",
|
|
3546
3721
|
dependencies.currentDirectory(),
|
|
3547
3722
|
...(force ? ["--force"] : []),
|
|
3548
|
-
]));
|
|
3723
|
+
], undefined, options.signal));
|
|
3549
3724
|
const { repository, scanCount, unavailableScans, skippedPairs, batches } = result;
|
|
3550
3725
|
let matchedPairs = 0;
|
|
3551
3726
|
let findingMatches = 0;
|
|
3552
|
-
|
|
3727
|
+
let relatedPairs = 0;
|
|
3728
|
+
let uncertainPairs = 0;
|
|
3729
|
+
const newlyMatchedGroups = [];
|
|
3730
|
+
for (const { afterScanId, afterFindings, beforeScans, knownFindingGroups = [], } of batches) {
|
|
3731
|
+
options.signal?.throwIfAborted();
|
|
3553
3732
|
const before = beforeScans.flatMap(({ findings }) => findings);
|
|
3733
|
+
const knownGroups = unionFindingGroups([
|
|
3734
|
+
...knownFindingGroups,
|
|
3735
|
+
...newlyMatchedGroups,
|
|
3736
|
+
]);
|
|
3737
|
+
const input = {
|
|
3738
|
+
before,
|
|
3739
|
+
after: afterFindings,
|
|
3740
|
+
...(knownGroups.length === 0 ? {} : { knownFindingGroups: knownGroups }),
|
|
3741
|
+
};
|
|
3554
3742
|
const matching = before.length === 0 || afterFindings.length === 0
|
|
3555
3743
|
? { matches: [], uncertain: [] }
|
|
3556
|
-
: await dependencies.matchFindings(
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
const matches = matching.matches.flatMap((match) => {
|
|
3560
|
-
const beforeOccurrenceIds = match.beforeOccurrenceIds.filter((id) => beforeIds.has(id));
|
|
3561
|
-
return beforeOccurrenceIds.length === 0
|
|
3562
|
-
? []
|
|
3563
|
-
: [{ ...match, beforeOccurrenceIds }];
|
|
3744
|
+
: await dependencies.matchFindings(input, {
|
|
3745
|
+
...options,
|
|
3746
|
+
allowHistoricalUncertainty: true,
|
|
3564
3747
|
});
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
});
|
|
3572
|
-
for (const { scanId, matches, uncertain } of comparisons) {
|
|
3748
|
+
const comparisons = beforeScans.map(({ scanId, findings }) => ({
|
|
3749
|
+
scanId,
|
|
3750
|
+
comparison: comparisonForScan(matching, findings),
|
|
3751
|
+
}));
|
|
3752
|
+
for (const { scanId, comparison } of comparisons) {
|
|
3753
|
+
options.signal?.throwIfAborted();
|
|
3573
3754
|
await dependencies.runWorkbench([
|
|
3574
3755
|
"save-scan-comparison",
|
|
3575
3756
|
"--before-scan-id",
|
|
@@ -3577,10 +3758,13 @@ async function matchAllScans(dependencies, force) {
|
|
|
3577
3758
|
"--after-scan-id",
|
|
3578
3759
|
afterScanId,
|
|
3579
3760
|
"--matches-json-stdin",
|
|
3580
|
-
], JSON.stringify(
|
|
3761
|
+
], JSON.stringify(comparison), options.signal);
|
|
3581
3762
|
matchedPairs += 1;
|
|
3582
|
-
findingMatches += matches.reduce((count, { beforeOccurrenceIds, afterOccurrenceIds }) => count + beforeOccurrenceIds.length * afterOccurrenceIds.length, 0);
|
|
3763
|
+
findingMatches += comparison.matches.reduce((count, { beforeOccurrenceIds, afterOccurrenceIds }) => count + beforeOccurrenceIds.length * afterOccurrenceIds.length, 0);
|
|
3764
|
+
relatedPairs += comparison.related?.length ?? 0;
|
|
3765
|
+
uncertainPairs += comparison.uncertain.length;
|
|
3583
3766
|
}
|
|
3767
|
+
newlyMatchedGroups.push(...comparisonFindingGroups(input, matching));
|
|
3584
3768
|
}
|
|
3585
3769
|
return {
|
|
3586
3770
|
repository,
|
|
@@ -3589,6 +3773,8 @@ async function matchAllScans(dependencies, force) {
|
|
|
3589
3773
|
matchedPairs,
|
|
3590
3774
|
skippedPairs,
|
|
3591
3775
|
findingMatches,
|
|
3776
|
+
relatedPairs,
|
|
3777
|
+
uncertainPairs,
|
|
3592
3778
|
};
|
|
3593
3779
|
}
|
|
3594
3780
|
function staysWithinWindowsDeviceRoot(input, root) {
|
|
@@ -3748,33 +3934,75 @@ function directPatchDigest(positionals, imports) {
|
|
|
3748
3934
|
async function publishPatchBranch(repository, branch, body, stderr, dependencies) {
|
|
3749
3935
|
const run = (command, args) => dependencies.runRepositoryCommand(command, args, repository);
|
|
3750
3936
|
try {
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
"
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3937
|
+
const remote = await run("git", ["remote", "get-url", "--push", "origin"]);
|
|
3938
|
+
const host = patchRemoteHost(remote);
|
|
3939
|
+
const gitlabHost = dependencies.environment["GITLAB_HOST"] ||
|
|
3940
|
+
dependencies.environment["GITLAB_URI"] ||
|
|
3941
|
+
dependencies.environment["GL_HOST"];
|
|
3942
|
+
const gitlab = host === "gitlab.com" ||
|
|
3943
|
+
(host !== undefined &&
|
|
3944
|
+
gitlabHost !== undefined &&
|
|
3945
|
+
host ===
|
|
3946
|
+
patchRemoteHost(gitlabHost.includes("://") ? gitlabHost : `https://${gitlabHost}`));
|
|
3947
|
+
const command = gitlab ? "glab" : "gh";
|
|
3948
|
+
let url = await run(command, gitlab
|
|
3949
|
+
? [
|
|
3950
|
+
"mr",
|
|
3951
|
+
"list",
|
|
3952
|
+
"--all",
|
|
3953
|
+
"--source-branch",
|
|
3954
|
+
branch,
|
|
3955
|
+
"--output",
|
|
3956
|
+
"json",
|
|
3957
|
+
"--jq",
|
|
3958
|
+
".[0].web_url // empty",
|
|
3959
|
+
"--repo",
|
|
3960
|
+
remote,
|
|
3961
|
+
]
|
|
3962
|
+
: [
|
|
3766
3963
|
"pr",
|
|
3767
|
-
"
|
|
3768
|
-
"--draft",
|
|
3964
|
+
"list",
|
|
3769
3965
|
"--head",
|
|
3770
3966
|
branch,
|
|
3771
|
-
"--
|
|
3772
|
-
|
|
3773
|
-
"--
|
|
3774
|
-
|
|
3967
|
+
"--state",
|
|
3968
|
+
"all",
|
|
3969
|
+
"--json",
|
|
3970
|
+
"url",
|
|
3971
|
+
"--jq",
|
|
3972
|
+
".[0].url // empty",
|
|
3775
3973
|
]);
|
|
3974
|
+
if (!url) {
|
|
3975
|
+
await run("git", ["push", "--set-upstream", "origin", branch]);
|
|
3976
|
+
url = await run(command, gitlab
|
|
3977
|
+
? [
|
|
3978
|
+
"mr",
|
|
3979
|
+
"create",
|
|
3980
|
+
"--draft",
|
|
3981
|
+
"--head",
|
|
3982
|
+
remote,
|
|
3983
|
+
"--source-branch",
|
|
3984
|
+
branch,
|
|
3985
|
+
"--title",
|
|
3986
|
+
PATCH_PR_TITLE,
|
|
3987
|
+
"--description",
|
|
3988
|
+
body,
|
|
3989
|
+
"--yes",
|
|
3990
|
+
"--repo",
|
|
3991
|
+
remote,
|
|
3992
|
+
]
|
|
3993
|
+
: [
|
|
3994
|
+
"pr",
|
|
3995
|
+
"create",
|
|
3996
|
+
"--draft",
|
|
3997
|
+
"--head",
|
|
3998
|
+
branch,
|
|
3999
|
+
"--title",
|
|
4000
|
+
PATCH_PR_TITLE,
|
|
4001
|
+
"--body",
|
|
4002
|
+
body,
|
|
4003
|
+
]);
|
|
3776
4004
|
}
|
|
3777
|
-
stderr.write(
|
|
4005
|
+
stderr.write(`${gitlab ? "Merge" : "Pull"} request: ${safePatchText(url)}\n`);
|
|
3778
4006
|
return { branch, url };
|
|
3779
4007
|
}
|
|
3780
4008
|
catch (error) {
|
|
@@ -3782,6 +4010,11 @@ async function publishPatchBranch(repository, branch, body, stderr, dependencies
|
|
|
3782
4010
|
throw error;
|
|
3783
4011
|
}
|
|
3784
4012
|
}
|
|
4013
|
+
function patchRemoteHost(remote) {
|
|
4014
|
+
if (remote.includes("://"))
|
|
4015
|
+
return new URL(remote).hostname.toLowerCase();
|
|
4016
|
+
return /^(?:[^@/]+@)?([^:/]+):[^/]/u.exec(remote)?.[1]?.toLowerCase();
|
|
4017
|
+
}
|
|
3785
4018
|
async function resumePatchPullRequest(repository, branch, stderr, dependencies) {
|
|
3786
4019
|
const run = (args) => dependencies.runRepositoryCommand("git", args, repository);
|
|
3787
4020
|
const commit = await run([
|
|
@@ -3827,11 +4060,11 @@ async function createPatchPullRequest(repository, patchId, files, stderr, depend
|
|
|
3827
4060
|
}
|
|
3828
4061
|
const branch = `codex-security/patch-${patchId.replaceAll(/[^a-z\d._-]/giu, "-")}`;
|
|
3829
4062
|
const body = patchPullRequestBody(patchRiskSummary, introduction);
|
|
3830
|
-
const run = (
|
|
3831
|
-
stderr.write("Creating a draft
|
|
3832
|
-
await run(
|
|
3833
|
-
await run(
|
|
3834
|
-
await run(
|
|
4063
|
+
const run = (args) => dependencies.runRepositoryCommand("git", args, repository);
|
|
4064
|
+
stderr.write("Creating a draft pull request or merge request for verified patches...\n");
|
|
4065
|
+
await run(["switch", "-c", branch]);
|
|
4066
|
+
await run(["--literal-pathspecs", "add", "--", ...files]);
|
|
4067
|
+
await run([
|
|
3835
4068
|
"--literal-pathspecs",
|
|
3836
4069
|
"commit",
|
|
3837
4070
|
"--only",
|
|
@@ -3840,14 +4073,9 @@ async function createPatchPullRequest(repository, patchId, files, stderr, depend
|
|
|
3840
4073
|
"--",
|
|
3841
4074
|
...files,
|
|
3842
4075
|
]);
|
|
3843
|
-
const commit = await run(
|
|
3844
|
-
await run(
|
|
3845
|
-
await run("
|
|
3846
|
-
"config",
|
|
3847
|
-
"--local",
|
|
3848
|
-
patchPullRequestBodyKey(branch),
|
|
3849
|
-
body,
|
|
3850
|
-
]);
|
|
4076
|
+
const commit = await run(["rev-parse", "HEAD"]);
|
|
4077
|
+
await run(["config", "--local", patchCommitKey(branch), commit]);
|
|
4078
|
+
await run(["config", "--local", patchPullRequestBodyKey(branch), body]);
|
|
3851
4079
|
return publishPatchBranch(repository, branch, body, stderr, dependencies);
|
|
3852
4080
|
}
|
|
3853
4081
|
async function requireCleanPatchPullRequestBase(repository, base, dependencies) {
|
|
@@ -4052,8 +4280,12 @@ async function runFindingPatches(selected, codexOverrides, effort, stderr, depen
|
|
|
4052
4280
|
}
|
|
4053
4281
|
async function runSkill(skill, inputs, codexOverrides, effort, stdout, stderr, dependencies, options = {}) {
|
|
4054
4282
|
const overrides = parseCodexOverrides(codexOverrides, undefined, effort);
|
|
4055
|
-
if (Object.
|
|
4056
|
-
|
|
4283
|
+
if (Object.entries(overrides).some(([key, value]) => key !== "model" &&
|
|
4284
|
+
key !== "model_reasoning_effort" &&
|
|
4285
|
+
!(key === "analytics" &&
|
|
4286
|
+
isJsonObject(value) &&
|
|
4287
|
+
Object.keys(value).every((key) => key === "enabled")))) {
|
|
4288
|
+
throw new CodexSecurityError("Skill commands only support model, model_reasoning_effort, and analytics.enabled overrides.");
|
|
4057
4289
|
}
|
|
4058
4290
|
const { model, reasoningEffort } = scanModelConfiguration(await mergedCodexConfig({ codexOverrides: overrides }));
|
|
4059
4291
|
const directory = options.directory ?? dependencies.currentDirectory();
|
|
@@ -4173,6 +4405,9 @@ async function runSkill(skill, inputs, codexOverrides, effort, stdout, stderr, d
|
|
|
4173
4405
|
`model=${JSON.stringify(model)}`,
|
|
4174
4406
|
"--config",
|
|
4175
4407
|
`model_reasoning_effort=${JSON.stringify(reasoningEffort)}`,
|
|
4408
|
+
...codexOverrides
|
|
4409
|
+
.filter((value) => value.startsWith("analytics.") || value.startsWith("analytics="))
|
|
4410
|
+
.flatMap((value) => ["--config", value]),
|
|
4176
4411
|
...(options.provider === undefined
|
|
4177
4412
|
? []
|
|
4178
4413
|
: ["--config", `model_provider=${JSON.stringify(options.provider)}`]),
|
|
@@ -4597,6 +4832,7 @@ async function withTerminalErrorsHandled(errorOutput, operation) {
|
|
|
4597
4832
|
}
|
|
4598
4833
|
async function executeScan(arguments_, errorOutput, dependencies, interactive = true) {
|
|
4599
4834
|
let scanDir = null;
|
|
4835
|
+
const scanInput = dependencies.scanInput ?? process.stdin;
|
|
4600
4836
|
let requestedSignal = null;
|
|
4601
4837
|
let firstSignalAt = 0;
|
|
4602
4838
|
let progress = null;
|
|
@@ -4606,6 +4842,7 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
|
|
|
4606
4842
|
let workerCapacity = null;
|
|
4607
4843
|
let fileProgress = null;
|
|
4608
4844
|
let runningCost = null;
|
|
4845
|
+
let maxCostUsd = arguments_.maxCostUsd;
|
|
4609
4846
|
let phase = null;
|
|
4610
4847
|
const targetWarnings = [];
|
|
4611
4848
|
const configuredLogLevel = dependencies.environment["CODEX_SECURITY_LOG_LEVEL"]?.trim() ||
|
|
@@ -4647,7 +4884,7 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
|
|
|
4647
4884
|
// Launchers and terminals can deliver the same initial signal twice.
|
|
4648
4885
|
// A later repeated signal intentionally restores the conventional escape hatch.
|
|
4649
4886
|
if (signal === requestedSignal &&
|
|
4650
|
-
dependencies.now() - firstSignalAt <
|
|
4887
|
+
dependencies.now() - firstSignalAt < DUPLICATE_SIGNAL_WINDOW_MS) {
|
|
4651
4888
|
return;
|
|
4652
4889
|
}
|
|
4653
4890
|
requestedSignal = signal;
|
|
@@ -4682,6 +4919,7 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
|
|
|
4682
4919
|
let effectiveModel = DEFAULT_SCAN_MODEL_CONFIGURATION.model;
|
|
4683
4920
|
let effectiveReasoningEffort = DEFAULT_SCAN_MODEL_CONFIGURATION.reasoningEffort;
|
|
4684
4921
|
let providerOptions = {};
|
|
4922
|
+
let patchAnalyticsOverride;
|
|
4685
4923
|
let selectedAuthentication = null;
|
|
4686
4924
|
let repository = "";
|
|
4687
4925
|
let failed = false;
|
|
@@ -4705,7 +4943,13 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
|
|
|
4705
4943
|
({ model: effectiveModel, reasoningEffort: effectiveReasoningEffort } =
|
|
4706
4944
|
scanModelConfiguration(effectiveConfiguration));
|
|
4707
4945
|
const provider = scanModelProvider(effectiveConfiguration);
|
|
4708
|
-
const
|
|
4946
|
+
const analytics = effectiveConfiguration["analytics"];
|
|
4947
|
+
if (analytics !== undefined &&
|
|
4948
|
+
isJsonObject(analytics) &&
|
|
4949
|
+
analytics["enabled"] !== undefined) {
|
|
4950
|
+
patchAnalyticsOverride = `analytics.enabled=${JSON.stringify(analytics["enabled"])}`;
|
|
4951
|
+
}
|
|
4952
|
+
const auth = !arguments_.dryRun && !arguments_.mock && interactive
|
|
4709
4953
|
? await chooseInteractiveAuthentication({
|
|
4710
4954
|
auth: arguments_.auth,
|
|
4711
4955
|
provider,
|
|
@@ -4719,7 +4963,9 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
|
|
|
4719
4963
|
providerConfiguration: effectiveConfiguration["model_providers"]?.[provider],
|
|
4720
4964
|
};
|
|
4721
4965
|
}
|
|
4722
|
-
selectedAuthentication =
|
|
4966
|
+
selectedAuthentication = arguments_.mock
|
|
4967
|
+
? null
|
|
4968
|
+
: scanAuthentication(dependencies.environment, auth, provider);
|
|
4723
4969
|
diagnostic("scan.configuration", {
|
|
4724
4970
|
cli_version: VERSION,
|
|
4725
4971
|
bundled_plugin_version: BUNDLED_PLUGIN_VERSION,
|
|
@@ -4736,6 +4982,7 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
|
|
|
4736
4982
|
: "repository",
|
|
4737
4983
|
requested_auth: auth ?? "auto",
|
|
4738
4984
|
dry_run: arguments_.dryRun,
|
|
4985
|
+
mock: arguments_.mock,
|
|
4739
4986
|
profile: typeof selectedProfileName === "string"
|
|
4740
4987
|
? selectedProfileName
|
|
4741
4988
|
: undefined,
|
|
@@ -4757,7 +5004,7 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
|
|
|
4757
5004
|
clock: dependencies,
|
|
4758
5005
|
color: dependencies.environment["NO_COLOR"] === undefined,
|
|
4759
5006
|
sanitize: safeErrorMessage,
|
|
4760
|
-
input:
|
|
5007
|
+
input: scanInput,
|
|
4761
5008
|
onInterrupt,
|
|
4762
5009
|
});
|
|
4763
5010
|
}
|
|
@@ -4801,7 +5048,11 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
|
|
|
4801
5048
|
}
|
|
4802
5049
|
}
|
|
4803
5050
|
security = dependencies.createSecurity(config);
|
|
5051
|
+
if (arguments_.mock) {
|
|
5052
|
+
errorOutput.write("codex-security: Mock scan: generating synthetic findings; no security analysis or LLM calls.\n");
|
|
5053
|
+
}
|
|
4804
5054
|
const options = {
|
|
5055
|
+
...(arguments_.mock ? { mock: true } : {}),
|
|
4805
5056
|
...(arguments_.workflowId === undefined
|
|
4806
5057
|
? {}
|
|
4807
5058
|
: { workflowId: arguments_.workflowId }),
|
|
@@ -4822,7 +5073,11 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
|
|
|
4822
5073
|
expectedPluginVersion: arguments_.expectedPluginVersion,
|
|
4823
5074
|
failureSeverity: arguments_.failOnSeverity,
|
|
4824
5075
|
maxCostUsd: arguments_.maxCostUsd,
|
|
4825
|
-
onCost: (cost) => {
|
|
5076
|
+
onCost: (cost, limit = maxCostUsd) => {
|
|
5077
|
+
if (limit !== maxCostUsd && limit !== undefined) {
|
|
5078
|
+
dashboard?.note(`Total cost limit increased to ${formatUsd(limit)}.`);
|
|
5079
|
+
}
|
|
5080
|
+
maxCostUsd = limit;
|
|
4826
5081
|
diagnostic("cost.updated", {
|
|
4827
5082
|
model: cost.model,
|
|
4828
5083
|
estimated_usd: cost.estimatedUsd,
|
|
@@ -4830,15 +5085,15 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
|
|
|
4830
5085
|
cached_input_tokens: cost.cachedInputTokens,
|
|
4831
5086
|
cache_write_input_tokens: cost.cacheWriteInputTokens,
|
|
4832
5087
|
output_tokens: cost.outputTokens,
|
|
4833
|
-
max_cost_usd:
|
|
5088
|
+
max_cost_usd: maxCostUsd,
|
|
4834
5089
|
});
|
|
4835
5090
|
runningCost = cost;
|
|
4836
5091
|
if (dashboard !== null) {
|
|
4837
|
-
dashboard.setCost(cost);
|
|
5092
|
+
dashboard.setCost(cost, maxCostUsd);
|
|
4838
5093
|
return;
|
|
4839
5094
|
}
|
|
4840
5095
|
progress?.stopTimer();
|
|
4841
|
-
if (
|
|
5096
|
+
if (maxCostUsd === undefined) {
|
|
4842
5097
|
const tokens = formatTokenUsage({
|
|
4843
5098
|
input_tokens: cost.inputTokens,
|
|
4844
5099
|
cached_input_tokens: cost.cachedInputTokens,
|
|
@@ -4847,13 +5102,15 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
|
|
|
4847
5102
|
progress?.stage(`${tokens === null ? "" : `Tokens: ${tokens}. `}Estimated cost: ${formatUsd(cost.estimatedUsd)} USD.`);
|
|
4848
5103
|
}
|
|
4849
5104
|
else {
|
|
4850
|
-
progress?.stage(`Estimated cost: ${formatUsd(cost.estimatedUsd)} of ${formatUsd(
|
|
5105
|
+
progress?.stage(`Estimated cost: ${formatUsd(cost.estimatedUsd)} of ${formatUsd(maxCostUsd)} limit`);
|
|
4851
5106
|
}
|
|
4852
|
-
if (
|
|
4853
|
-
cost.estimatedUsd <= arguments_.maxCostUsd) {
|
|
5107
|
+
if (maxCostUsd === undefined || cost.estimatedUsd <= maxCostUsd) {
|
|
4854
5108
|
progress?.startTimer(runningMessage());
|
|
4855
5109
|
}
|
|
4856
5110
|
},
|
|
5111
|
+
onBudgetApproaching: scanInput.isTTY === true
|
|
5112
|
+
? dashboard?.requestBudgetIncrease.bind(dashboard)
|
|
5113
|
+
: undefined,
|
|
4857
5114
|
onOutputArchived: (archiveDir) => {
|
|
4858
5115
|
diagnostic("scan.output_archived", { archive_dir: archiveDir });
|
|
4859
5116
|
if (dashboard !== null) {
|
|
@@ -4873,9 +5130,7 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
|
|
|
4873
5130
|
diagnostic("authentication.selected", {
|
|
4874
5131
|
requested: auth ?? "auto",
|
|
4875
5132
|
method: authentication.method,
|
|
4876
|
-
source: authentication.
|
|
4877
|
-
? authentication.source
|
|
4878
|
-
: undefined,
|
|
5133
|
+
source: "source" in authentication ? authentication.source : undefined,
|
|
4879
5134
|
verified: authentication.verified,
|
|
4880
5135
|
});
|
|
4881
5136
|
if (dashboard !== null) {
|
|
@@ -4883,7 +5138,9 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
|
|
|
4883
5138
|
? `Using API key from ${authentication.source}`
|
|
4884
5139
|
: authentication.method === "aws_credentials"
|
|
4885
5140
|
? `Using AWS credentials from ${authentication.source}`
|
|
4886
|
-
:
|
|
5141
|
+
: authentication.method === "command"
|
|
5142
|
+
? "Using native Codex command authentication"
|
|
5143
|
+
: "Using stored Codex credentials");
|
|
4887
5144
|
return;
|
|
4888
5145
|
}
|
|
4889
5146
|
progress?.stopTimer();
|
|
@@ -4894,6 +5151,9 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
|
|
|
4894
5151
|
else if (authentication.method === "aws_credentials") {
|
|
4895
5152
|
progress?.stage(`Authentication: AWS credentials from ${authentication.source}.`);
|
|
4896
5153
|
}
|
|
5154
|
+
else if (authentication.method === "command") {
|
|
5155
|
+
progress?.stage("Authentication: native Codex command.");
|
|
5156
|
+
}
|
|
4897
5157
|
else {
|
|
4898
5158
|
progress?.stage("Authentication: stored Codex credentials.");
|
|
4899
5159
|
}
|
|
@@ -4947,7 +5207,7 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
|
|
|
4947
5207
|
dashboard.setStage("inspecting repository files");
|
|
4948
5208
|
}
|
|
4949
5209
|
},
|
|
4950
|
-
onSessionEvent:
|
|
5210
|
+
onSessionEvent: scanInput.isTTY === true
|
|
4951
5211
|
? dashboard?.recordDetails.bind(dashboard)
|
|
4952
5212
|
: undefined,
|
|
4953
5213
|
onProgress: (update) => {
|
|
@@ -5110,7 +5370,7 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
|
|
|
5110
5370
|
model: effectivePreflight.model,
|
|
5111
5371
|
reasoning_effort: effectivePreflight.reasoningEffort,
|
|
5112
5372
|
method: effectivePreflight.authentication.method,
|
|
5113
|
-
source: effectivePreflight.authentication
|
|
5373
|
+
source: "source" in effectivePreflight.authentication
|
|
5114
5374
|
? effectivePreflight.authentication.source
|
|
5115
5375
|
: undefined,
|
|
5116
5376
|
verified: effectivePreflight.authentication.verified,
|
|
@@ -5135,7 +5395,7 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
|
|
|
5135
5395
|
const incomplete = result.coverage.completeness !== "complete";
|
|
5136
5396
|
let deepScanStop;
|
|
5137
5397
|
if (arguments_.mode === "deep") {
|
|
5138
|
-
deepScanStop = (await readDeepScanStop(result,
|
|
5398
|
+
deepScanStop = (await readDeepScanStop(result, maxCostUsd, dependencies.runWorkbench).catch(() => undefined)) ?? {
|
|
5139
5399
|
reason: "Stop reason unavailable. See the report for details.",
|
|
5140
5400
|
};
|
|
5141
5401
|
}
|
|
@@ -5168,7 +5428,8 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
|
|
|
5168
5428
|
? arguments_.patchSeverity ?? "low"
|
|
5169
5429
|
: undefined;
|
|
5170
5430
|
let patchSelection = null;
|
|
5171
|
-
if (
|
|
5431
|
+
if (!arguments_.mock &&
|
|
5432
|
+
actionableFindings.length > 0 &&
|
|
5172
5433
|
arguments_.patchSeverity === undefined &&
|
|
5173
5434
|
progress?.interactive === true &&
|
|
5174
5435
|
(dependencies.patchEditor !== undefined || process.stdin.isTTY === true)) {
|
|
@@ -5212,7 +5473,12 @@ async function executeScan(arguments_, errorOutput, dependencies, interactive =
|
|
|
5212
5473
|
environment["CODEX_HOME"] = codexSecurityCredentialHome(dependencies.environment);
|
|
5213
5474
|
}
|
|
5214
5475
|
try {
|
|
5215
|
-
patches = await runFindingPatches(selected, [
|
|
5476
|
+
patches = await runFindingPatches(selected, [
|
|
5477
|
+
`model=${JSON.stringify(effectiveModel)}`,
|
|
5478
|
+
...(patchAnalyticsOverride === undefined
|
|
5479
|
+
? []
|
|
5480
|
+
: [patchAnalyticsOverride]),
|
|
5481
|
+
], effectiveReasoningEffort, errorOutput, dependencies, {
|
|
5216
5482
|
...providerOptions,
|
|
5217
5483
|
safetyIdentifier: arguments_.safetyIdentifier,
|
|
5218
5484
|
environment,
|
|
@@ -5302,6 +5568,9 @@ function scanFailureMessage(error, authentication) {
|
|
|
5302
5568
|
}
|
|
5303
5569
|
switch (classifyConnectionFailure(error)) {
|
|
5304
5570
|
case "unauthorized":
|
|
5571
|
+
if (authentication?.method === "command") {
|
|
5572
|
+
return "Native Codex command authentication failed. Check the configured provider auth command.";
|
|
5573
|
+
}
|
|
5305
5574
|
if (authentication?.method === "aws_credentials") {
|
|
5306
5575
|
return (`Authentication failed using AWS credentials from ${authentication.source}. ` +
|
|
5307
5576
|
"Check your Amazon Bedrock bearer token or AWS credential chain.");
|
|
@@ -5312,6 +5581,9 @@ function scanFailureMessage(error, authentication) {
|
|
|
5312
5581
|
: "Authentication failed using stored ChatGPT credentials. " +
|
|
5313
5582
|
"Sign in again with 'codex-security login' or provide a valid API key.";
|
|
5314
5583
|
case "forbidden":
|
|
5584
|
+
if (authentication?.method === "command") {
|
|
5585
|
+
return "The configured Codex provider denied access. Check the command credentials and provider permissions.";
|
|
5586
|
+
}
|
|
5315
5587
|
if (authentication?.method === "aws_credentials") {
|
|
5316
5588
|
return (`The AWS credentials from ${authentication.source} cannot access the configured Amazon Bedrock model. ` +
|
|
5317
5589
|
"Check your AWS identity and Bedrock model permissions.");
|
|
@@ -5469,6 +5741,21 @@ function formatTokenUsage(usage) {
|
|
|
5469
5741
|
.filter((value) => value !== null)
|
|
5470
5742
|
.join(", ") || null);
|
|
5471
5743
|
}
|
|
5744
|
+
function componentScanEventLine(componentName, event) {
|
|
5745
|
+
if (event.type === "progress") {
|
|
5746
|
+
const progress = event.value;
|
|
5747
|
+
return `codex-security: ${componentName} ${scanPhase(progress.phase)} | Files: ${progress.filesCompleted.toLocaleString("en-US")}/${progress.filesTotal.toLocaleString("en-US")}\n`;
|
|
5748
|
+
}
|
|
5749
|
+
if (event.type !== "cost")
|
|
5750
|
+
return null;
|
|
5751
|
+
const cost = event.value;
|
|
5752
|
+
const tokens = formatTokenUsage({
|
|
5753
|
+
input_tokens: cost.inputTokens,
|
|
5754
|
+
cached_input_tokens: cost.cachedInputTokens,
|
|
5755
|
+
output_tokens: cost.outputTokens,
|
|
5756
|
+
});
|
|
5757
|
+
return `codex-security: ${componentName} | ${tokens === null ? "" : `Tokens: ${tokens} | `}Cost: ${formatUsd(cost.estimatedUsd)}\n`;
|
|
5758
|
+
}
|
|
5472
5759
|
function protectedRootErrorMessage(error) {
|
|
5473
5760
|
const description = error.pathKind === "output"
|
|
5474
5761
|
? "Scan output directory"
|