@openai/codex-security 0.5.0 → 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 +93 -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/mcp/permission-profile-preflight.mjs +60 -9
- 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/schemas/definitions/artifact-common.schema.json +1 -1
- package/_bundled_plugin/scripts/finalize_scan_contract.py +12 -1
- package/_bundled_plugin/scripts/generate_in_scope_files.py +6 -6
- package/_bundled_plugin/scripts/generate_rank_input.py +12 -6
- package/_bundled_plugin/scripts/report_projection.py +2 -1
- package/_bundled_plugin/scripts/threat_model_projection.py +1 -3
- package/_bundled_plugin/scripts/workbench/saved_coverage.py +234 -0
- package/_bundled_plugin/scripts/workbench_cli.py +5 -7
- package/_bundled_plugin/scripts/workbench_db.py +12 -6
- package/_bundled_plugin/scripts/workbench_finding_workflows.py +2 -0
- package/_bundled_plugin/scripts/workbench_native_indexes.py +10 -7
- package/_bundled_plugin/scripts/workbench_publication.py +4 -3
- package/_bundled_plugin/scripts/workbench_remediation.py +5 -1
- package/_bundled_plugin/scripts/workbench_saved_results.py +542 -148
- package/_bundled_plugin/scripts/workbench_scan_history.py +79 -78
- package/_bundled_plugin/scripts/workbench_scan_usage.py +61 -13
- package/_bundled_plugin/scripts/workbench_target.py +21 -7
- package/_bundled_plugin/scripts/workbench_validation.py +21 -18
- package/_bundled_plugin/shared/workbench-migrations.json +26 -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 +4 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +233 -91
- package/dist/api.js.map +1 -1
- package/dist/classify-scan-severity.d.ts.map +1 -1
- package/dist/classify-scan-severity.js +16 -18
- package/dist/classify-scan-severity.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-daybreak.d.ts +5 -0
- package/dist/cli-daybreak.d.ts.map +1 -0
- package/dist/cli-daybreak.js +89 -0
- package/dist/cli-daybreak.js.map +1 -0
- 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 +12 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1224 -596
- 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/codeowners.js +2 -2
- package/dist/codeowners.js.map +1 -1
- package/dist/component-plan.d.ts.map +1 -1
- package/dist/component-plan.js +3 -2
- package/dist/component-plan.js.map +1 -1
- package/dist/component-scan.js +2 -2
- package/dist/component-scan.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +5 -1
- package/dist/config.js.map +1 -1
- package/dist/cost.d.ts +2 -1
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +17 -8
- package/dist/cost.js.map +1 -1
- package/dist/custom-validation.d.ts.map +1 -1
- package/dist/custom-validation.js +2 -5
- package/dist/custom-validation.js.map +1 -1
- package/dist/deduplication/codex-review.d.ts.map +1 -1
- package/dist/deduplication/codex-review.js +8 -6
- package/dist/deduplication/codex-review.js.map +1 -1
- package/dist/deduplication/local.d.ts.map +1 -1
- package/dist/deduplication/local.js +5 -2
- package/dist/deduplication/local.js.map +1 -1
- package/dist/deduplication/retry.d.ts.map +1 -1
- package/dist/deduplication/retry.js +5 -0
- package/dist/deduplication/retry.js.map +1 -1
- package/dist/deduplication/scan.js +5 -1
- package/dist/deduplication/scan.js.map +1 -1
- package/dist/deep-scan.d.ts +6 -0
- package/dist/deep-scan.d.ts.map +1 -1
- package/dist/deep-scan.js +8 -6
- package/dist/deep-scan.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/findings-import.d.ts.map +1 -1
- package/dist/findings-import.js +23 -3
- package/dist/findings-import.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/host-protocol.d.ts +1 -0
- package/dist/host-protocol.d.ts.map +1 -1
- package/dist/host-protocol.js +1 -1
- package/dist/host-protocol.js.map +1 -1
- package/dist/hosted-remediation-protocol.d.ts +6 -0
- package/dist/hosted-remediation-protocol.d.ts.map +1 -0
- package/dist/hosted-remediation-protocol.js +32 -0
- package/dist/hosted-remediation-protocol.js.map +1 -0
- package/dist/hosted-remediation.d.ts +93 -0
- package/dist/hosted-remediation.d.ts.map +1 -0
- package/dist/hosted-remediation.js +124 -0
- package/dist/hosted-remediation.js.map +1 -0
- 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/import-scan.d.ts +1 -0
- package/dist/import-scan.d.ts.map +1 -1
- package/dist/import-scan.js +5 -1
- package/dist/import-scan.js.map +1 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +3 -1
- package/dist/multiscan.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 +15 -9
- package/dist/project-config.js.map +1 -1
- package/dist/publish.d.ts +2 -0
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +9 -0
- package/dist/publish.js.map +1 -1
- package/dist/remediation.d.ts +69 -0
- package/dist/remediation.d.ts.map +1 -0
- package/dist/remediation.js +121 -0
- package/dist/remediation.js.map +1 -0
- package/dist/request-metadata.d.ts +17 -7
- package/dist/request-metadata.d.ts.map +1 -1
- package/dist/request-metadata.js +43 -8
- package/dist/request-metadata.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 +24 -15
- package/dist/runtime.js.map +1 -1
- package/dist/saved-scan-bootstrap.d.ts +1 -0
- package/dist/saved-scan-bootstrap.d.ts.map +1 -1
- package/dist/saved-scan-bootstrap.js +16 -4
- package/dist/saved-scan-bootstrap.js.map +1 -1
- package/dist/scan-activity.js +8 -8
- package/dist/scan-activity.js.map +1 -1
- package/dist/scan-comparison.d.ts.map +1 -1
- package/dist/scan-comparison.js +15 -9
- package/dist/scan-comparison.js.map +1 -1
- package/dist/scan-dashboard.d.ts.map +1 -1
- package/dist/scan-dashboard.js +12 -6
- package/dist/scan-dashboard.js.map +1 -1
- package/dist/scan-executor.d.ts +5 -1
- package/dist/scan-executor.d.ts.map +1 -1
- package/dist/scan-executor.js +9 -8
- package/dist/scan-executor.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/{deep-progress.d.ts → scan-progress.d.ts} +15 -7
- package/dist/scan-progress.d.ts.map +1 -0
- package/dist/scan-progress.js +138 -0
- package/dist/scan-progress.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 +11 -57
- 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/server/embeddings.d.ts.map +1 -1
- package/dist/server/embeddings.js +4 -0
- package/dist/server/embeddings.js.map +1 -1
- package/dist/server/sqlite-store.d.ts.map +1 -1
- package/dist/server/sqlite-store.js +14 -2
- package/dist/server/sqlite-store.js.map +1 -1
- 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 +11 -3
- 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/timestamps.d.ts +3 -0
- package/dist/timestamps.d.ts.map +1 -0
- package/dist/timestamps.js +14 -0
- package/dist/timestamps.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +13 -2
- package/dist/version.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/dist/workbench-arguments.d.ts.map +1 -1
- package/dist/workbench-arguments.js +9 -3
- package/dist/workbench-arguments.js.map +1 -1
- package/dist/worker-progress.d.ts +11 -1
- package/dist/worker-progress.d.ts.map +1 -1
- package/dist/worker-progress.js +11 -1
- package/dist/worker-progress.js.map +1 -1
- package/docs/classify-severity-records.md +28 -10
- package/docs/cli.md +788 -46
- package/docs/findings-service.md +7 -2
- package/docs/hosted-remediation.md +134 -0
- package/docs/hosted-scans.md +20 -3
- package/package.json +9 -6
- package/schemas/external-findings.schema.json +1421 -0
- package/schemas/project-config.schema.json +4 -0
- package/dist/deep-progress.d.ts.map +0 -1
- package/dist/deep-progress.js +0 -92
- package/dist/deep-progress.js.map +0 -1
package/dist/worker-progress.js
CHANGED
|
@@ -9,7 +9,7 @@ const workerPhaseSchema = z.enum([
|
|
|
9
9
|
"validation",
|
|
10
10
|
"attack_path",
|
|
11
11
|
]);
|
|
12
|
-
const scanPhaseSchema = z.enum([
|
|
12
|
+
export const scanPhaseSchema = z.enum([
|
|
13
13
|
"preflight",
|
|
14
14
|
"threat_model",
|
|
15
15
|
"discovery",
|
|
@@ -24,6 +24,16 @@ const scanProgressSchema = z
|
|
|
24
24
|
const dispatchSchema = z
|
|
25
25
|
.object({ phase: workerPhaseSchema, planned: count, started: count })
|
|
26
26
|
.refine(({ started, planned }) => started <= planned);
|
|
27
|
+
export function scanProgressCount(progress) {
|
|
28
|
+
if (progress.reviewItems !== undefined && progress.reviewItems.total > 0) {
|
|
29
|
+
return { label: "reviews", ...progress.reviewItems };
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
label: "files",
|
|
33
|
+
completed: progress.filesCompleted,
|
|
34
|
+
total: progress.filesTotal,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
27
37
|
export function scanPhaseLabel(value) {
|
|
28
38
|
return {
|
|
29
39
|
preflight: "preflight",
|
|
@@ -1 +1 @@
|
|
|
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,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,oBAAoB,GAAG,+BAA+B,CAAC;AAC7D,MAAM,oBAAoB,GAAG,+BAA+B,CAAC;AAC7D,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC/B,SAAS;IACT,aAAa;IACb,YAAY;IACZ,aAAa;CACd,CAAC,CAAC;AAIH,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC;
|
|
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,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,oBAAoB,GAAG,+BAA+B,CAAC;AAC7D,MAAM,oBAAoB,GAAG,+BAA+B,CAAC;AAC7D,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC/B,SAAS;IACT,aAAa;IACb,YAAY;IACZ,a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,sBAAsB,CAAC,MAAc;IAC5C,MAAM,MAAM,GAAG,kBAAkB,CAAC,SAAS,CACzC,SAAS,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAC3D,CAAC;IACF,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7C,CAAC;AAED,SAAS,cAAc,CACrB,IAAuC;IAEvC,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAClD,MAAM,OAAO,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAC/D,IAAI,CAAC,UAAU,CAAC,oBAAoB,CAAC,CACtC,CAAC;IACF,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC1B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,KAAK,SAAS;QAAE,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 { 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 workerPhaseSchema = z.enum([\n \"ranking\",\n \"file_review\",\n \"validation\",\n \"attack_path\",\n]);\n\nexport type ScanWorkerPhase = z.infer<typeof workerPhaseSchema>;\n\nexport const 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 /** Saved reviews or coverage surfaces; these are not necessarily files. */\n reviewItems?: { completed: number; total: number };\n}\n\nexport function scanProgressCount(progress: ScanProgress): {\n label: \"files\" | \"reviews\";\n completed: number;\n total: number;\n} {\n if (progress.reviewItems !== undefined && progress.reviewItems.total > 0) {\n return { label: \"reviews\", ...progress.reviewItems };\n }\n return {\n label: \"files\",\n completed: progress.filesCompleted,\n total: progress.filesTotal,\n };\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/** Dispatch counts depend on model-emitted markers. */\nexport type ScanWorkerStatus = {\n kind: \"dispatch\";\n} & 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\"] === \"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 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"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
`codex-security classify-severity --records` accepts canonical reports without a
|
|
4
4
|
repository, saved scan, synthetic provenance, local Codex login, or filesystem
|
|
5
5
|
state. It uses the same bidirectional JSON-RPC transport as [record deduplication](dedupe-records.md).
|
|
6
|
-
Use `--records` alone
|
|
6
|
+
Use `--records` alone or with `--runs N`; model execution remains host-provided.
|
|
7
7
|
|
|
8
8
|
The SDK exports `classifySeverityRecords`, `classifySeverityRecordsInputSchema`,
|
|
9
9
|
and their input, result, and review-request types. The protocol and input have
|
|
@@ -25,6 +25,15 @@ Send one newline-delimited JSON-RPC request with `method: "run"` and these param
|
|
|
25
25
|
}
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
The `rubric` field is optional. Omit it to classify with the
|
|
29
|
+
[built-in severity rubric](../src/default-severity-rubric.ts), using the same configured
|
|
30
|
+
independent host reviews and usage accounting. The result echoes its built-in
|
|
31
|
+
revision (currently `1`) and exact Markdown SHA-256. Supplying a custom rubric
|
|
32
|
+
replaces the default completely and preserves the supplied revision/hash binding.
|
|
33
|
+
Do not reuse cached results across differing rubric hashes; preserve the default
|
|
34
|
+
snapshot from the review prompt alongside its returned binding. Default revisions
|
|
35
|
+
are local to the bundled policy, not workspace rubric revisions.
|
|
36
|
+
|
|
28
37
|
`findingJson` is the exact JSON text of an object with nonblank `findingId`,
|
|
29
38
|
`title`, and `summary`. `findingId` must equal the canonical `id`. Optional
|
|
30
39
|
`severity.level` uses `critical`, `high`, `medium`, `low`, or `informational`.
|
|
@@ -36,7 +45,7 @@ normalizing newlines, whitespace, Unicode, object key order, or JSON numbers.
|
|
|
36
45
|
Compute `inputSha256` from `findingJson`, not from its parsed/reserialized object.
|
|
37
46
|
For example, Node uses `createHash("sha256").update(text, "utf8").digest("hex")`;
|
|
38
47
|
Python uses `hashlib.sha256(text.encode("utf-8")).hexdigest()`.
|
|
39
|
-
The CLI recomputes
|
|
48
|
+
The CLI recomputes supplied hashes before requesting any review. Rubric revisions are
|
|
40
49
|
positive safe integers; record revisions are nonnegative safe integers. Duplicate
|
|
41
50
|
canonical IDs and invalid records reject the entire input before host work.
|
|
42
51
|
The implementation snapshots caller input before awaiting model execution and
|
|
@@ -45,8 +54,10 @@ numeric evidence that JavaScript cannot represent exactly.
|
|
|
45
54
|
|
|
46
55
|
## Host execution contract
|
|
47
56
|
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
The `classificationRuns` SDK option or CLI `--runs N` flag accepts
|
|
58
|
+
an integer from 1 through 10 (default: 3), validated before any host work.
|
|
59
|
+
For each record the CLI emits that many sequential `method: "review.run"` requests,
|
|
60
|
+
each with a unique request ID and params containing `requestId`, `stage: "severity-classification"`, explicit
|
|
50
61
|
`model` and `effort`, `trustedInstructions`, untrusted report/rubric `prompt`, and
|
|
51
62
|
an output JSON `schema`. The host must authorize the requested model and effort,
|
|
52
63
|
create a fresh independent review context, preserve the instruction/data boundary,
|
|
@@ -61,7 +72,14 @@ object. Do not wrap the assessment in a string or an array. An assessment contai
|
|
|
61
72
|
`rubricLabel`, `rationale`, separate `confidence`, and nullable `reviewTrigger`.
|
|
62
73
|
Excluded assessments require null level and label; assessed ones require both.
|
|
63
74
|
|
|
64
|
-
The
|
|
75
|
+
The reviews receive identical inputs and do not see earlier answers. The
|
|
76
|
+
most common normalized severity wins; the highest among tied top counts wins
|
|
77
|
+
(`critical` > `high` > `medium` > `low` > `informational`). Exclusion is a separate
|
|
78
|
+
vote: exclusions can win by count, but lose ties to assessed severities. The first answer matching the winner supplies all assessment fields.
|
|
79
|
+
|
|
80
|
+
The host owns model budgets, usage accounting, transport limits, timeouts, and
|
|
81
|
+
session cancellation. Account for every review request, including work preceding
|
|
82
|
+
a later failure; classification results do not aggregate or report token usage.
|
|
65
83
|
Use the transport's `cancel` notification with the active run ID and also stop
|
|
66
84
|
any remote execution. EOF or a broken pipe means disconnection, not successful
|
|
67
85
|
completion. No review is retried automatically, including after an ambiguous
|
|
@@ -70,20 +88,20 @@ host execution error.
|
|
|
70
88
|
## Results and persistence
|
|
71
89
|
|
|
72
90
|
A completed result contains `version: 1`, `status: "completed"`, the rubric's
|
|
73
|
-
`revision` and `sha256`, and `assessments`. Each assessment replaces model-provided
|
|
91
|
+
`revision` and `sha256`, `classificationRuns`, and `assessments`. Each assessment replaces model-provided
|
|
74
92
|
`findingId` with the verified canonical `id`, `revision`, and `inputSha256`.
|
|
75
93
|
The original report and severity are never rewritten.
|
|
76
94
|
|
|
77
95
|
Invalid or mismatched model output and host failures return `status: "unresolved"`,
|
|
78
96
|
an empty `assessments` array, and an error with `recordId` and stable code
|
|
79
|
-
`invalid_assessment` or `review_failed`.
|
|
80
|
-
|
|
81
|
-
responses. Exit codes are 0 for completion, 1 for unresolved review, and 2 for
|
|
97
|
+
`invalid_assessment` or `review_failed`. All requested reviews must succeed; partial
|
|
98
|
+
votes and earlier assessments in that invocation are discarded. Invalid input,
|
|
99
|
+
protocol errors, and cancellation use JSON-RPC error responses. Exit codes are 0 for completion, 1 for unresolved review, and 2 for
|
|
82
100
|
input/protocol failure (130/143 for SIGINT/SIGTERM).
|
|
83
101
|
|
|
84
102
|
Prefer one canonical record per workflow invocation when the host needs independent
|
|
85
103
|
retries and partial success. The host should retain immutable rubric/report
|
|
86
|
-
snapshots, compare every echoed binding
|
|
104
|
+
snapshots, compare every echoed binding including `classificationRuns`, and conditionally persist only computed
|
|
87
105
|
prioritization fields if the expected canonical version and rubric still apply.
|
|
88
106
|
Keep manual edits and original severity intact. Repeating the same inputs binds
|
|
89
107
|
results to the same hashes; it does not promise deterministic model answers.
|