@openai/codex-security 0.3.0 → 0.4.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/_bundled_plugin/.codex-plugin/plugin.json +5 -5
- 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/mcp/permission-profile-preflight.mjs +13 -20
- 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/final-report.md +1 -1
- package/_bundled_plugin/schemas/coverage.schema.json +45 -126
- package/_bundled_plugin/schemas/findings.schema.json +140 -427
- package/_bundled_plugin/schemas/patch-risk-assessment.schema.json +106 -119
- package/_bundled_plugin/schemas/scan-manifest.schema.json +73 -188
- package/_bundled_plugin/scripts/finalize_scan_contract.py +7 -6
- package/_bundled_plugin/scripts/generate_rank_input.py +25 -106
- package/_bundled_plugin/scripts/report_projection.py +35 -13
- package/_bundled_plugin/scripts/workbench_cli.py +9 -6
- package/_bundled_plugin/scripts/workbench_db.py +51 -16
- package/_bundled_plugin/scripts/workbench_publication.py +216 -247
- package/_bundled_plugin/scripts/workbench_scan_usage.py +173 -10
- package/_bundled_plugin/scripts/workbench_validation.py +15 -1
- package/_bundled_plugin/shared/workbench-migrations.json +17 -0
- package/_bundled_plugin/skills/deep-security-scan/SKILL.md +1 -1
- package/_bundled_plugin/skills/deep-security-scan/agents/openai.yaml +1 -1
- package/_bundled_plugin/skills/security-diff-scan/agents/openai.yaml +1 -1
- package/_bundled_plugin/skills/security-scan/SKILL.md +1 -1
- package/_bundled_plugin/skills/security-scan/agents/openai.yaml +1 -1
- package/_bundled_plugin/skills/security-scan/references/desktop-scan.md +1 -1
- package/_bundled_plugin/skills/security-scan/references/scan-artifacts-and-ledger.md +2 -0
- package/_bundled_plugin/skills/track-findings/SKILL.md +8 -4
- package/_bundled_plugin/skills/track-findings/agents/openai.yaml +1 -1
- package/_bundled_plugin/skills/track-findings/references/github-security-advisories.md +1 -1
- package/dist/api.d.ts +3 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +212 -3
- package/dist/api.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +15 -5
- package/dist/cli.js.map +1 -1
- package/dist/component-plan.js +1 -1
- package/dist/component-plan.js.map +1 -1
- package/dist/component-scan.d.ts.map +1 -1
- package/dist/component-scan.js +5 -4
- package/dist/component-scan.js.map +1 -1
- package/dist/contract.d.ts +1 -0
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +4 -3
- package/dist/contract.js.map +1 -1
- package/dist/custom-validation-prompt.js +1 -1
- package/dist/custom-validation-prompt.js.map +1 -1
- package/dist/deduplication/codex-review.d.ts +1 -5
- package/dist/deduplication/codex-review.d.ts.map +1 -1
- package/dist/deduplication/codex-review.js +2 -2
- package/dist/deduplication/codex-review.js.map +1 -1
- package/dist/deduplication/deduplication-reviewer.d.ts +1 -1
- package/dist/deduplication/deduplication-reviewer.d.ts.map +1 -1
- package/dist/deduplication/deduplication-reviewer.js +1 -1
- package/dist/deduplication/deduplication-reviewer.js.map +1 -1
- package/dist/deduplication/records-protocol.d.ts +3 -8
- package/dist/deduplication/records-protocol.d.ts.map +1 -1
- package/dist/deduplication/records-protocol.js +11 -171
- package/dist/deduplication/records-protocol.js.map +1 -1
- package/dist/deep-progress.d.ts +15 -1
- package/dist/deep-progress.d.ts.map +1 -1
- package/dist/deep-progress.js +15 -16
- package/dist/deep-progress.js.map +1 -1
- package/dist/executable-path.d.ts +2 -0
- package/dist/executable-path.d.ts.map +1 -0
- package/dist/executable-path.js +12 -0
- package/dist/executable-path.js.map +1 -0
- package/dist/feedback.d.ts +1 -4
- package/dist/feedback.d.ts.map +1 -1
- package/dist/feedback.js +1 -1
- package/dist/feedback.js.map +1 -1
- package/dist/host-protocol.d.ts +19 -0
- package/dist/host-protocol.d.ts.map +1 -0
- package/dist/host-protocol.js +270 -0
- package/dist/host-protocol.js.map +1 -0
- package/dist/hosted-scan-protocol.d.ts +4 -0
- package/dist/hosted-scan-protocol.d.ts.map +1 -0
- package/dist/hosted-scan-protocol.js +25 -0
- package/dist/hosted-scan-protocol.js.map +1 -0
- package/dist/hosted-scan.d.ts +117 -0
- package/dist/hosted-scan.d.ts.map +1 -0
- package/dist/hosted-scan.js +260 -0
- package/dist/hosted-scan.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +47 -9
- package/dist/multiscan.js.map +1 -1
- package/dist/publication-store.d.ts.map +1 -1
- package/dist/publication-store.js +73 -63
- package/dist/publication-store.js.map +1 -1
- package/dist/publication.d.ts +0 -2
- package/dist/publication.d.ts.map +1 -1
- package/dist/publication.js +0 -5
- package/dist/publication.js.map +1 -1
- package/dist/runtime.d.ts +5 -2
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +5 -38
- package/dist/runtime.js.map +1 -1
- package/dist/scan-executor.d.ts +104 -0
- package/dist/scan-executor.d.ts.map +1 -0
- package/dist/scan-executor.js +62 -0
- package/dist/scan-executor.js.map +1 -0
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +17 -25
- package/dist/targets.js.map +1 -1
- package/dist/worker-progress.d.ts +43 -11
- package/dist/worker-progress.d.ts.map +1 -1
- package/dist/worker-progress.js +21 -37
- package/dist/worker-progress.js.map +1 -1
- package/docs/cli.md +12 -2
- package/docs/hosted-scans.md +242 -0
- package/package.json +9 -7
- package/schemas/hosted-scan-v2.fixture.json +145 -0
package/dist/worker-progress.js
CHANGED
|
@@ -1,14 +1,30 @@
|
|
|
1
1
|
import { isRecord } from "./record.js";
|
|
2
2
|
import { isSafeNonNegativeInteger, parseJson } from "./value.js";
|
|
3
|
+
import { z } from "zod";
|
|
3
4
|
const WORKER_STATUS_PREFIX = "CODEX_SECURITY_WORKER_STATUS ";
|
|
4
5
|
const SCAN_PROGRESS_PREFIX = "CODEX_SECURITY_SCAN_PROGRESS ";
|
|
5
6
|
const PREFLIGHT_COMMAND = /(?:^|[\\/])config_preflight\.py(?=$|["'\s])/u;
|
|
6
|
-
const
|
|
7
|
+
const workerPhaseSchema = z.enum([
|
|
7
8
|
"ranking",
|
|
8
9
|
"file_review",
|
|
9
10
|
"validation",
|
|
10
11
|
"attack_path",
|
|
11
12
|
]);
|
|
13
|
+
const scanPhaseSchema = z.enum([
|
|
14
|
+
"preflight",
|
|
15
|
+
"threat_model",
|
|
16
|
+
"discovery",
|
|
17
|
+
"validation",
|
|
18
|
+
"attack_path",
|
|
19
|
+
"reporting",
|
|
20
|
+
]);
|
|
21
|
+
const count = z.number().int().nonnegative();
|
|
22
|
+
const scanProgressSchema = z
|
|
23
|
+
.object({ phase: scanPhaseSchema, filesCompleted: count, filesTotal: count })
|
|
24
|
+
.refine(({ filesCompleted, filesTotal }) => filesCompleted <= filesTotal);
|
|
25
|
+
const dispatchSchema = z
|
|
26
|
+
.object({ phase: workerPhaseSchema, planned: count, started: count })
|
|
27
|
+
.refine(({ started, planned }) => started <= planned);
|
|
12
28
|
export function scanPhaseLabel(value) {
|
|
13
29
|
return {
|
|
14
30
|
preflight: "preflight",
|
|
@@ -79,19 +95,8 @@ function linesOutsideFences(text) {
|
|
|
79
95
|
return lines;
|
|
80
96
|
}
|
|
81
97
|
function scanProgressFromMarker(marker) {
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
!isScanPhase(payload["phase"]) ||
|
|
85
|
-
!isSafeNonNegativeInteger(payload["filesCompleted"]) ||
|
|
86
|
-
!isSafeNonNegativeInteger(payload["filesTotal"]) ||
|
|
87
|
-
payload["filesCompleted"] > payload["filesTotal"]) {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
return {
|
|
91
|
-
phase: payload["phase"],
|
|
92
|
-
filesCompleted: payload["filesCompleted"],
|
|
93
|
-
filesTotal: payload["filesTotal"],
|
|
94
|
-
};
|
|
98
|
+
const parsed = scanProgressSchema.safeParse(parseJson(() => marker.slice(SCAN_PROGRESS_PREFIX.length)));
|
|
99
|
+
return parsed.success ? parsed.data : null;
|
|
95
100
|
}
|
|
96
101
|
function preflightStatus(item) {
|
|
97
102
|
if (typeof item["command"] !== "string" ||
|
|
@@ -139,28 +144,7 @@ function dispatchStatus(item) {
|
|
|
139
144
|
const marker = markers[0];
|
|
140
145
|
if (markers.length !== 1 || marker === undefined)
|
|
141
146
|
return null;
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
typeof payload["phase"] !== "string" ||
|
|
145
|
-
!WORKER_PHASES.has(payload["phase"]) ||
|
|
146
|
-
!isSafeNonNegativeInteger(payload["planned"]) ||
|
|
147
|
-
!isSafeNonNegativeInteger(payload["started"]) ||
|
|
148
|
-
payload["started"] > payload["planned"]) {
|
|
149
|
-
return null;
|
|
150
|
-
}
|
|
151
|
-
return {
|
|
152
|
-
kind: "dispatch",
|
|
153
|
-
phase: payload["phase"],
|
|
154
|
-
planned: payload["planned"],
|
|
155
|
-
started: payload["started"],
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
function isScanPhase(value) {
|
|
159
|
-
return (value === "preflight" ||
|
|
160
|
-
value === "threat_model" ||
|
|
161
|
-
value === "discovery" ||
|
|
162
|
-
value === "validation" ||
|
|
163
|
-
value === "attack_path" ||
|
|
164
|
-
value === "reporting");
|
|
147
|
+
const parsed = dispatchSchema.safeParse(parseJson(() => marker.slice(WORKER_STATUS_PREFIX.length)));
|
|
148
|
+
return parsed.success ? { kind: "dispatch", ...parsed.data } : null;
|
|
165
149
|
}
|
|
166
150
|
//# sourceMappingURL=worker-progress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-progress.js","sourceRoot":"","sources":["../src/worker-progress.ts"],"names":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AAC,OAAO,CAAC,KAAK,QAAQ;QACpC,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACpC,CAAC,wBAAwB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC7C,CAAC,wBAAwB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC7C,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,EACvC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,OAAO,CAAC,OAAO,CAAoB;QAC1C,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC;QAC3B,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC;KAC5B,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,CACL,KAAK,KAAK,WAAW;QACrB,KAAK,KAAK,cAAc;QACxB,KAAK,KAAK,WAAW;QACrB,KAAK,KAAK,YAAY;QACtB,KAAK,KAAK,aAAa;QACvB,KAAK,KAAK,WAAW,CACtB,CAAC;AACJ,CAAC","sourcesContent":["import { isRecord } from \"./record.js\";\nimport { isSafeNonNegativeInteger, parseJson } from \"./value.js\";\n\nconst WORKER_STATUS_PREFIX = \"CODEX_SECURITY_WORKER_STATUS \";\nconst SCAN_PROGRESS_PREFIX = \"CODEX_SECURITY_SCAN_PROGRESS \";\nconst PREFLIGHT_COMMAND = /(?:^|[\\\\/])config_preflight\\.py(?=$|[\"'\\s])/u;\nconst WORKER_PHASES = new Set([\n \"ranking\",\n \"file_review\",\n \"validation\",\n \"attack_path\",\n]);\n\nexport type ScanWorkerPhase =\n \"ranking\" | \"file_review\" | \"validation\" | \"attack_path\";\n\nexport type ScanPhase =\n | \"preflight\"\n | \"threat_model\"\n | \"discovery\"\n | \"validation\"\n | \"attack_path\"\n | \"reporting\";\n\nexport interface ScanProgress {\n phase: ScanPhase;\n filesCompleted: number;\n filesTotal: number;\n}\n\nexport function scanPhaseLabel(value: ScanWorkerPhase | ScanPhase): string {\n return {\n preflight: \"preflight\",\n threat_model: \"building threat model\",\n discovery: \"reviewing files\",\n ranking: \"ranking scan targets\",\n file_review: \"reviewing files\",\n validation: \"validating findings\",\n attack_path: \"analyzing attack paths\",\n reporting: \"writing report\",\n }[value];\n}\n\n/** Preflight is tool-derived; dispatch counts depend on model-emitted markers. */\nexport type ScanWorkerStatus =\n | {\n kind: \"preflight\";\n delegation: \"available\" | \"unavailable\" | \"unknown\";\n configuredSlots: number | null;\n }\n | {\n kind: \"dispatch\";\n phase: ScanWorkerPhase;\n planned: number;\n started: number;\n };\n\nexport function workerStatusFromEvent(\n event: Readonly<Record<string, unknown>>,\n): ScanWorkerStatus | null {\n if (event[\"type\"] !== \"item.completed\" || !isRecord(event[\"item\"])) {\n return null;\n }\n const item = event[\"item\"];\n if (item[\"type\"] === \"command_execution\") return preflightStatus(item);\n if (item[\"type\"] === \"agent_message\") return dispatchStatus(item);\n return null;\n}\n\nexport function scanProgressUpdatesFromEvent(\n event: Readonly<Record<string, unknown>>,\n): ScanProgress[] {\n if (event[\"type\"] !== \"item.completed\" || !isRecord(event[\"item\"])) {\n return [];\n }\n const item = event[\"item\"];\n const output =\n item[\"type\"] === \"agent_message\"\n ? item[\"text\"]\n : item[\"type\"] === \"command_execution\"\n ? item[\"aggregated_output\"]\n : null;\n return typeof output === \"string\" ? scanProgressUpdatesFromText(output) : [];\n}\n\nexport function scanProgressUpdatesFromText(output: string): ScanProgress[] {\n const updates: ScanProgress[] = [];\n for (const line of linesOutsideFences(output)) {\n if (!line.startsWith(SCAN_PROGRESS_PREFIX)) continue;\n const progress = scanProgressFromMarker(line);\n if (progress !== null) updates.push(progress);\n }\n return updates;\n}\n\n/** Return lines outside Markdown fences so quoted markers are not read as live. */\nfunction linesOutsideFences(text: string): string[] {\n const lines: string[] = [];\n let fence: { marker: string; length: number } | null = null;\n for (const line of text.split(/\\r?\\n/u)) {\n const delimiter = /^\\s*(`{3,}|~{3,})(.*)$/u.exec(line);\n if (delimiter !== null) {\n const run = delimiter[1]!;\n if (fence === null) {\n fence = { marker: run[0]!, length: run.length };\n } else if (\n run[0] === fence.marker &&\n run.length >= fence.length &&\n delimiter[2]!.trim() === \"\"\n ) {\n fence = null;\n }\n continue;\n }\n if (fence === null) lines.push(line);\n }\n return lines;\n}\n\nfunction scanProgressFromMarker(marker: string): ScanProgress | null {\n const payload = parseJson(() => marker.slice(SCAN_PROGRESS_PREFIX.length));\n if (\n !isRecord(payload) ||\n !isScanPhase(payload[\"phase\"]) ||\n !isSafeNonNegativeInteger(payload[\"filesCompleted\"]) ||\n !isSafeNonNegativeInteger(payload[\"filesTotal\"]) ||\n payload[\"filesCompleted\"] > payload[\"filesTotal\"]\n ) {\n return null;\n }\n return {\n phase: payload[\"phase\"],\n filesCompleted: payload[\"filesCompleted\"],\n filesTotal: payload[\"filesTotal\"],\n };\n}\n\nfunction preflightStatus(\n item: Readonly<Record<string, unknown>>,\n): ScanWorkerStatus | null {\n if (\n typeof item[\"command\"] !== \"string\" ||\n !PREFLIGHT_COMMAND.test(item[\"command\"]) ||\n typeof item[\"aggregated_output\"] !== \"string\"\n ) {\n return null;\n }\n const payload = parseJson(() => item[\"aggregated_output\"] as string);\n if (\n !isRecord(payload) ||\n (payload[\"profile\"] !== \"security_scan\" &&\n payload[\"profile\"] !== \"security_diff_scan\") ||\n !Array.isArray(payload[\"results\"])\n ) {\n return null;\n }\n const results = payload[\"results\"];\n const delegated = results.filter(\n (result): result is Record<string, unknown> =>\n isRecord(result) && result[\"capability\"] === \"delegated_workers\",\n );\n const delegatedResult = delegated[0];\n if (delegated.length !== 1 || delegatedResult === undefined) return null;\n const delegation =\n delegatedResult[\"status\"] === \"pass\"\n ? \"available\"\n : delegatedResult[\"status\"] === \"fail\"\n ? \"unavailable\"\n : delegatedResult[\"status\"] === \"unknown\"\n ? \"unknown\"\n : null;\n if (delegation === null) return null;\n const capacity = results.filter(\n (result): result is Record<string, unknown> =>\n isRecord(result) &&\n typeof result[\"capability\"] === \"string\" &&\n result[\"capability\"].startsWith(\"usable_worker_slots_\"),\n );\n if (capacity.length > 1) return null;\n const capacityResult = capacity[0];\n const configuredSlots =\n capacityResult !== undefined &&\n isSafeNonNegativeInteger(capacityResult[\"actual\"])\n ? capacityResult[\"actual\"]\n : null;\n return { kind: \"preflight\", delegation, configuredSlots };\n}\n\nfunction dispatchStatus(\n item: Readonly<Record<string, unknown>>,\n): ScanWorkerStatus | null {\n if (typeof item[\"text\"] !== \"string\") return null;\n const markers = linesOutsideFences(item[\"text\"]).filter((line) =>\n line.startsWith(WORKER_STATUS_PREFIX),\n );\n const marker = markers[0];\n if (markers.length !== 1 || marker === undefined) return null;\n const payload = parseJson(() => marker.slice(WORKER_STATUS_PREFIX.length));\n if (\n !isRecord(payload) ||\n typeof payload[\"phase\"] !== \"string\" ||\n !WORKER_PHASES.has(payload[\"phase\"]) ||\n !isSafeNonNegativeInteger(payload[\"planned\"]) ||\n !isSafeNonNegativeInteger(payload[\"started\"]) ||\n payload[\"started\"] > payload[\"planned\"]\n ) {\n return null;\n }\n return {\n kind: \"dispatch\",\n phase: payload[\"phase\"] as ScanWorkerPhase,\n planned: payload[\"planned\"],\n started: payload[\"started\"],\n };\n}\n\nfunction isScanPhase(value: unknown): value is ScanPhase {\n return (\n value === \"preflight\" ||\n value === \"threat_model\" ||\n value === \"discovery\" ||\n value === \"validation\" ||\n value === \"attack_path\" ||\n value === \"reporting\"\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"worker-progress.js","sourceRoot":"","sources":["../src/worker-progress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,oBAAoB,GAAG,+BAA+B,CAAC;AAC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,OAAO,IAAI,CAAC;IAC9D,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,CACrC,SAAS,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAC3D,CAAC;IACF,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACtE,CAAC","sourcesContent":["import { isRecord } from \"./record.js\";\nimport { isSafeNonNegativeInteger, parseJson } from \"./value.js\";\nimport { z } from \"zod\";\n\nconst WORKER_STATUS_PREFIX = \"CODEX_SECURITY_WORKER_STATUS \";\nconst SCAN_PROGRESS_PREFIX = \"CODEX_SECURITY_SCAN_PROGRESS \";\nconst PREFLIGHT_COMMAND = /(?:^|[\\\\/])config_preflight\\.py(?=$|[\"'\\s])/u;\nconst workerPhaseSchema = z.enum([\n \"ranking\",\n \"file_review\",\n \"validation\",\n \"attack_path\",\n]);\n\nexport type ScanWorkerPhase = z.infer<typeof workerPhaseSchema>;\n\nconst scanPhaseSchema = z.enum([\n \"preflight\",\n \"threat_model\",\n \"discovery\",\n \"validation\",\n \"attack_path\",\n \"reporting\",\n]);\nexport type ScanPhase = z.infer<typeof scanPhaseSchema>;\n\nconst count = z.number().int().nonnegative();\nconst scanProgressSchema = z\n .object({ phase: scanPhaseSchema, filesCompleted: count, filesTotal: count })\n .refine(({ filesCompleted, filesTotal }) => filesCompleted <= filesTotal);\nconst dispatchSchema = z\n .object({ phase: workerPhaseSchema, planned: count, started: count })\n .refine(({ started, planned }) => started <= planned);\n\nexport interface ScanProgress extends z.infer<typeof scanProgressSchema> {}\n\nexport function scanPhaseLabel(value: ScanWorkerPhase | ScanPhase): string {\n return {\n preflight: \"preflight\",\n threat_model: \"building threat model\",\n discovery: \"reviewing files\",\n ranking: \"ranking scan targets\",\n file_review: \"reviewing files\",\n validation: \"validating findings\",\n attack_path: \"analyzing attack paths\",\n reporting: \"writing report\",\n }[value];\n}\n\n/** Preflight is tool-derived; dispatch counts depend on model-emitted markers. */\nexport type ScanWorkerStatus =\n | {\n kind: \"preflight\";\n delegation: \"available\" | \"unavailable\" | \"unknown\";\n configuredSlots: number | null;\n }\n | ({ kind: \"dispatch\" } & z.infer<typeof dispatchSchema>);\n\nexport function workerStatusFromEvent(\n event: Readonly<Record<string, unknown>>,\n): ScanWorkerStatus | null {\n if (event[\"type\"] !== \"item.completed\" || !isRecord(event[\"item\"])) {\n return null;\n }\n const item = event[\"item\"];\n if (item[\"type\"] === \"command_execution\") return preflightStatus(item);\n if (item[\"type\"] === \"agent_message\") return dispatchStatus(item);\n return null;\n}\n\nexport function scanProgressUpdatesFromEvent(\n event: Readonly<Record<string, unknown>>,\n): ScanProgress[] {\n if (event[\"type\"] !== \"item.completed\" || !isRecord(event[\"item\"])) {\n return [];\n }\n const item = event[\"item\"];\n const output =\n item[\"type\"] === \"agent_message\"\n ? item[\"text\"]\n : item[\"type\"] === \"command_execution\"\n ? item[\"aggregated_output\"]\n : null;\n return typeof output === \"string\" ? scanProgressUpdatesFromText(output) : [];\n}\n\nexport function scanProgressUpdatesFromText(output: string): ScanProgress[] {\n const updates: ScanProgress[] = [];\n for (const line of linesOutsideFences(output)) {\n if (!line.startsWith(SCAN_PROGRESS_PREFIX)) continue;\n const progress = scanProgressFromMarker(line);\n if (progress !== null) updates.push(progress);\n }\n return updates;\n}\n\n/** Return lines outside Markdown fences so quoted markers are not read as live. */\nfunction linesOutsideFences(text: string): string[] {\n const lines: string[] = [];\n let fence: { marker: string; length: number } | null = null;\n for (const line of text.split(/\\r?\\n/u)) {\n const delimiter = /^\\s*(`{3,}|~{3,})(.*)$/u.exec(line);\n if (delimiter !== null) {\n const run = delimiter[1]!;\n if (fence === null) {\n fence = { marker: run[0]!, length: run.length };\n } else if (\n run[0] === fence.marker &&\n run.length >= fence.length &&\n delimiter[2]!.trim() === \"\"\n ) {\n fence = null;\n }\n continue;\n }\n if (fence === null) lines.push(line);\n }\n return lines;\n}\n\nfunction scanProgressFromMarker(marker: string): ScanProgress | null {\n const parsed = scanProgressSchema.safeParse(\n parseJson(() => marker.slice(SCAN_PROGRESS_PREFIX.length)),\n );\n return parsed.success ? parsed.data : null;\n}\n\nfunction preflightStatus(\n item: Readonly<Record<string, unknown>>,\n): ScanWorkerStatus | null {\n if (\n typeof item[\"command\"] !== \"string\" ||\n !PREFLIGHT_COMMAND.test(item[\"command\"]) ||\n typeof item[\"aggregated_output\"] !== \"string\"\n ) {\n return null;\n }\n const payload = parseJson(() => item[\"aggregated_output\"] as string);\n if (\n !isRecord(payload) ||\n (payload[\"profile\"] !== \"security_scan\" &&\n payload[\"profile\"] !== \"security_diff_scan\") ||\n !Array.isArray(payload[\"results\"])\n ) {\n return null;\n }\n const results = payload[\"results\"];\n const delegated = results.filter(\n (result): result is Record<string, unknown> =>\n isRecord(result) && result[\"capability\"] === \"delegated_workers\",\n );\n const delegatedResult = delegated[0];\n if (delegated.length !== 1 || delegatedResult === undefined) return null;\n const delegation =\n delegatedResult[\"status\"] === \"pass\"\n ? \"available\"\n : delegatedResult[\"status\"] === \"fail\"\n ? \"unavailable\"\n : delegatedResult[\"status\"] === \"unknown\"\n ? \"unknown\"\n : null;\n if (delegation === null) return null;\n const capacity = results.filter(\n (result): result is Record<string, unknown> =>\n isRecord(result) &&\n typeof result[\"capability\"] === \"string\" &&\n result[\"capability\"].startsWith(\"usable_worker_slots_\"),\n );\n if (capacity.length > 1) return null;\n const capacityResult = capacity[0];\n const configuredSlots =\n capacityResult !== undefined &&\n isSafeNonNegativeInteger(capacityResult[\"actual\"])\n ? capacityResult[\"actual\"]\n : null;\n return { kind: \"preflight\", delegation, configuredSlots };\n}\n\nfunction dispatchStatus(\n item: Readonly<Record<string, unknown>>,\n): ScanWorkerStatus | null {\n if (typeof item[\"text\"] !== \"string\") return null;\n const markers = linesOutsideFences(item[\"text\"]).filter((line) =>\n line.startsWith(WORKER_STATUS_PREFIX),\n );\n const marker = markers[0];\n if (markers.length !== 1 || marker === undefined) return null;\n const parsed = dispatchSchema.safeParse(\n parseJson(() => marker.slice(WORKER_STATUS_PREFIX.length)),\n );\n return parsed.success ? { kind: \"dispatch\", ...parsed.data } : null;\n}\n"]}
|
package/docs/cli.md
CHANGED
|
@@ -1023,10 +1023,16 @@ creation; connected-app access is reported as `not-checked`.
|
|
|
1023
1023
|
|
|
1024
1024
|
Each finding becomes an issue with severity, source, evidence, and remediation.
|
|
1025
1025
|
Choose a destination authorized to receive that content. Local history records
|
|
1026
|
-
successful issue IDs separately from sealed artifacts.
|
|
1026
|
+
successful issue IDs separately from sealed artifacts. The CLI and the plugin's
|
|
1027
|
+
finding-tracking workflow share these records when using the same Codex Security
|
|
1028
|
+
state directory. Accepted writes remain recorded even if a later issue read fails.
|
|
1029
|
+
The shared-history migration preserves existing Linear receipts and replaces their
|
|
1030
|
+
old table. Upgrade CLI and plugin installations together when they share state;
|
|
1031
|
+
older publishers cannot write to the migrated database.
|
|
1027
1032
|
|
|
1028
1033
|
Republishing creates duplicates unless `--skip-existing` finds a recorded success
|
|
1029
|
-
for that occurrence, team, and project
|
|
1034
|
+
for that occurrence, team, and project, including issues created or reused through
|
|
1035
|
+
the plugin. It does not check remote issues or cover
|
|
1030
1036
|
unrecorded/concurrent publication. After interruption, inspect the handoff,
|
|
1031
1037
|
evidence, and destination before retrying.
|
|
1032
1038
|
|
|
@@ -1776,3 +1782,7 @@ capabilities, no-new-privileges, and seccomp policy. Hosts that permit nested us
|
|
|
1776
1782
|
namespaces do not need it. The legacy Landlock fallback is unsupported.
|
|
1777
1783
|
See the [Docker guide](https://github.com/openai/codex-security/blob/main/docker/README.md)
|
|
1778
1784
|
for deployment and source-build instructions.
|
|
1785
|
+
|
|
1786
|
+
### Hosted Standard scan
|
|
1787
|
+
|
|
1788
|
+
`codex-security scan --host` runs one versioned JSON-RPC invocation with an explicit host executor. Use it alone; it never performs local inference. See [the hosted scan protocol](hosted-scans.md) for input, filesystem, artifact, usage, and cancellation requirements.
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# Hosted Standard scans (protocol v2)
|
|
2
|
+
|
|
3
|
+
`codex-security scan --host` runs one scan using newline-delimited JSON-RPC on
|
|
4
|
+
stdin/stdout. Use the flag alone. It performs no login, update check, local
|
|
5
|
+
inference, or model fallback. Ordinary local scans keep their existing behavior.
|
|
6
|
+
|
|
7
|
+
## Public executor API
|
|
8
|
+
|
|
9
|
+
Use the standalone `runHostedScan(input, { executor, signal, onEvent })`
|
|
10
|
+
function to run one hosted Standard scan. `CodexSecurity.run()` retains its local
|
|
11
|
+
scan behavior; it does not accept a hosted executor. The CLI command is a thin
|
|
12
|
+
JSON-RPC adapter around the same standalone function.
|
|
13
|
+
|
|
14
|
+
The CLI owns scan registration, plugin lifecycle, target checks, finalization,
|
|
15
|
+
report generation and sealed artifact validation. The host owns authorization,
|
|
16
|
+
frozen checkout, execution, durable run state, replay, reconciliation, usage,
|
|
17
|
+
billing and cleanup. It collects authoritative usage before cleanup and persists
|
|
18
|
+
accepted output independently from inference. Findings ingestion and
|
|
19
|
+
deduplication consume that accepted output separately. CLI workbench state
|
|
20
|
+
remains scan-domain state; there is no hosted-attempt replay store.
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { runHostedScan, type ScanExecutor } from "@openai/codex-security";
|
|
24
|
+
|
|
25
|
+
const executor: ScanExecutor = {
|
|
26
|
+
async run(request, { signal, onEvent }) {
|
|
27
|
+
// Persist the request identity before dispatch. Mount the matching plugin,
|
|
28
|
+
// checkout, scan state and output directory in the remote executor.
|
|
29
|
+
return await host.executeOnce(request, { signal, onEvent });
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
const result = await runHostedScan(
|
|
33
|
+
{
|
|
34
|
+
version: 2,
|
|
35
|
+
repository: "/workspace/repository",
|
|
36
|
+
revision: "0123456789012345678901234567890123456789",
|
|
37
|
+
scope: { paths: ["services/api", "services/web"] },
|
|
38
|
+
outputDirectory: "/scan/output",
|
|
39
|
+
stateDirectory: "/scan/state",
|
|
40
|
+
model: "gpt-5.6-sol",
|
|
41
|
+
reasoningEffort: "high",
|
|
42
|
+
identity: {
|
|
43
|
+
runId: "run-1",
|
|
44
|
+
attemptId: "attempt-1",
|
|
45
|
+
buildId: "runtime-build",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
executor,
|
|
50
|
+
onEvent(event) {
|
|
51
|
+
console.error(event);
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
// These host methods are application code, outside the CLI.
|
|
57
|
+
await host.persistReceipt(result);
|
|
58
|
+
if (result.status === "completed") {
|
|
59
|
+
// Check the frozen identity/scope and artifact paths, hashes, sizes and seals.
|
|
60
|
+
await host.verifyAndAcceptArtifacts(result);
|
|
61
|
+
} else if (result.status === "acceptance_unknown") {
|
|
62
|
+
// Look up the existing attempt/session; do not call runHostedScan again.
|
|
63
|
+
await host.reconcileExecution(result.identity, result.execution);
|
|
64
|
+
}
|
|
65
|
+
// Failed and canceled receipts remain recorded but are not accepted
|
|
66
|
+
// completed scans. Persistence retries reuse this receipt without more inference.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The function creates and closes its scan client internally, reusing the ordinary
|
|
70
|
+
Standard scan lifecycle. Omit `scope` for the entire repository, or pass literal
|
|
71
|
+
repository-relative folders/files. Model settings come from the frozen input;
|
|
72
|
+
local profiles and other local scan options are not accepted.
|
|
73
|
+
|
|
74
|
+
`ScanExecutor.run` receives an AbortSignal and an optional `onEvent` observer for
|
|
75
|
+
`{type: "progress", progress}` or `{type: "activity", activity}` events. Progress
|
|
76
|
+
uses the existing `ScanProgress` type; activity uses `ScanActivity`. Observer
|
|
77
|
+
failures cannot stop execution. Aborting waits for the executor to settle; the
|
|
78
|
+
host must cancel remote work and return its recorded outcome.
|
|
79
|
+
|
|
80
|
+
Preparation errors throw before execution. Execution and finalization return a
|
|
81
|
+
`HostedScanResult` receipt with status `completed`, `failed`,
|
|
82
|
+
`canceled`, or `acceptance_unknown`. The receipt retains the executor's outcome, session
|
|
83
|
+
identity, usage, message and structured error even if artifact finalization
|
|
84
|
+
fails. Only validated artifacts receive hashes and sizes. Repeated invocations
|
|
85
|
+
are separate scans; the host decides whether a new invocation is allowed.
|
|
86
|
+
|
|
87
|
+
Temporary runtime cleanup failures preserve the terminal receipt, including
|
|
88
|
+
its execution outcome, session identity, usage, and validated artifacts. They
|
|
89
|
+
are reported separately through `onEvent` as a failed message activity with
|
|
90
|
+
ID `runtime.cleanup` (a `scan.progress` notification over JSON-RPC). A cleanup
|
|
91
|
+
failure does not change the scan status or require another execution attempt.
|
|
92
|
+
|
|
93
|
+
## Wire contract
|
|
94
|
+
|
|
95
|
+
Send `{"jsonrpc":"2.0","id":"run","method":"run","params":...}` with the
|
|
96
|
+
parameters below. IDs are strings or safe integers from -9007199254740991 through
|
|
97
|
+
9007199254740991; send larger numeric identifiers as strings.
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"version": 2,
|
|
102
|
+
"repository": "/workspace/repository",
|
|
103
|
+
"revision": "0123456789012345678901234567890123456789",
|
|
104
|
+
"scope": { "paths": ["services/api", "services/web"] },
|
|
105
|
+
"outputDirectory": "/scan/output",
|
|
106
|
+
"stateDirectory": "/scan/state",
|
|
107
|
+
"model": "gpt-5.6-sol",
|
|
108
|
+
"reasoningEffort": "high",
|
|
109
|
+
"identity": {
|
|
110
|
+
"runId": "example-run",
|
|
111
|
+
"attemptId": "example-attempt",
|
|
112
|
+
"buildId": "exact-runtime-build"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Omit `scope` to scan the entire repository, matching the local CLI default.
|
|
118
|
+
`{"paths":["."]}` also means the repository. An explicit empty list is invalid;
|
|
119
|
+
root cannot be mixed with narrower paths. Each entry is one literal filename or
|
|
120
|
+
directory: `app/[slug]/page.tsx` and `reports/a,b.ts` are not patterns or lists.
|
|
121
|
+
Significant whitespace is preserved; `" service "` and `" "` do not select
|
|
122
|
+
`"service"` or the repository. An explicit empty string is invalid. Paths use the
|
|
123
|
+
ordinary CLI target resolver's filename semantics, with repository-relative
|
|
124
|
+
paths required here. They are normalized, deduplicated and sorted without
|
|
125
|
+
changing filename characters. Preparation also checks the existing output
|
|
126
|
+
contract: scope paths must be valid UTF-8 and cannot contain control characters,
|
|
127
|
+
backslashes, or start with a drive prefix such as `C:`. Incompatible filenames
|
|
128
|
+
fail before executor dispatch, including on POSIX where those files may exist.
|
|
129
|
+
Every selected path must exist and remain inside
|
|
130
|
+
the repository at the frozen revision before any execution request. Missing paths fail the whole
|
|
131
|
+
request; the CLI never skips them or broadens the scope. Canonical path aliases
|
|
132
|
+
are rejected with an actionable correction. Diff, Deep, resume, mock, local
|
|
133
|
+
workflow and post-scan execution are unsupported in this hosted Standard API.
|
|
134
|
+
|
|
135
|
+
The CLI verifies HEAD before path existence, registers the scan with its bundled
|
|
136
|
+
workbench, and sends one `execution.run` request. Its JSON-RPC ID equals the
|
|
137
|
+
required `params.requestId`. Params contain `version: 2`, normalized
|
|
138
|
+
`repository`, `revision`, `scope`, `identity`, registered `scanId`, `prompt`,
|
|
139
|
+
`model`, `reasoningEffort`, and `runtime`:
|
|
140
|
+
|
|
141
|
+
- `pluginRoot` and `pluginVersion`: the matching bundled plugin.
|
|
142
|
+
- `stateDirectory` and `outputDirectory`: writable paths outside the repository.
|
|
143
|
+
- `environment`: explicit runtime paths and interpreter settings, never host
|
|
144
|
+
inference credentials.
|
|
145
|
+
|
|
146
|
+
The CLI and executor must share these filesystem paths or explicitly transfer
|
|
147
|
+
the same state. This includes:
|
|
148
|
+
|
|
149
|
+
- The frozen checkout and matching `pluginRoot` tree, including its executable
|
|
150
|
+
helpers, skills, and MCP server.
|
|
151
|
+
- The whole `stateDirectory`, including the registered workbench database,
|
|
152
|
+
journals, and scan inputs; a live database file alone is not a consistent copy.
|
|
153
|
+
- `outputDirectory`, where the executor records its draft and the CLI later
|
|
154
|
+
writes the validated manifest, findings, coverage, and report.
|
|
155
|
+
- The temporary files named by `CODEX_SECURITY_CONFIG_PATH` and, for path scans,
|
|
156
|
+
`CODEX_SECURITY_TARGET_PATHS_FILE` in `runtime.environment`. These are required
|
|
157
|
+
by preflight and scope binding, even though they can live outside the state
|
|
158
|
+
and output directories. The supplied interpreter paths must also resolve.
|
|
159
|
+
|
|
160
|
+
Keep these paths available throughout the invocation. The CLI removes its
|
|
161
|
+
temporary config/scope files when the invocation closes; caller-owned state
|
|
162
|
+
and output directories remain available. If remote work may outlive an
|
|
163
|
+
`acceptance_unknown` return, the host must preserve the files that work still
|
|
164
|
+
needs before returning that outcome. Use shared mounts or a coordinated transfer
|
|
165
|
+
that preserves the supplied path bindings, not independent copies of mutable
|
|
166
|
+
workbench state.
|
|
167
|
+
|
|
168
|
+
Run the plugin stdio server from
|
|
169
|
+
`pluginRoot/scripts/launch_codex_security_mcp --stdio` with the supplied
|
|
170
|
+
environment. The executor needs the target files, plugin skills and registered
|
|
171
|
+
artifacts, and must expose `record_codex_security_scan_draft`. CLI workbench
|
|
172
|
+
finalization follows the turn. Merely returning model text is insufficient.
|
|
173
|
+
Separately provisioned executors must receive the exact frozen runtime/plugin
|
|
174
|
+
build and preserve state; do not interpret plugin schemas as strict Structured
|
|
175
|
+
Outputs schemas.
|
|
176
|
+
|
|
177
|
+
The execution response `result` has:
|
|
178
|
+
|
|
179
|
+
- Required `requestId` matching the execution request, and `status`:
|
|
180
|
+
`completed`, `failed`, `canceled`, or `acceptance_unknown`.
|
|
181
|
+
- `sessionId`, required for completed execution and optional for other outcomes.
|
|
182
|
+
- Optional `finalResponse`, `message`, and structured `error` with numeric `code`,
|
|
183
|
+
string `message` and optional `data`.
|
|
184
|
+
- Optional opaque host `usage`. Absence means unknown, never zero. The host collects
|
|
185
|
+
it for diagnostics; these observations do not replace authoritative accounting.
|
|
186
|
+
|
|
187
|
+
A transport failure or mismatched receipt is not proof of non-acceptance. The
|
|
188
|
+
CLI stops without resubmitting and leaves reconciliation to the host. The terminal
|
|
189
|
+
result retains `execution` even when scanning fails or is canceled. The runtime's
|
|
190
|
+
`hostProtocolVersion` identifies this protocol as version 2.
|
|
191
|
+
A package-exported example is available at
|
|
192
|
+
`@openai/codex-security/schemas/hosted-scan-v2.fixture.json`. Its `response` is
|
|
193
|
+
the executor's reply; `terminal` is the separate final scan receipt. The example
|
|
194
|
+
hashes and sizes are illustrative and do not validate any real files.
|
|
195
|
+
|
|
196
|
+
| Final scan status | Host handling |
|
|
197
|
+
| ---------------------- | ------------------------------------------------------------------------------------------------ |
|
|
198
|
+
| `completed` | Verify artifact receipts and seals before accepting output. |
|
|
199
|
+
| `failed` or `canceled` | Retain identity, diagnostics and any execution/usage receipt. |
|
|
200
|
+
| `acceptance_unknown` | Reconcile the existing remote attempt and collect usage before cleanup; do not resubmit blindly. |
|
|
201
|
+
|
|
202
|
+
Reconciliation uses the host's durable attempt/session identifiers and provider
|
|
203
|
+
status. Preserve state and output for inspection, and cancel or join remote work
|
|
204
|
+
before releasing resources it still uses. The hosted API has no replay store,
|
|
205
|
+
resume, or finalize-only operation: calling `runHostedScan` again registers a new
|
|
206
|
+
scan. A provider reporting execution completion does not substitute for a
|
|
207
|
+
validated, sealed scan receipt.
|
|
208
|
+
|
|
209
|
+
## Progress, cancellation and artifacts
|
|
210
|
+
|
|
211
|
+
The host sends `execution.progress` notifications with `{requestId, event}`.
|
|
212
|
+
The CLI forwards valid progress/activity through `scan.progress` notifications
|
|
213
|
+
with `{id: <original run RPC id>, event}`. Invalid optional event payloads are
|
|
214
|
+
ignored; mismatched request IDs are rejected. Stdout contains JSON-RPC only.
|
|
215
|
+
|
|
216
|
+
Send `{"jsonrpc":"2.0","method":"cancel","params":{"id":"run"}}` with the
|
|
217
|
+
original run request ID. The CLI aborts its executor signal, emits
|
|
218
|
+
`execution.cancel` with `{requestId}`, and waits for the host's outcome/usage
|
|
219
|
+
before returning a canceled result. The host must continue reading notifications
|
|
220
|
+
while executing. SIGINT/SIGTERM, output errors/closure, and cancellation with
|
|
221
|
+
blocked output terminate the transport even while a write callback is stuck.
|
|
222
|
+
Input EOF before the terminal response fails the run; EOF while that response is
|
|
223
|
+
flushing waits for the write callback. A selected successful result is not a
|
|
224
|
+
successful delivery. Hosts own deadlines and independently cancel remote work
|
|
225
|
+
and reconcile known execution identities after transport failure.
|
|
226
|
+
|
|
227
|
+
Preparation failures include typed `error.data.reason` for missing, escaping,
|
|
228
|
+
aliased or syntactically invalid paths and revision mismatch. Other failures
|
|
229
|
+
must not be presented as missing paths.
|
|
230
|
+
|
|
231
|
+
The terminal run result includes `version: 2`, `status`, frozen
|
|
232
|
+
identity/revision/normalized scope, output directory, scan ID when registered,
|
|
233
|
+
plugin version when known, `provenance` (CLI/plugin/build identity), optional `execution`,
|
|
234
|
+
and `artifacts`. Each artifact is `{path, sha256, bytes}` over its exact bytes.
|
|
235
|
+
Receipts cover canonical outputs, sealed supplemental files, and preserved
|
|
236
|
+
source files bound by the manifest. Coverage limitations remain diagnostics in
|
|
237
|
+
completed scans; required-output failures return `failed`, and unvalidated files
|
|
238
|
+
never receive artifact receipts. `acceptance_unknown`, failed
|
|
239
|
+
and canceled results are not accepted completed scans.
|
|
240
|
+
|
|
241
|
+
The host verifies receipt paths, hashes, sizes, scope, revision and seals before
|
|
242
|
+
accepting output.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openai/codex-security",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "TypeScript SDK and CLI for Codex Security",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "OpenAI",
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"import": "./dist/index.js",
|
|
29
29
|
"default": "./dist/index.js"
|
|
30
30
|
},
|
|
31
|
-
"./schemas/project-config.schema.json": "./schemas/project-config.schema.json"
|
|
31
|
+
"./schemas/project-config.schema.json": "./schemas/project-config.schema.json",
|
|
32
|
+
"./schemas/hosted-scan-v2.fixture.json": "./schemas/hosted-scan-v2.fixture.json"
|
|
32
33
|
},
|
|
33
34
|
"bin": {
|
|
34
35
|
"codex-security": "./bin/codex-security.mjs",
|
|
@@ -43,7 +44,8 @@
|
|
|
43
44
|
"README.md",
|
|
44
45
|
"docs/cli.md",
|
|
45
46
|
"docs/findings-service.md",
|
|
46
|
-
"docs/dedupe-records.md"
|
|
47
|
+
"docs/dedupe-records.md",
|
|
48
|
+
"docs/hosted-scans.md"
|
|
47
49
|
],
|
|
48
50
|
"publishConfig": {
|
|
49
51
|
"access": "public",
|
|
@@ -53,10 +55,10 @@
|
|
|
53
55
|
},
|
|
54
56
|
"dependencies": {
|
|
55
57
|
"@inquirer/prompts": "8.7.3",
|
|
56
|
-
"@linear/sdk": "97.
|
|
58
|
+
"@linear/sdk": "97.1.0",
|
|
57
59
|
"@octokit/core": "7.0.8",
|
|
58
|
-
"@openai/codex": "0.
|
|
59
|
-
"@openai/codex-sdk": "0.
|
|
60
|
+
"@openai/codex": "0.163.0",
|
|
61
|
+
"@openai/codex-sdk": "0.163.0",
|
|
60
62
|
"ajv": "8.20.0",
|
|
61
63
|
"fflate": "0.8.3",
|
|
62
64
|
"incur": "0.7.0",
|
|
@@ -91,7 +93,7 @@
|
|
|
91
93
|
"saxes": "6.0.0",
|
|
92
94
|
"typescript": "7.0.2"
|
|
93
95
|
},
|
|
94
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "559b492b22bb457aea8ff88c1bd41aacc2cec8bf",
|
|
95
97
|
"scripts": {
|
|
96
98
|
"audit:prod": "pnpm audit --prod --audit-level high",
|
|
97
99
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
{
|
|
2
|
+
"run": {
|
|
3
|
+
"jsonrpc": "2.0",
|
|
4
|
+
"id": "run",
|
|
5
|
+
"method": "run",
|
|
6
|
+
"params": {
|
|
7
|
+
"version": 2,
|
|
8
|
+
"repository": "/workspace/repository",
|
|
9
|
+
"revision": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
10
|
+
"scope": {
|
|
11
|
+
"paths": ["service-a", "service-b"]
|
|
12
|
+
},
|
|
13
|
+
"outputDirectory": "/scan/output",
|
|
14
|
+
"stateDirectory": "/scan/state",
|
|
15
|
+
"model": "fixture-model",
|
|
16
|
+
"reasoningEffort": "medium",
|
|
17
|
+
"identity": {
|
|
18
|
+
"runId": "run-1",
|
|
19
|
+
"attemptId": "attempt-1",
|
|
20
|
+
"buildId": "fixture-build"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"execution": {
|
|
25
|
+
"jsonrpc": "2.0",
|
|
26
|
+
"id": "request-1",
|
|
27
|
+
"method": "execution.run",
|
|
28
|
+
"params": {
|
|
29
|
+
"version": 2,
|
|
30
|
+
"repository": "/workspace/repository",
|
|
31
|
+
"revision": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
32
|
+
"scope": {
|
|
33
|
+
"paths": ["service-a", "service-b"]
|
|
34
|
+
},
|
|
35
|
+
"identity": {
|
|
36
|
+
"runId": "run-1",
|
|
37
|
+
"attemptId": "attempt-1",
|
|
38
|
+
"buildId": "fixture-build"
|
|
39
|
+
},
|
|
40
|
+
"model": "fixture-model",
|
|
41
|
+
"reasoningEffort": "medium",
|
|
42
|
+
"requestId": "request-1",
|
|
43
|
+
"scanId": "scan-1",
|
|
44
|
+
"prompt": "Scan the selected paths.",
|
|
45
|
+
"runtime": {
|
|
46
|
+
"pluginRoot": "/opt/runtime/cli/_bundled_plugin",
|
|
47
|
+
"pluginVersion": "0.1.95",
|
|
48
|
+
"stateDirectory": "/scan/state",
|
|
49
|
+
"outputDirectory": "/scan/output",
|
|
50
|
+
"environment": {
|
|
51
|
+
"CODEX_SECURITY_STATE_DIR": "/scan/state",
|
|
52
|
+
"CODEX_SECURITY_CONFIG_PATH": "/scan/tmp/config-preflight.toml",
|
|
53
|
+
"CODEX_SECURITY_TARGET_PATHS_FILE": "/scan/tmp/target-paths.json"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"progress": {
|
|
59
|
+
"jsonrpc": "2.0",
|
|
60
|
+
"method": "execution.progress",
|
|
61
|
+
"params": {
|
|
62
|
+
"requestId": "request-1",
|
|
63
|
+
"event": {
|
|
64
|
+
"type": "progress",
|
|
65
|
+
"progress": {
|
|
66
|
+
"phase": "discovery",
|
|
67
|
+
"filesCompleted": 1,
|
|
68
|
+
"filesTotal": 2
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"response": {
|
|
74
|
+
"jsonrpc": "2.0",
|
|
75
|
+
"id": "request-1",
|
|
76
|
+
"result": {
|
|
77
|
+
"requestId": "request-1",
|
|
78
|
+
"status": "completed",
|
|
79
|
+
"sessionId": "session-1",
|
|
80
|
+
"usage": {
|
|
81
|
+
"input_tokens": 12,
|
|
82
|
+
"output_tokens": 6,
|
|
83
|
+
"cached_input_tokens": 0
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"terminal": {
|
|
88
|
+
"jsonrpc": "2.0",
|
|
89
|
+
"id": "run",
|
|
90
|
+
"result": {
|
|
91
|
+
"version": 2,
|
|
92
|
+
"repository": "/workspace/repository",
|
|
93
|
+
"revision": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
94
|
+
"scope": {
|
|
95
|
+
"paths": ["service-a", "service-b"]
|
|
96
|
+
},
|
|
97
|
+
"identity": {
|
|
98
|
+
"runId": "run-1",
|
|
99
|
+
"attemptId": "attempt-1",
|
|
100
|
+
"buildId": "fixture-build"
|
|
101
|
+
},
|
|
102
|
+
"outputDirectory": "/scan/output",
|
|
103
|
+
"status": "completed",
|
|
104
|
+
"scanId": "scan-1",
|
|
105
|
+
"pluginVersion": "0.1.95",
|
|
106
|
+
"provenance": {
|
|
107
|
+
"cliVersion": "0.2.0",
|
|
108
|
+
"pluginVersion": "0.1.95",
|
|
109
|
+
"buildId": "fixture-build"
|
|
110
|
+
},
|
|
111
|
+
"execution": {
|
|
112
|
+
"requestId": "request-1",
|
|
113
|
+
"status": "completed",
|
|
114
|
+
"sessionId": "session-1",
|
|
115
|
+
"usage": {
|
|
116
|
+
"input_tokens": 12,
|
|
117
|
+
"output_tokens": 6,
|
|
118
|
+
"cached_input_tokens": 0
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"artifacts": [
|
|
122
|
+
{
|
|
123
|
+
"path": "scan-manifest.json",
|
|
124
|
+
"sha256": "1111111111111111111111111111111111111111111111111111111111111111",
|
|
125
|
+
"bytes": 1024
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"path": "findings.json",
|
|
129
|
+
"sha256": "2222222222222222222222222222222222222222222222222222222222222222",
|
|
130
|
+
"bytes": 256
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"path": "coverage.json",
|
|
134
|
+
"sha256": "3333333333333333333333333333333333333333333333333333333333333333",
|
|
135
|
+
"bytes": 512
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"path": "report.md",
|
|
139
|
+
"sha256": "4444444444444444444444444444444444444444444444444444444444444444",
|
|
140
|
+
"bytes": 768
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|