@openai/codex-security 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -2
- package/_bundled_plugin/mcp/helpers.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/native/win32-arm64/windows.node +0 -0
- package/_bundled_plugin/mcp/native/win32-x64/windows.node +0 -0
- package/_bundled_plugin/scripts/workbench_finding_workflows.py +2 -0
- package/_bundled_plugin/shared/workbench-migrations.json +16 -0
- package/_bundled_plugin/skills/fix-finding/SKILL.md +16 -8
- package/_bundled_plugin/skills/publish-findings/SKILL.md +130 -0
- package/_bundled_plugin/skills/publish-findings/agents/openai.yaml +6 -0
- package/_bundled_plugin/skills/verify-fix/SKILL.md +4 -2
- package/dist/api.d.ts +3 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +76 -38
- package/dist/api.js.map +1 -1
- package/dist/classify-severity-records.d.ts +5 -2
- package/dist/classify-severity-records.d.ts.map +1 -1
- package/dist/classify-severity-records.js +40 -34
- package/dist/classify-severity-records.js.map +1 -1
- package/dist/classify-severity.d.ts +5 -1
- package/dist/classify-severity.d.ts.map +1 -1
- package/dist/classify-severity.js +20 -30
- package/dist/classify-severity.js.map +1 -1
- package/dist/cli-help.d.ts.map +1 -1
- package/dist/cli-help.js +1 -0
- package/dist/cli-help.js.map +1 -1
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +412 -14
- package/dist/cli.js.map +1 -1
- package/dist/cloud-endpoint.d.ts +6 -0
- package/dist/cloud-endpoint.d.ts.map +1 -0
- package/dist/cloud-endpoint.js +51 -0
- package/dist/cloud-endpoint.js.map +1 -0
- package/dist/cloud-publish.d.ts.map +1 -1
- package/dist/cloud-publish.js +7 -5
- package/dist/cloud-publish.js.map +1 -1
- package/dist/default-severity-rubric.d.ts +3 -0
- package/dist/default-severity-rubric.d.ts.map +1 -0
- package/dist/default-severity-rubric.js +67 -0
- package/dist/default-severity-rubric.js.map +1 -0
- package/dist/endor-findings.d.ts +7 -0
- package/dist/endor-findings.d.ts.map +1 -0
- package/dist/endor-findings.js +233 -0
- package/dist/endor-findings.js.map +1 -0
- package/dist/external-findings-import.d.ts +5 -0
- package/dist/external-findings-import.d.ts.map +1 -0
- package/dist/external-findings-import.js +38 -0
- package/dist/external-findings-import.js.map +1 -0
- package/dist/external-findings-local.d.ts +63 -0
- package/dist/external-findings-local.d.ts.map +1 -0
- package/dist/external-findings-local.js +337 -0
- package/dist/external-findings-local.js.map +1 -0
- package/dist/external-findings-publish.d.ts +73 -0
- package/dist/external-findings-publish.d.ts.map +1 -0
- package/dist/external-findings-publish.js +713 -0
- package/dist/external-findings-publish.js.map +1 -0
- package/dist/external-findings-read.d.ts +6 -0
- package/dist/external-findings-read.d.ts.map +1 -0
- package/dist/external-findings-read.js +88 -0
- package/dist/external-findings-read.js.map +1 -0
- package/dist/external-findings.d.ts +21 -0
- package/dist/external-findings.d.ts.map +1 -0
- package/dist/external-findings.js +2 -0
- package/dist/external-findings.js.map +1 -0
- package/dist/external-import-contract.d.ts +13 -0
- package/dist/external-import-contract.d.ts.map +1 -0
- package/dist/external-import-contract.js +254 -0
- package/dist/external-import-contract.js.map +1 -0
- package/dist/external-import-models.d.ts +362 -0
- package/dist/external-import-models.d.ts.map +1 -0
- package/dist/external-import-models.js +3 -0
- package/dist/external-import-models.js.map +1 -0
- package/dist/finding-workflow.d.ts +1 -1
- package/dist/finding-workflow.d.ts.map +1 -1
- package/dist/finding-workflow.js +2 -1
- package/dist/finding-workflow.js.map +1 -1
- package/dist/github-advisories.d.ts +386 -0
- package/dist/github-advisories.d.ts.map +1 -0
- package/dist/github-advisories.js +131 -0
- package/dist/github-advisories.js.map +1 -0
- package/dist/github-findings.d.ts +10 -0
- package/dist/github-findings.d.ts.map +1 -0
- package/dist/github-findings.js +256 -0
- package/dist/github-findings.js.map +1 -0
- package/dist/hosted-remediation-protocol.d.ts +2 -1
- package/dist/hosted-remediation-protocol.d.ts.map +1 -1
- package/dist/hosted-remediation-protocol.js +17 -11
- package/dist/hosted-remediation-protocol.js.map +1 -1
- package/dist/hosted-remediation.d.ts +4 -0
- package/dist/hosted-remediation.d.ts.map +1 -1
- package/dist/hosted-remediation.js +3 -1
- package/dist/hosted-remediation.js.map +1 -1
- package/dist/hosted-scan.d.ts +16 -0
- package/dist/hosted-scan.d.ts.map +1 -1
- package/dist/hosted-scan.js +14 -2
- package/dist/hosted-scan.js.map +1 -1
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/project-config-schema.d.ts +2 -0
- package/dist/project-config-schema.d.ts.map +1 -1
- package/dist/project-config-schema.js +1 -0
- package/dist/project-config-schema.js.map +1 -1
- package/dist/project-config.d.ts +1 -0
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +2 -0
- package/dist/project-config.js.map +1 -1
- package/dist/remediation.d.ts +6 -0
- package/dist/remediation.d.ts.map +1 -1
- package/dist/remediation.js +16 -5
- package/dist/remediation.js.map +1 -1
- package/dist/result.d.ts +4 -0
- package/dist/result.d.ts.map +1 -1
- package/dist/result.js +10 -0
- package/dist/result.js.map +1 -1
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +3 -1
- package/dist/runtime.js.map +1 -1
- package/dist/scan-owner-suggestions.d.ts +8 -0
- package/dist/scan-owner-suggestions.d.ts.map +1 -0
- package/dist/scan-owner-suggestions.js +33 -0
- package/dist/scan-owner-suggestions.js.map +1 -0
- package/dist/scan-settings.d.ts +1 -0
- package/dist/scan-settings.d.ts.map +1 -1
- package/dist/scan-settings.js +4 -0
- package/dist/scan-settings.js.map +1 -1
- package/dist/scanner-import.d.ts +20 -0
- package/dist/scanner-import.d.ts.map +1 -0
- package/dist/scanner-import.js +204 -0
- package/dist/scanner-import.js.map +1 -0
- package/dist/security-policy-diff.d.ts +2 -0
- package/dist/security-policy-diff.d.ts.map +1 -0
- package/dist/security-policy-diff.js +197 -0
- package/dist/security-policy-diff.js.map +1 -0
- package/dist/security-policy.d.ts +7 -3
- package/dist/security-policy.d.ts.map +1 -1
- package/dist/security-policy.js +10 -56
- package/dist/security-policy.js.map +1 -1
- package/dist/semgrep-findings.d.ts +9 -0
- package/dist/semgrep-findings.d.ts.map +1 -0
- package/dist/semgrep-findings.js +293 -0
- package/dist/semgrep-findings.js.map +1 -0
- package/dist/severity-review.d.ts +3 -0
- package/dist/severity-review.d.ts.map +1 -1
- package/dist/severity-review.js +19 -0
- package/dist/severity-review.js.map +1 -1
- package/dist/severity-store.js +7 -2
- package/dist/severity-store.js.map +1 -1
- package/dist/snyk-findings.d.ts +9 -0
- package/dist/snyk-findings.d.ts.map +1 -0
- package/dist/snyk-findings.js +349 -0
- package/dist/snyk-findings.js.map +1 -0
- package/dist/targets.d.ts +2 -2
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +12 -2
- package/dist/targets.js.map +1 -1
- package/dist/wiz-csv.d.ts +8 -0
- package/dist/wiz-csv.d.ts.map +1 -0
- package/dist/wiz-csv.js +116 -0
- package/dist/wiz-csv.js.map +1 -0
- package/dist/wiz-findings.d.ts +4 -0
- package/dist/wiz-findings.d.ts.map +1 -0
- package/dist/wiz-findings.js +460 -0
- package/dist/wiz-findings.js.map +1 -0
- package/docs/classify-severity-records.md +28 -10
- package/docs/cli.md +702 -31
- package/docs/hosted-remediation.md +24 -7
- package/docs/hosted-scans.md +12 -0
- package/package.json +6 -4
- package/schemas/external-findings.schema.json +1421 -0
- package/schemas/project-config.schema.json +4 -0
package/dist/cli.js
CHANGED
|
@@ -7,6 +7,7 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
7
7
|
}
|
|
8
8
|
return path;
|
|
9
9
|
};
|
|
10
|
+
import { classificationRunsSchema } from "./severity-review.js";
|
|
10
11
|
import { workbenchArgs } from "./workbench-arguments.js";
|
|
11
12
|
import { listenForAbort } from "./cli-signals.js";
|
|
12
13
|
import { appServerCyberAccessProgram } from "./cli-daybreak.js";
|
|
@@ -23,7 +24,7 @@ import { cwd } from "node:process";
|
|
|
23
24
|
import { createInterface } from "node:readline";
|
|
24
25
|
import { Readable, Writable as NodeWritable } from "node:stream";
|
|
25
26
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
26
|
-
import { isDeepStrictEqual, promisify, stripVTControlCharacters, } from "node:util";
|
|
27
|
+
import { isDeepStrictEqual, parseArgs, promisify, stripVTControlCharacters, } from "node:util";
|
|
27
28
|
import { Cli, z } from "incur";
|
|
28
29
|
import Ajv2020 from "ajv/dist/2020.js";
|
|
29
30
|
import { formatCliHelp } from "./cli-help.js";
|
|
@@ -39,6 +40,9 @@ import { isRecord as isJsonObject } from "./record.js";
|
|
|
39
40
|
import { suggestOwnersInternal } from "./suggest-owners.js";
|
|
40
41
|
import { parseImportedFindings } from "./findings-import.js";
|
|
41
42
|
import { publishScanToCustom } from "./custom-publish.js";
|
|
43
|
+
import { ExternalPublicationError, prepareExternalPublication, } from "./external-findings-publish.js";
|
|
44
|
+
import { prepareLocalExternalImport } from "./external-findings-import.js";
|
|
45
|
+
import { listLocalExternalFindings } from "./external-findings-local.js";
|
|
42
46
|
import { publishPatchReview, resolvePatchReviewPublisher, } from "./patch-publication.js";
|
|
43
47
|
import { DEFAULT_DEDUPE_CONCURRENCY } from "./deduplication/deduplication.js";
|
|
44
48
|
import { savedScanWorkbench } from "./saved-scan-bootstrap.js";
|
|
@@ -47,8 +51,9 @@ import { runRecordsProtocol } from "./deduplication/records-protocol.js";
|
|
|
47
51
|
import { runHostRecordsProtocol } from "./host-records-protocol.js";
|
|
48
52
|
import { classifySeverityRecords, } from "./classify-severity-records.js";
|
|
49
53
|
import { runHostedScanProtocol } from "./hosted-scan-protocol.js";
|
|
54
|
+
import { runHostedRemediationProtocol } from "./hosted-remediation-protocol.js";
|
|
50
55
|
import { runValidationRecordsProtocol } from "./validation-records.js";
|
|
51
|
-
import { FindingPatchSchema as findingPatchSchema, parseFindingVerifications, remediationPrompt, } from "./remediation.js";
|
|
56
|
+
import { FindingPatchSchema as findingPatchSchema, parseFindingVerifications, remediationPrompt, VerificationModeSchema, } from "./remediation.js";
|
|
52
57
|
import { classifyScanSeverityInternal, classifyScanDirectorySeverityInternal, } from "./classify-scan-severity.js";
|
|
53
58
|
import { resolveCompletedScan, resolveWorkflowScan, } from "./saved-scan.js";
|
|
54
59
|
import { publishFindingsCsvToCloud, publishScanToCloud, } from "./cloud-publish.js";
|
|
@@ -62,6 +67,7 @@ import { prepareKnowledgeBase, readKnowledgeBaseSnapshot, } from "./knowledge-ba
|
|
|
62
67
|
import { restoreScanKnowledge, scanInputIdentity } from "./scan-inputs.js";
|
|
63
68
|
import { workflowDigest } from "./finding-workflow.js";
|
|
64
69
|
import { CodexSecurityError, AuthenticationRequiredError, ConfigurationError, InvalidTargetError, IncompleteScanError, LocalPluginBootstrapError, OutputDirectoryError, OutputInsideProtectedRootError, PluginPythonUnavailableError, errorMessage, ScanCostLimitExceededError, ScanInterruptedError, } from "./errors.js";
|
|
70
|
+
import { GITHUB_ADVISORY_STATES, importGitHubAdvisories, } from "./github-advisories.js";
|
|
65
71
|
import { GITHUB_ALERT_STATES, importGitHubCodeScanningAlerts, } from "./github.js";
|
|
66
72
|
import { importLinearIssues, isLinearIssueIdentifier, resolveLinearApiKey, } from "./linear.js";
|
|
67
73
|
import { runMultiscan } from "./multiscan.js";
|
|
@@ -127,6 +133,7 @@ const SKILL_AUTH_OPTION = z
|
|
|
127
133
|
.enum(SCAN_AUTH_MODES)
|
|
128
134
|
.default("auto")
|
|
129
135
|
.describe("Select ChatGPT, OPENAI_API_KEY/CODEX_API_KEY, or automatic authentication.");
|
|
136
|
+
const VERIFICATION_MODE_OPTION = VerificationModeSchema.optional().describe("Use static source review or standard verification (default: standard).");
|
|
130
137
|
const PROJECT_CONFIG_OPTION = optionValue("--config")
|
|
131
138
|
.optional()
|
|
132
139
|
.describe("Load a trusted YAML/JSON file (default: CODEX_SECURITY_PROJECT_CONFIG, otherwise no file).");
|
|
@@ -279,6 +286,27 @@ function publicationIssueUrl(value) {
|
|
|
279
286
|
}
|
|
280
287
|
return value;
|
|
281
288
|
}
|
|
289
|
+
function renderExternalPublicationSummary(result) {
|
|
290
|
+
return [
|
|
291
|
+
`Import ${result.status}.`,
|
|
292
|
+
`Submission totals — Created: ${result.counts.created} Updated: ${result.counts.updated} Unchanged: ${result.counts.unchanged} Failed: ${result.counts.error}`,
|
|
293
|
+
`Excluded: ${result.excluded.length} Awaiting acknowledgement: ${result.unacknowledged} Verified: ${result.verified}`,
|
|
294
|
+
...result.failures.map((item) => `Failed ${diagnosticValue(item.source_finding_id)} (${item.code}): ${diagnosticValue(item.message)}`),
|
|
295
|
+
...result.excluded.map((item) => `Excluded item ${item.position}${item.source_finding_id ? ` (${diagnosticValue(item.source_finding_id)})` : ""}: ${diagnosticValue(item.reason)}`),
|
|
296
|
+
...(result.savedSubmission
|
|
297
|
+
? [`Saved submission: ${diagnosticValue(result.savedSubmission)}`]
|
|
298
|
+
: []),
|
|
299
|
+
...(result.status === "interrupted"
|
|
300
|
+
? []
|
|
301
|
+
: [
|
|
302
|
+
"Imported evidence remains not assessed by Codex.",
|
|
303
|
+
result.cloudUrl
|
|
304
|
+
? `View Cloud repository: ${diagnosticValue(result.cloudUrl)}`
|
|
305
|
+
: "Open the repository in Codex Security Cloud.",
|
|
306
|
+
]),
|
|
307
|
+
"",
|
|
308
|
+
].join("\n");
|
|
309
|
+
}
|
|
282
310
|
function renderPublicationSummary(result, color) {
|
|
283
311
|
const created = result.created.length;
|
|
284
312
|
const failed = result.failed.length;
|
|
@@ -1095,18 +1123,41 @@ async function skillDaybreakConfigOverrides(args, command, environment, director
|
|
|
1095
1123
|
return overrides;
|
|
1096
1124
|
}
|
|
1097
1125
|
export async function main(argv = process.argv.slice(2), output = process.stdout, errorOutput = process.stderr, dependencies = DEFAULT_DEPENDENCIES) {
|
|
1126
|
+
const remediationOperation = argv[0] === "patch"
|
|
1127
|
+
? "patch"
|
|
1128
|
+
: argv[0] === "verify-fix"
|
|
1129
|
+
? "verify"
|
|
1130
|
+
: undefined;
|
|
1131
|
+
const hostedCommand = argv[0] === "scan" || remediationOperation !== undefined;
|
|
1098
1132
|
if ((((argv[0] === "dedupe" ||
|
|
1099
1133
|
argv[0] === "validate" ||
|
|
1100
1134
|
argv[0] === "classify-severity") &&
|
|
1101
1135
|
argv.includes("--records")) ||
|
|
1102
|
-
(
|
|
1136
|
+
(hostedCommand &&
|
|
1103
1137
|
argv.some((arg) => arg === "--host" || arg.startsWith("--host=")))) &&
|
|
1104
1138
|
!argv.includes("--help") &&
|
|
1105
1139
|
!argv.includes("-h") &&
|
|
1106
1140
|
!argv.includes("--schema")) {
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1141
|
+
let classificationRuns;
|
|
1142
|
+
if (argv[0] === "classify-severity") {
|
|
1143
|
+
try {
|
|
1144
|
+
const { values } = parseArgs({
|
|
1145
|
+
args: argv.slice(1),
|
|
1146
|
+
options: {
|
|
1147
|
+
records: { type: "boolean" },
|
|
1148
|
+
runs: { type: "string" },
|
|
1149
|
+
},
|
|
1150
|
+
});
|
|
1151
|
+
classificationRuns = classificationRunsSchema.parse(values.runs === undefined ? 3 : Number(values.runs));
|
|
1152
|
+
}
|
|
1153
|
+
catch {
|
|
1154
|
+
errorOutput.write("codex-security: Use --records with only --runs (an integer from 1 to 10; default: 3).\n");
|
|
1155
|
+
return 2;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
else if (argv.length !== 2 || (hostedCommand && argv[1] !== "--host")) {
|
|
1159
|
+
errorOutput.write(hostedCommand
|
|
1160
|
+
? `codex-security: --host must be used alone with ${argv[0]}.\n`
|
|
1110
1161
|
: `codex-security: --records must be used alone with ${argv[0]}.\n`);
|
|
1111
1162
|
return 2;
|
|
1112
1163
|
}
|
|
@@ -1120,8 +1171,13 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
1120
1171
|
? runValidationRecordsProtocol
|
|
1121
1172
|
: runRecordsProtocol;
|
|
1122
1173
|
const code = argv[0] === "classify-severity"
|
|
1123
|
-
? await runHostRecordsProtocol(dependencies.recordsInput ?? process.stdin, output, (value, options) => classifySeverityRecords(value,
|
|
1124
|
-
|
|
1174
|
+
? await runHostRecordsProtocol(dependencies.recordsInput ?? process.stdin, output, (value, options) => classifySeverityRecords(value, {
|
|
1175
|
+
...options,
|
|
1176
|
+
classificationRuns,
|
|
1177
|
+
}), controller.signal)
|
|
1178
|
+
: remediationOperation !== undefined
|
|
1179
|
+
? await runHostedRemediationProtocol(dependencies.recordsInput ?? process.stdin, output, controller.signal, remediationOperation)
|
|
1180
|
+
: await runProtocol(dependencies.recordsInput ?? process.stdin, output, controller.signal);
|
|
1125
1181
|
exitCode =
|
|
1126
1182
|
controller.signal.reason === "SIGINT"
|
|
1127
1183
|
? 130
|
|
@@ -1366,6 +1422,45 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
1366
1422
|
}), "findings", format, { repository: requestedRepository });
|
|
1367
1423
|
},
|
|
1368
1424
|
});
|
|
1425
|
+
findingFeedback.command("imported", {
|
|
1426
|
+
description: "List imported vendor evidence for a local repository.",
|
|
1427
|
+
mcp: false,
|
|
1428
|
+
args: z.object({
|
|
1429
|
+
repository: z
|
|
1430
|
+
.string()
|
|
1431
|
+
.optional()
|
|
1432
|
+
.describe("Local repository to inspect (default: current directory)."),
|
|
1433
|
+
}),
|
|
1434
|
+
output: z.record(z.string(), z.unknown()).optional(),
|
|
1435
|
+
async run({ args, format, error: incurError }) {
|
|
1436
|
+
const controller = new AbortController();
|
|
1437
|
+
const removeSignals = listenForAbort(dependencies, controller);
|
|
1438
|
+
try {
|
|
1439
|
+
const repository = resolveCliPath(dependencies.currentDirectory(), args.repository ?? ".");
|
|
1440
|
+
const findings = await (dependencies.listLocalExternalFindings ?? listLocalExternalFindings)({ repository }, { environment: dependencies.environment, signal: controller.signal });
|
|
1441
|
+
return { repository, findings };
|
|
1442
|
+
}
|
|
1443
|
+
catch (error) {
|
|
1444
|
+
if (controller.signal.aborted) {
|
|
1445
|
+
exitCode = controller.signal.reason === "SIGINT" ? 130 : 143;
|
|
1446
|
+
if (argv.includes("--full-output") &&
|
|
1447
|
+
(format === "json" || format === "jsonl")) {
|
|
1448
|
+
structuredError = true;
|
|
1449
|
+
return incurError({
|
|
1450
|
+
code: "FINDINGS_READ_FAILED",
|
|
1451
|
+
message: diagnosticValue(error),
|
|
1452
|
+
exitCode,
|
|
1453
|
+
});
|
|
1454
|
+
}
|
|
1455
|
+
return;
|
|
1456
|
+
}
|
|
1457
|
+
throw error;
|
|
1458
|
+
}
|
|
1459
|
+
finally {
|
|
1460
|
+
removeSignals();
|
|
1461
|
+
}
|
|
1462
|
+
},
|
|
1463
|
+
});
|
|
1369
1464
|
const scanHistory = Cli.create("scans", {
|
|
1370
1465
|
description: "Review saved scans (default: list).",
|
|
1371
1466
|
})
|
|
@@ -2212,6 +2307,205 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
2212
2307
|
});
|
|
2213
2308
|
},
|
|
2214
2309
|
});
|
|
2310
|
+
publication.command("findings", {
|
|
2311
|
+
description: "Preview and import selected Wiz, Snyk, Semgrep Code, Endor, or GitHub findings locally or to Cloud.",
|
|
2312
|
+
hint: "For Snyk Open Source SCA vulnerabilities only, prefer native snyk test JSON or an official plugin snyk-findings-export/v1 bundle; Open Source SARIF 2.1.0 is also supported. Snyk licenses, Code, Container, IaC and platform backlogs are unsupported. For Semgrep Code, supply native JSON or SARIF and --source-repository-url. For Endor, supply native Finding JSON or endorctl SARIF 2.1.0. For GitHub, supply complete JSON/JSONL saved by import github or import github-advisories. GHSA advisories do not establish an installed dependency or applicability. For Wiz, prefer a native package vulnerability JSON report or named SAST/repository-secret/IaC JSON collections with repository metadata. Normalized JSONL and repository package-vulnerability CSV (SCA only, GitHub repositories) are also supported. Gzip is supported for each format; Wiz CSV does not cover SAST or cloud posture. Other Wiz CSV profiles, scan events, workload secrets, and cloud configuration exports are not supported. --to local stores unassessed evidence for a local repository path without Cloud login. --full-output requires --format json or --format jsonl.\nExample: codex-security publish findings selected-wiz.json --to local --repository ./project --provider wiz --source-key TENANT_ID/vulnerability-finding --dry-run --format json",
|
|
2313
|
+
destructive: true,
|
|
2314
|
+
mcp: false,
|
|
2315
|
+
args: z.object({
|
|
2316
|
+
file: z
|
|
2317
|
+
.string()
|
|
2318
|
+
.describe("Snyk native test JSON, plugin SCA bundle or Open Source SARIF; Semgrep Code JSON/SARIF; Endor Finding JSON/endorctl SARIF; saved GitHub import output; native Wiz JSON, normalized JSONL, or repository package-vulnerability CSV."),
|
|
2319
|
+
}),
|
|
2320
|
+
options: z.object({
|
|
2321
|
+
to: z.enum(["cloud", "local"]).describe("Import destination (required)."),
|
|
2322
|
+
repository: optionValue("--repository").describe("Local repository path for --to local; authorized repository ID or URL for --to cloud."),
|
|
2323
|
+
provider: z
|
|
2324
|
+
.enum(["wiz", "snyk", "semgrep", "endor", "github"])
|
|
2325
|
+
.describe("Provider that produced these findings."),
|
|
2326
|
+
sourceRepositoryUrl: optionValue("--source-repository-url")
|
|
2327
|
+
.optional()
|
|
2328
|
+
.describe("Required for Semgrep: source repository URL, checked against the Cloud destination or configured local Git remotes."),
|
|
2329
|
+
sourceKey: optionValue("--source-key").describe("Stable vendor tenant and finding namespace; not a project selection filter."),
|
|
2330
|
+
dryRun: z
|
|
2331
|
+
.boolean()
|
|
2332
|
+
.default(false)
|
|
2333
|
+
.describe("Read and preview the destination and findings without storing them."),
|
|
2334
|
+
yes: z
|
|
2335
|
+
.boolean()
|
|
2336
|
+
.default(false)
|
|
2337
|
+
.describe("Confirm publication of the previewed input without a terminal prompt."),
|
|
2338
|
+
}),
|
|
2339
|
+
output: z.record(z.string(), z.unknown()).optional(),
|
|
2340
|
+
async run({ args, options, format, formatExplicit, error: incurError }) {
|
|
2341
|
+
return await withTerminalErrorsHandled(errorOutput, async () => {
|
|
2342
|
+
const writeDiagnostic = (message) => notify(() => errorOutput.write(message));
|
|
2343
|
+
if (argv.includes("--full-output") &&
|
|
2344
|
+
format !== "json" &&
|
|
2345
|
+
format !== "jsonl") {
|
|
2346
|
+
structuredError = true;
|
|
2347
|
+
exitCode = 2;
|
|
2348
|
+
return incurError({
|
|
2349
|
+
code: "INVALID_ARGUMENTS",
|
|
2350
|
+
message: "Finding imports support --full-output with --format json or --format jsonl. Choose one of those formats or omit --full-output.",
|
|
2351
|
+
exitCode,
|
|
2352
|
+
});
|
|
2353
|
+
}
|
|
2354
|
+
const controller = new AbortController();
|
|
2355
|
+
const removeSignals = listenForAbort(dependencies, controller);
|
|
2356
|
+
const structured = formatExplicit && format !== "toon";
|
|
2357
|
+
const humanSummary = format === "toon" &&
|
|
2358
|
+
!formatExplicit &&
|
|
2359
|
+
!argv.some((argument) => OUTPUT_OPTION.test(argument));
|
|
2360
|
+
const confirmImport = async (preview, showPreview) => {
|
|
2361
|
+
if (options.yes)
|
|
2362
|
+
return true;
|
|
2363
|
+
const prompt = dependencies.externalPublicationPrompt ??
|
|
2364
|
+
createTerminalPrompt(errorOutput);
|
|
2365
|
+
const local = options.to === "local";
|
|
2366
|
+
if (!prompt.isInteractive())
|
|
2367
|
+
throw new CodexSecurityError(`${local ? "Local import" : "Publication"} needs confirmation. Run --dry-run, review the results, then use --yes to approve this input.`);
|
|
2368
|
+
if (structured)
|
|
2369
|
+
showPreview();
|
|
2370
|
+
const action = local
|
|
2371
|
+
? `Store these ${preview.findings.length} findings locally`
|
|
2372
|
+
: `Publish these ${preview.findings.length} findings`;
|
|
2373
|
+
return prompt.confirm(`${action}${preview.excluded.length ? ` and skip ${preview.excluded.length} excluded records` : ""}?`, false, controller.signal);
|
|
2374
|
+
};
|
|
2375
|
+
let lastProgress = "";
|
|
2376
|
+
const onProgress = (event) => {
|
|
2377
|
+
if (errorOutput.isTTY !== true)
|
|
2378
|
+
return;
|
|
2379
|
+
const step = event.total
|
|
2380
|
+
? Math.floor((event.completed * 10) / event.total)
|
|
2381
|
+
: 0;
|
|
2382
|
+
const key = `${event.phase}:${step}`;
|
|
2383
|
+
if (key === lastProgress)
|
|
2384
|
+
return;
|
|
2385
|
+
lastProgress = key;
|
|
2386
|
+
const labels = {
|
|
2387
|
+
reading: "Reading selected findings",
|
|
2388
|
+
discovering: "Checking Cloud account and repository",
|
|
2389
|
+
preparing: "Preparing findings",
|
|
2390
|
+
waiting: "Waiting for publication access",
|
|
2391
|
+
uploading: "Acknowledged findings",
|
|
2392
|
+
verifying: "Verifying source records",
|
|
2393
|
+
};
|
|
2394
|
+
writeDiagnostic(`${labels[event.phase]}${event.total === undefined ? "..." : `: ${event.completed}/${event.total}`}\n`);
|
|
2395
|
+
};
|
|
2396
|
+
try {
|
|
2397
|
+
if (options.to === "local") {
|
|
2398
|
+
const prepared = await (dependencies.prepareLocalExternalImport ??
|
|
2399
|
+
prepareLocalExternalImport)(resolveCliPath(dependencies.currentDirectory(), args.file), {
|
|
2400
|
+
...options,
|
|
2401
|
+
repository: resolveCliPath(dependencies.currentDirectory(), options.repository),
|
|
2402
|
+
}, {
|
|
2403
|
+
environment: dependencies.environment,
|
|
2404
|
+
signal: controller.signal,
|
|
2405
|
+
});
|
|
2406
|
+
const { preview } = prepared;
|
|
2407
|
+
const showPreview = () => {
|
|
2408
|
+
writeDiagnostic(`Local repository: ${diagnosticValue(preview.repository)}\nSource: ${preview.source.provider} / ${diagnosticValue(preview.source.source_key)}\nRead: ${preview.read} Ready: ${preview.findings.length} Excluded: ${preview.excluded.length}\n`);
|
|
2409
|
+
for (const excluded of preview.excluded)
|
|
2410
|
+
writeDiagnostic(`Excluded item ${excluded.position}: ${diagnosticValue(excluded.reason)}\n`);
|
|
2411
|
+
for (const finding of preview.findings.slice(0, 5))
|
|
2412
|
+
writeDiagnostic(` ${diagnosticValue(finding.source_finding_id)} [${finding.evidence.severity}] ${diagnosticValue(finding.evidence.title)}\n`);
|
|
2413
|
+
writeDiagnostic(`Evidence file: ${diagnosticValue(resolveCliPath(dependencies.currentDirectory(), args.file))}\nImported evidence remains not assessed by Codex.\nUse --dry-run --format json to inspect all normalized findings and complete evidence before storing them.\n`);
|
|
2414
|
+
};
|
|
2415
|
+
if (!structured)
|
|
2416
|
+
showPreview();
|
|
2417
|
+
if (options.dryRun) {
|
|
2418
|
+
if (humanSummary)
|
|
2419
|
+
renderedOutput = "Dry run complete. No findings stored.\n";
|
|
2420
|
+
return { ...preview, dryRun: true };
|
|
2421
|
+
}
|
|
2422
|
+
if (!(await confirmImport(preview, showPreview))) {
|
|
2423
|
+
if (humanSummary)
|
|
2424
|
+
renderedOutput = "No findings stored.\n";
|
|
2425
|
+
return { imported: false, preview };
|
|
2426
|
+
}
|
|
2427
|
+
const result = await prepared.import();
|
|
2428
|
+
if (result.excluded.length > 0)
|
|
2429
|
+
exitCode = 1;
|
|
2430
|
+
const summary = `Local import complete.\nCreated: ${result.counts.created} Updated: ${result.counts.updated} Unchanged: ${result.counts.unchanged} Excluded: ${result.excluded.length}\nImported evidence remains not assessed by Codex.\nRead stored evidence with codex-security findings imported REPOSITORY.\n`;
|
|
2431
|
+
if (humanSummary)
|
|
2432
|
+
renderedOutput = summary;
|
|
2433
|
+
else if (!structured)
|
|
2434
|
+
writeDiagnostic(summary);
|
|
2435
|
+
return { ...result };
|
|
2436
|
+
}
|
|
2437
|
+
const prepared = await prepareExternalPublication(resolveCliPath(dependencies.currentDirectory(), args.file), options, {
|
|
2438
|
+
environment: dependencies.environment,
|
|
2439
|
+
fetch: dependencies.cloudFetch,
|
|
2440
|
+
signal: controller.signal,
|
|
2441
|
+
onProgress,
|
|
2442
|
+
});
|
|
2443
|
+
const { preview } = prepared;
|
|
2444
|
+
const showPreview = () => {
|
|
2445
|
+
writeDiagnostic(`Cloud API: ${diagnosticValue(preview.cloudApiUrl)}\nAccount: ${diagnosticValue(preview.accountId)}\nDestination: ${diagnosticValue(preview.destination.url)} (${diagnosticValue(preview.destination.id)})\nEnvironment: ${[...new Set(preview.requests.map((request) => request.repository.environment_id))].map(diagnosticValue).join(", ")}\nSource: ${preview.source.provider} / ${diagnosticValue(preview.source.source_key)}\nRead: ${preview.read} Ready: ${preview.findings.length} Excluded: ${preview.excluded.length}${preview.resumed ? "\nResuming the saved submission." : ""}\n`);
|
|
2446
|
+
if (preview.cloudUrl)
|
|
2447
|
+
writeDiagnostic(`Cloud app: ${diagnosticValue(preview.cloudUrl)}\n`);
|
|
2448
|
+
for (const excluded of preview.excluded)
|
|
2449
|
+
writeDiagnostic(`Excluded item ${excluded.position}: ${diagnosticValue(excluded.reason)}\n`);
|
|
2450
|
+
writeDiagnostic(`Evidence file: ${diagnosticValue(resolveCliPath(dependencies.currentDirectory(), args.file))}\nImported evidence remains not assessed by Codex.\n`);
|
|
2451
|
+
const severities = new Map();
|
|
2452
|
+
for (const finding of preview.findings)
|
|
2453
|
+
severities.set(finding.evidence.severity, (severities.get(finding.evidence.severity) ?? 0) + 1);
|
|
2454
|
+
writeDiagnostic(`Severities: ${[...severities].map(([severity, count]) => `${severity}: ${count}`).join(" ")}\n`);
|
|
2455
|
+
for (const finding of preview.findings.slice(0, 5))
|
|
2456
|
+
writeDiagnostic(` ${diagnosticValue(finding.source_finding_id)} [${finding.evidence.severity}] ${diagnosticValue(finding.evidence.title)}\n`);
|
|
2457
|
+
if (preview.findings.length > 5)
|
|
2458
|
+
writeDiagnostic(`Showing 5 of ${preview.findings.length} findings.\n`);
|
|
2459
|
+
writeDiagnostic("Use --dry-run --format json to inspect all normalized findings and the complete evidence before uploading.\n");
|
|
2460
|
+
};
|
|
2461
|
+
if (!structured)
|
|
2462
|
+
showPreview();
|
|
2463
|
+
if (options.dryRun) {
|
|
2464
|
+
if (humanSummary)
|
|
2465
|
+
renderedOutput = "Dry run complete. No findings uploaded.\n";
|
|
2466
|
+
return { ...preview, dryRun: true };
|
|
2467
|
+
}
|
|
2468
|
+
if (!(await confirmImport(preview, showPreview))) {
|
|
2469
|
+
if (humanSummary)
|
|
2470
|
+
renderedOutput = "No findings published.\n";
|
|
2471
|
+
return { published: false, preview };
|
|
2472
|
+
}
|
|
2473
|
+
const result = await prepared.publish();
|
|
2474
|
+
if (result.status === "partial")
|
|
2475
|
+
exitCode = 1;
|
|
2476
|
+
if (humanSummary)
|
|
2477
|
+
renderedOutput = renderExternalPublicationSummary(result);
|
|
2478
|
+
else if (!structured)
|
|
2479
|
+
writeDiagnostic(renderExternalPublicationSummary(result));
|
|
2480
|
+
return { ...result };
|
|
2481
|
+
}
|
|
2482
|
+
catch (error) {
|
|
2483
|
+
if (argv.includes("--full-output") &&
|
|
2484
|
+
(format === "json" || format === "jsonl"))
|
|
2485
|
+
failedResultOutput = {
|
|
2486
|
+
format,
|
|
2487
|
+
code: "IMPORT_FAILED",
|
|
2488
|
+
message: diagnosticValue(error),
|
|
2489
|
+
};
|
|
2490
|
+
reportPublicationError(diagnosticValue(error), controller.signal.aborted ? controller.signal.reason : undefined);
|
|
2491
|
+
if (error instanceof ExternalPublicationError) {
|
|
2492
|
+
if (humanSummary)
|
|
2493
|
+
renderedOutput = renderExternalPublicationSummary(error.result);
|
|
2494
|
+
return { ...error.result };
|
|
2495
|
+
}
|
|
2496
|
+
const failure = { status: "failed", error: diagnosticValue(error) };
|
|
2497
|
+
if ((format === "json" || format === "jsonl") &&
|
|
2498
|
+
!argv.includes("--full-output") &&
|
|
2499
|
+
argv.some((argument) => /^--filter-output(?:=|$)/u.test(argument)))
|
|
2500
|
+
filteredScanFailure = { format, data: failure };
|
|
2501
|
+
return structured ? failure : undefined;
|
|
2502
|
+
}
|
|
2503
|
+
finally {
|
|
2504
|
+
removeSignals();
|
|
2505
|
+
}
|
|
2506
|
+
});
|
|
2507
|
+
},
|
|
2508
|
+
});
|
|
2215
2509
|
publication.command("check", {
|
|
2216
2510
|
description: "Check saved scan history and Linear access without creating issues.",
|
|
2217
2511
|
mcp: false,
|
|
@@ -2243,10 +2537,10 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
2243
2537
|
},
|
|
2244
2538
|
});
|
|
2245
2539
|
const imports = Cli.create("import", {
|
|
2246
|
-
description: "Read GitHub code scanning alerts.",
|
|
2540
|
+
description: "Read GitHub code scanning alerts and security advisories.",
|
|
2247
2541
|
}).command("github", {
|
|
2248
2542
|
description: "Read GitHub code scanning alerts without changing GitHub.",
|
|
2249
|
-
hint: "To save CSV or JSON findings as a local scan, use codex-security scan import --help.",
|
|
2543
|
+
hint: "Save complete --format json output for publish findings --provider github. This command reads code-scanning alerts; Dependabot and secret-scanning alerts are not supported. To save CSV or JSON findings as a local scan, use codex-security scan import --help.",
|
|
2250
2544
|
destructive: false,
|
|
2251
2545
|
mcp: false,
|
|
2252
2546
|
args: z.object({
|
|
@@ -2309,6 +2603,82 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
2309
2603
|
}
|
|
2310
2604
|
},
|
|
2311
2605
|
});
|
|
2606
|
+
imports.command("github-advisories", {
|
|
2607
|
+
description: "Read GitHub security advisories without changing GitHub.",
|
|
2608
|
+
hint: "Defaults to published repository advisories. Use --github-advisory-source global with explicit --github-advisory IDs to select public database entries. Advisories do not establish an installed dependency or applicability to the selected repository.",
|
|
2609
|
+
destructive: false,
|
|
2610
|
+
mcp: false,
|
|
2611
|
+
args: z.object({
|
|
2612
|
+
repository: z
|
|
2613
|
+
.string()
|
|
2614
|
+
.min(1)
|
|
2615
|
+
.describe("Source repository, or target context for global IDs, in OWNER/REPO form."),
|
|
2616
|
+
}),
|
|
2617
|
+
options: z.object({
|
|
2618
|
+
githubAdvisory: z
|
|
2619
|
+
.array(optionValue("--github-advisory").regex(/^GHSA-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}$/iu, "GitHub advisory IDs must use GHSA-xxxx-xxxx-xxxx form."))
|
|
2620
|
+
.default([])
|
|
2621
|
+
.describe("Exact GHSA ID; repeat to select a subset. Required for global advisories."),
|
|
2622
|
+
githubAdvisorySource: z
|
|
2623
|
+
.enum(["repository", "global"])
|
|
2624
|
+
.default("repository")
|
|
2625
|
+
.describe("Advisory API to read; global requires exact IDs and never lists the database."),
|
|
2626
|
+
githubState: z
|
|
2627
|
+
.enum(GITHUB_ADVISORY_STATES)
|
|
2628
|
+
.default("published")
|
|
2629
|
+
.describe("Repository advisory list state; omit when selecting exact GHSA IDs."),
|
|
2630
|
+
}),
|
|
2631
|
+
output: z
|
|
2632
|
+
.array(z.object({
|
|
2633
|
+
source: z.literal("github-security-advisory"),
|
|
2634
|
+
selection: z.enum(["repository", "global"]),
|
|
2635
|
+
repository: z.string(),
|
|
2636
|
+
githubHost: z.string(),
|
|
2637
|
+
ghsaId: z.string(),
|
|
2638
|
+
url: z.string(),
|
|
2639
|
+
advisory: z.record(z.string(), z.unknown()),
|
|
2640
|
+
}))
|
|
2641
|
+
.optional(),
|
|
2642
|
+
async run({ args, options, error: incurError }) {
|
|
2643
|
+
const controller = new AbortController();
|
|
2644
|
+
const removeSignals = listenForAbort(dependencies, controller);
|
|
2645
|
+
try {
|
|
2646
|
+
return await (dependencies.importGitHubAdvisories ?? importGitHubAdvisories)({
|
|
2647
|
+
repository: args.repository,
|
|
2648
|
+
advisoryIds: options.githubAdvisory,
|
|
2649
|
+
source: options.githubAdvisorySource,
|
|
2650
|
+
state: options.githubState,
|
|
2651
|
+
signal: controller.signal,
|
|
2652
|
+
}, {
|
|
2653
|
+
environment: dependencies.environment,
|
|
2654
|
+
currentDirectory: dependencies.currentDirectory(),
|
|
2655
|
+
});
|
|
2656
|
+
}
|
|
2657
|
+
catch (error) {
|
|
2658
|
+
const signal = controller.signal.reason;
|
|
2659
|
+
if (signal === "SIGINT" || signal === "SIGTERM") {
|
|
2660
|
+
exitCode = signal === "SIGINT" ? 130 : 143;
|
|
2661
|
+
errorOutput.write(`codex-security: GitHub advisory import ${signal === "SIGINT" ? "canceled" : "terminated"}.\n`);
|
|
2662
|
+
}
|
|
2663
|
+
else {
|
|
2664
|
+
exitCode = 2;
|
|
2665
|
+
errorOutput.write(`codex-security: ${diagnosticValue(error)}\n`);
|
|
2666
|
+
}
|
|
2667
|
+
if (argv.includes("--full-output")) {
|
|
2668
|
+
structuredError = true;
|
|
2669
|
+
return incurError({
|
|
2670
|
+
code: "GITHUB_IMPORT_FAILED",
|
|
2671
|
+
message: diagnosticValue(error),
|
|
2672
|
+
exitCode,
|
|
2673
|
+
});
|
|
2674
|
+
}
|
|
2675
|
+
return undefined;
|
|
2676
|
+
}
|
|
2677
|
+
finally {
|
|
2678
|
+
removeSignals();
|
|
2679
|
+
}
|
|
2680
|
+
},
|
|
2681
|
+
});
|
|
2312
2682
|
const infoOutput = z.object({
|
|
2313
2683
|
sdkVersion: z.string(),
|
|
2314
2684
|
bundledPluginVersion: z.string(),
|
|
@@ -2561,6 +2931,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
2561
2931
|
.describe("Patch findings at or above LEVEL; requires --patch."),
|
|
2562
2932
|
createPr: CREATE_PR_OPTION.describe("Create a draft pull request or merge request after verified patches; requires --patch."),
|
|
2563
2933
|
maxCost: ScanSettingsSchema.shape.maxCostUsd.describe("Stop above AMOUNT in estimated USD; the dashboard offers increases near the limit."),
|
|
2934
|
+
ownerSuggestions: ScanSettingsSchema.shape.ownerSuggestions,
|
|
2564
2935
|
showCost: SHOW_COST_OPTION,
|
|
2565
2936
|
headless: z
|
|
2566
2937
|
.boolean()
|
|
@@ -2778,14 +3149,17 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
2778
3149
|
})
|
|
2779
3150
|
.command("classify-severity", {
|
|
2780
3151
|
description: "Assess severity for saved findings or canonical records.",
|
|
2781
|
-
hint: "Use --rubric
|
|
3152
|
+
hint: "Use --rubric to override the built-in policy or --records for host-provided classification.",
|
|
2782
3153
|
destructive: true,
|
|
2783
3154
|
mcp: false,
|
|
2784
3155
|
options: z.object({
|
|
3156
|
+
runs: classificationRunsSchema
|
|
3157
|
+
.default(3)
|
|
3158
|
+
.describe("Number of independent classification runs (1–10; default: 3)."),
|
|
2785
3159
|
records: z
|
|
2786
3160
|
.boolean()
|
|
2787
3161
|
.default(false)
|
|
2788
|
-
.describe("Classify canonical records through host-provided reviews over version 1 JSON-RPC;
|
|
3162
|
+
.describe("Classify canonical records through host-provided reviews over version 1 JSON-RPC; accepts --runs."),
|
|
2789
3163
|
reprocess: z
|
|
2790
3164
|
.boolean()
|
|
2791
3165
|
.default(false)
|
|
@@ -2798,7 +3172,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
2798
3172
|
.describe("External completed scan directory."),
|
|
2799
3173
|
rubric: optionValue("--rubric")
|
|
2800
3174
|
.optional()
|
|
2801
|
-
.describe("Classification policy document; omit to
|
|
3175
|
+
.describe("Classification policy document; omit to classify with the built-in severity rubric."),
|
|
2802
3176
|
knowledgeBase: z
|
|
2803
3177
|
.array(optionValue("--knowledge-base"))
|
|
2804
3178
|
.default([])
|
|
@@ -2831,6 +3205,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
2831
3205
|
knowledgeBasePaths: options.knowledgeBase.map((path) => resolveCliPath(currentDirectory, path)),
|
|
2832
3206
|
findingIds: options.findingId.length === 0 ? undefined : options.findingId,
|
|
2833
3207
|
reprocess: options.reprocess,
|
|
3208
|
+
classificationRuns: options.runs,
|
|
2834
3209
|
model: options.model,
|
|
2835
3210
|
reasoningEffort: options.effort,
|
|
2836
3211
|
};
|
|
@@ -3602,6 +3977,11 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
3602
3977
|
.describe("Finding text, a file, or a saved finding identifier."),
|
|
3603
3978
|
}),
|
|
3604
3979
|
options: z.object({
|
|
3980
|
+
host: z
|
|
3981
|
+
.boolean()
|
|
3982
|
+
.default(false)
|
|
3983
|
+
.describe("Run one hosted fix verification over JSON-RPC stdin/stdout; use alone."),
|
|
3984
|
+
verificationMode: VERIFICATION_MODE_OPTION,
|
|
3605
3985
|
auth: SKILL_AUTH_OPTION,
|
|
3606
3986
|
...MODEL_OPTIONS.shape,
|
|
3607
3987
|
scan: optionValue("--scan")
|
|
@@ -3637,6 +4017,8 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
3637
4017
|
output: z.record(z.string(), z.unknown()).optional(),
|
|
3638
4018
|
async run({ format, options }) {
|
|
3639
4019
|
try {
|
|
4020
|
+
if (options.host)
|
|
4021
|
+
throw new CodexSecurityError("Use verify-fix --host alone.");
|
|
3640
4022
|
const linear = options.linearIssue.length > 0 || !!options.linearProject;
|
|
3641
4023
|
if (options.linearIssue.length > 0 && options.linearProject) {
|
|
3642
4024
|
throw new CodexSecurityError("Use either --linear-issue or --linear-project, not both.");
|
|
@@ -3697,6 +4079,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
3697
4079
|
: { findings: selected.findings }),
|
|
3698
4080
|
auth: options.auth,
|
|
3699
4081
|
verificationIds: identifiers,
|
|
4082
|
+
verificationMode: options.verificationMode,
|
|
3700
4083
|
environment,
|
|
3701
4084
|
onEvent: progress.observe.bind(progress),
|
|
3702
4085
|
});
|
|
@@ -3749,6 +4132,11 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
3749
4132
|
.describe("Issue text, a file, or a saved finding identifier."),
|
|
3750
4133
|
}),
|
|
3751
4134
|
options: z.object({
|
|
4135
|
+
host: z
|
|
4136
|
+
.boolean()
|
|
4137
|
+
.default(false)
|
|
4138
|
+
.describe("Run one hosted patch over JSON-RPC stdin/stdout; use alone."),
|
|
4139
|
+
verificationMode: VERIFICATION_MODE_OPTION,
|
|
3752
4140
|
auth: SKILL_AUTH_OPTION,
|
|
3753
4141
|
...MODEL_OPTIONS.shape,
|
|
3754
4142
|
externalSandbox: z
|
|
@@ -3804,6 +4192,8 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
3804
4192
|
files: [],
|
|
3805
4193
|
};
|
|
3806
4194
|
try {
|
|
4195
|
+
if (options.host)
|
|
4196
|
+
throw new CodexSecurityError("Use patch --host alone.");
|
|
3807
4197
|
const linear = options.linearIssue.length > 0 || !!options.linearProject;
|
|
3808
4198
|
if (options.resumePr !== undefined) {
|
|
3809
4199
|
if (positionals.length > 0 ||
|
|
@@ -3813,6 +4203,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
3813
4203
|
options.assessPatchRisk ||
|
|
3814
4204
|
options.validationPromptFile !== undefined ||
|
|
3815
4205
|
options.externalSandbox ||
|
|
4206
|
+
options.verificationMode !== undefined ||
|
|
3816
4207
|
linear ||
|
|
3817
4208
|
options.linearFilter !== undefined ||
|
|
3818
4209
|
options.linearApiKey !== undefined ||
|
|
@@ -3857,6 +4248,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
3857
4248
|
auth: options.auth,
|
|
3858
4249
|
externalSandbox: options.externalSandbox,
|
|
3859
4250
|
validationPrompt,
|
|
4251
|
+
verificationMode: options.verificationMode,
|
|
3860
4252
|
});
|
|
3861
4253
|
exitCode = patchExitCode(patches);
|
|
3862
4254
|
const files = await changedPatchFiles(selected.repository, patchBase, dependencies);
|
|
@@ -3934,6 +4326,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
3934
4326
|
auth: options.auth,
|
|
3935
4327
|
externalSandbox: options.externalSandbox,
|
|
3936
4328
|
validationPrompt,
|
|
4329
|
+
verificationMode: options.verificationMode,
|
|
3937
4330
|
});
|
|
3938
4331
|
if (!jsonOutput)
|
|
3939
4332
|
await writeCliOutput(output, report.text());
|
|
@@ -4583,7 +4976,7 @@ export async function main(argv = process.argv.slice(2), output = process.stdout
|
|
|
4583
4976
|
...envelope,
|
|
4584
4977
|
ok: false,
|
|
4585
4978
|
error: {
|
|
4586
|
-
code: "SCAN_FAILED",
|
|
4979
|
+
code: failedResultOutput.code ?? "SCAN_FAILED",
|
|
4587
4980
|
message: failedResultOutput.message,
|
|
4588
4981
|
},
|
|
4589
4982
|
}, null, failedResultOutput.format === "json" ? 2 : undefined)}\n`;
|
|
@@ -4710,6 +5103,9 @@ async function prepareScanArgumentsFromRecipe(recipe, parentScanId, { scanPrompt
|
|
|
4710
5103
|
DEEP_SCAN_SETTINGS.some(([name]) => deepScan.data?.[name] === undefined)) {
|
|
4711
5104
|
throw new CodexSecurityError("The saved scan recipe is missing resolved deep scan settings.");
|
|
4712
5105
|
}
|
|
5106
|
+
const ownerSuggestions = ScanSettingsSchema.shape.ownerSuggestions.safeParse(recipe["ownerSuggestions"]);
|
|
5107
|
+
if (!ownerSuggestions.success)
|
|
5108
|
+
throw new CodexSecurityError("The saved scan recipe contains an invalid owner suggestions setting.");
|
|
4713
5109
|
const auth = z.enum(SCAN_AUTH_MODES).optional().safeParse(recipe["auth"]);
|
|
4714
5110
|
const cyberAccessProgram = ScanSettingsSchema.shape.cyberAccessProgram.safeParse(recipe["cyberAccessProgram"]);
|
|
4715
5111
|
if (!cyberAccessProgram.success) {
|
|
@@ -4736,6 +5132,7 @@ async function prepareScanArgumentsFromRecipe(recipe, parentScanId, { scanPrompt
|
|
|
4736
5132
|
repository,
|
|
4737
5133
|
auth: auth.data ?? DEFAULT_SCAN_AUTH,
|
|
4738
5134
|
cyberAccessProgram: cyberAccessProgram.data,
|
|
5135
|
+
ownerSuggestions: ownerSuggestions.data,
|
|
4739
5136
|
// Saved scopes contain literal repository names, not home-relative inputs.
|
|
4740
5137
|
target: paths.length > 0
|
|
4741
5138
|
? paths.map((path) => path === "~" || path.startsWith("~/") || path.startsWith("~\\")
|
|
@@ -5546,6 +5943,7 @@ async function runSkill(skill, inputs, configuration, stdout, stderr, dependenci
|
|
|
5546
5943
|
verificationIds: options.verificationIds,
|
|
5547
5944
|
findingInstructions: options.findingInstructions,
|
|
5548
5945
|
validationInstructions: options.validationPrompt,
|
|
5946
|
+
verificationMode: options.verificationMode,
|
|
5549
5947
|
})
|
|
5550
5948
|
: validate
|
|
5551
5949
|
? await standaloneValidationPrompt(plugin)
|