@openai/codex-security 0.5.1 → 0.7.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 +151 -36
- package/_bundled_plugin/.mcp.json +1 -0
- package/_bundled_plugin/mcp/helpers.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/helpers.mjs.br.part-001 +0 -0
- package/_bundled_plugin/mcp/native/THIRD_PARTY_NOTICES.txt +1 -1
- package/_bundled_plugin/mcp/native/darwin-arm64/unix.node +0 -0
- package/_bundled_plugin/mcp/native/darwin-x64/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-arm64-gnu/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-arm64-musl/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-x64-gnu/unix.node +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/server.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-001 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-002 +0 -0
- package/_bundled_plugin/references/access-advisory.md +11 -0
- package/_bundled_plugin/references/core-scan.md +30 -77
- package/_bundled_plugin/references/final-report.md +45 -189
- package/_bundled_plugin/references/scan-contract.md +2 -0
- package/_bundled_plugin/references/scan-prologue.md +1 -1
- package/_bundled_plugin/references/scan-runtime.md +1 -5
- package/_bundled_plugin/references/threat-model.md +33 -41
- package/_bundled_plugin/schemas/coverage.schema.json +12 -1
- package/_bundled_plugin/schemas/scan-manifest.schema.json +1 -0
- package/_bundled_plugin/schemas/tools/deep-reducer.schema.json +38 -1
- package/_bundled_plugin/scripts/deep_scan_config.py +39 -39
- package/_bundled_plugin/scripts/deep_scan_workbench.py +145 -85
- package/_bundled_plugin/scripts/finalize_scan_contract.py +189 -57
- package/_bundled_plugin/scripts/report_projection.py +44 -15
- package/_bundled_plugin/scripts/threat_model_projection.py +4 -2
- package/_bundled_plugin/scripts/windows_scan_local_files.py +43 -14
- package/_bundled_plugin/scripts/workbench/retained_coverage.py +3218 -0
- package/_bundled_plugin/scripts/workbench/retained_records.py +627 -0
- package/_bundled_plugin/scripts/workbench/saved_coverage.py +644 -1
- package/_bundled_plugin/scripts/workbench/saved_outputs.py +72 -0
- package/_bundled_plugin/scripts/workbench/saved_sources.py +712 -0
- package/_bundled_plugin/scripts/workbench_cli.py +3 -0
- package/_bundled_plugin/scripts/workbench_coverage_receipts.py +479 -0
- package/_bundled_plugin/scripts/workbench_db.py +51 -22
- package/_bundled_plugin/scripts/workbench_feedback.py +0 -1
- package/_bundled_plugin/scripts/workbench_finding_workflows.py +53 -9
- package/_bundled_plugin/scripts/workbench_native_indexes.py +56 -44
- package/_bundled_plugin/scripts/workbench_saved_results.py +641 -2387
- package/_bundled_plugin/scripts/workbench_scan_history.py +72 -7
- package/_bundled_plugin/scripts/workbench_schema.py +1 -1
- package/_bundled_plugin/scripts/workbench_source_scopes.py +4 -1
- package/_bundled_plugin/scripts/workbench_target.py +142 -17
- package/_bundled_plugin/scripts/workbench_validation.py +9 -2
- package/_bundled_plugin/shared/workbench-history-repairs.json +21 -0
- package/_bundled_plugin/shared/workbench-migrations.json +44 -0
- package/_bundled_plugin/skills/assess-patch-risk/SKILL.md +3 -14
- package/_bundled_plugin/skills/assess-patch-risk/references/windows-validation.md +14 -0
- package/_bundled_plugin/skills/attack-path-analysis/SKILL.md +38 -103
- package/_bundled_plugin/skills/attack-path-analysis/references/attack-path-facts.md +11 -73
- package/_bundled_plugin/skills/attack-path-analysis/references/severity-policy.md +57 -116
- package/_bundled_plugin/skills/deep-security-scan/SKILL.md +28 -51
- package/_bundled_plugin/skills/define-security-policy/SKILL.md +9 -9
- package/_bundled_plugin/skills/finding-discovery/SKILL.md +26 -140
- package/_bundled_plugin/skills/fix-finding/SKILL.md +19 -30
- package/_bundled_plugin/skills/propose-security-hardening/SKILL.md +28 -218
- package/_bundled_plugin/skills/propose-security-hardening/references/proposal-format.md +29 -424
- package/_bundled_plugin/skills/publish-findings/SKILL.md +134 -0
- package/_bundled_plugin/skills/publish-findings/agents/openai.yaml +6 -0
- package/_bundled_plugin/skills/publish-findings/references/wiz-import.md +64 -0
- package/_bundled_plugin/skills/security-diff-scan/SKILL.md +12 -12
- package/_bundled_plugin/skills/security-scan/SKILL.md +28 -16
- package/_bundled_plugin/skills/security-scan/references/desktop-scan.md +11 -17
- package/_bundled_plugin/skills/security-scan/references/scan-artifacts-and-ledger.md +52 -69
- package/_bundled_plugin/skills/threat-model/SKILL.md +16 -9
- package/_bundled_plugin/skills/triage-finding/SKILL.md +5 -15
- package/_bundled_plugin/skills/triage-finding/references/ticket-intake.md +6 -6
- package/_bundled_plugin/skills/validation/SKILL.md +42 -104
- package/_bundled_plugin/skills/validation/references/validation-guidance.md +21 -106
- package/_bundled_plugin/skills/verify-fix/SKILL.md +8 -4
- package/_bundled_plugin/skills/vulnerability-writeup/SKILL.md +21 -159
- package/_bundled_plugin/skills/vulnerability-writeup/references/report-format.md +18 -60
- package/dist/api.d.ts +8 -3
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +414 -72
- package/dist/api.js.map +1 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +4 -1
- package/dist/auth.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 +9 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +802 -149
- 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/component-scan.d.ts +8 -2
- package/dist/component-scan.d.ts.map +1 -1
- package/dist/component-scan.js +2 -0
- package/dist/component-scan.js.map +1 -1
- package/dist/contract.d.ts +2 -0
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +67 -33
- package/dist/contract.js.map +1 -1
- package/dist/cost.d.ts +18 -0
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +107 -12
- package/dist/cost.js.map +1 -1
- package/dist/coverage-presentation.d.ts +6 -0
- package/dist/coverage-presentation.d.ts.map +1 -0
- package/dist/coverage-presentation.js +34 -0
- package/dist/coverage-presentation.js.map +1 -0
- package/dist/custom-validation-prompt.js +3 -3
- package/dist/custom-validation-prompt.js.map +1 -1
- package/dist/custom-validation.d.ts.map +1 -1
- package/dist/custom-validation.js +30 -4
- package/dist/custom-validation.js.map +1 -1
- package/dist/deduplication/checkpointed-review.d.ts.map +1 -1
- package/dist/deduplication/checkpointed-review.js +3 -1
- package/dist/deduplication/checkpointed-review.js.map +1 -1
- package/dist/deduplication/scan.d.ts.map +1 -1
- package/dist/deduplication/scan.js +7 -5
- package/dist/deduplication/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 +8 -0
- package/dist/endor-findings.d.ts.map +1 -0
- package/dist/endor-findings.js +238 -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 +46 -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 +344 -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 +721 -0
- package/dist/external-findings-publish.js.map +1 -0
- package/dist/external-findings-read.d.ts +16 -0
- package/dist/external-findings-read.d.ts.map +1 -0
- package/dist/external-findings-read.js +97 -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 +15 -0
- package/dist/external-import-contract.d.ts.map +1 -0
- package/dist/external-import-contract.js +262 -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/external-imports-feature.d.ts +6 -0
- package/dist/external-imports-feature.d.ts.map +1 -0
- package/dist/external-imports-feature.js +51 -0
- package/dist/external-imports-feature.js.map +1 -0
- package/dist/finding-workflow.d.ts +23 -6
- package/dist/finding-workflow.d.ts.map +1 -1
- package/dist/finding-workflow.js +23 -10
- 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 +133 -0
- package/dist/github-advisories.js.map +1 -0
- package/dist/github-findings.d.ts +11 -0
- package/dist/github-findings.d.ts.map +1 -0
- package/dist/github-findings.js +258 -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 +22 -3
- 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 +9 -2
- package/dist/hosted-scan.js.map +1 -1
- package/dist/import-scan.js +1 -1
- package/dist/import-scan.js.map +1 -1
- package/dist/index.d.ts +16 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/knowledge-base.d.ts +1 -0
- package/dist/knowledge-base.d.ts.map +1 -1
- package/dist/knowledge-base.js +17 -8
- package/dist/knowledge-base.js.map +1 -1
- package/dist/models.d.ts +1 -0
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js.map +1 -1
- package/dist/owner-evidence.d.ts +2 -0
- package/dist/owner-evidence.d.ts.map +1 -1
- package/dist/owner-evidence.js +2 -1
- package/dist/owner-evidence.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/publish.d.ts +2 -0
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +1 -1
- package/dist/publish.js.map +1 -1
- package/dist/remediation.d.ts +7 -25
- package/dist/remediation.d.ts.map +1 -1
- package/dist/remediation.js +18 -28
- 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 +10 -8
- package/dist/runtime.js.map +1 -1
- package/dist/scan-dashboard.d.ts +5 -3
- package/dist/scan-dashboard.d.ts.map +1 -1
- package/dist/scan-dashboard.js +79 -26
- package/dist/scan-dashboard.js.map +1 -1
- package/dist/scan-history-renderer.d.ts.map +1 -1
- package/dist/scan-history-renderer.js +8 -2
- package/dist/scan-history-renderer.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/scan-usage-display.d.ts +8 -0
- package/dist/scan-usage-display.d.ts.map +1 -0
- package/dist/scan-usage-display.js +46 -0
- package/dist/scan-usage-display.js.map +1 -0
- package/dist/scanner-import.d.ts +20 -0
- package/dist/scanner-import.d.ts.map +1 -0
- package/dist/scanner-import.js +208 -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 -76
- package/dist/security-policy.js.map +1 -1
- package/dist/semgrep-findings.d.ts +10 -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/skill-authentication.d.ts +18 -0
- package/dist/skill-authentication.d.ts.map +1 -0
- package/dist/skill-authentication.js +82 -0
- package/dist/skill-authentication.js.map +1 -0
- package/dist/snyk-findings.d.ts +10 -0
- package/dist/snyk-findings.d.ts.map +1 -0
- package/dist/snyk-findings.js +350 -0
- package/dist/snyk-findings.js.map +1 -0
- package/dist/suggest-owners.d.ts +4 -1
- package/dist/suggest-owners.d.ts.map +1 -1
- package/dist/suggest-owners.js +53 -21
- package/dist/suggest-owners.js.map +1 -1
- package/dist/targets.d.ts +2 -2
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +16 -3
- package/dist/targets.js.map +1 -1
- package/dist/wiz-csv.d.ts +9 -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 +5 -0
- package/dist/wiz-findings.d.ts.map +1 -0
- package/dist/wiz-findings.js +464 -0
- package/dist/wiz-findings.js.map +1 -0
- package/docs/classify-severity-records.md +30 -13
- package/docs/cli.md +835 -47
- package/docs/findings-service.md +119 -118
- package/docs/hosted-remediation.md +43 -24
- package/docs/hosted-scans.md +38 -0
- package/package.json +11 -9
- package/schemas/external-findings.schema.json +1421 -0
- package/schemas/project-config.schema.json +4 -0
- package/_bundled_plugin/scripts/generate_in_scope_files.py +0 -277
- package/_bundled_plugin/scripts/generate_rank_input.py +0 -350
- package/_bundled_plugin/scripts/rank_preview.py +0 -129
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wiz-findings.js","sourceRoot":"","sources":["../src/wiz-findings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EACL,gBAAgB,EAChB,wBAAwB,GAEzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAYzD,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACzE,CAAC,CAAE,KAAiC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CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { CodexSecurityError } from \"./errors.js\";\nimport {\n repositoryUrlKey,\n validateExternalEvidence,\n type ExternalImportTarget,\n} from \"./external-import-contract.js\";\nimport { parseJsonOrJsonl, readScannerText } from \"./scanner-import.js\";\nimport { readWizCsv, wizCsvFinding } from \"./wiz-csv.js\";\nimport type {\n ExternalFinding as VendorFinding,\n ExternalFindings as VendorFindings,\n ExternalSourceRepository,\n} from \"./external-findings.js\";\n\nexport type {\n ExternalFinding as VendorFinding,\n ExternalFindings as VendorFindings,\n} from \"./external-findings.js\";\n\nfunction object(value: unknown): Record<string, unknown> | undefined {\n return value !== null && typeof value === \"object\" && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined;\n}\n\nfunction text(value: unknown): string | null {\n return typeof value === \"string\" && value.trim() ? value : null;\n}\n\nfunction sourceFindingId(value: unknown, target: ExternalImportTarget): string {\n const id = text(value);\n if (\n !id ||\n id.includes(\"\\0\") ||\n (target === \"cloud\" && Buffer.byteLength(id) > 512)\n )\n throw new Error(\n target === \"cloud\"\n ? \"Source finding id must contain 1–512 UTF-8 bytes and no NUL characters.\"\n : \"Source finding id must be nonempty and contain no NUL characters.\",\n );\n return id;\n}\n\n/** Keep a Wiz vulnerability occurrence intact; advisory names are not identities. */\nfunction wizFinding(\n record: Record<string, unknown>,\n target: ExternalImportTarget,\n): VendorFinding {\n if (record[\"detectionMethod\"] === \"EXTERNAL_NETWORK_SCAN\")\n throw new Error(\n \"Wiz external network findings are not supported by the package vulnerability mapping.\",\n );\n const id = sourceFindingId(record[\"id\"], target);\n const name = text(record[\"name\"]);\n const packageName = text(record[\"detailedName\"]);\n const version = text(record[\"version\"]);\n const severity = (\n text(record[\"vendorSeverity\"]) ?? text(record[\"severity\"])\n )?.toLowerCase();\n const asset = object(record[\"vulnerableAsset\"]);\n const artifact = object(record[\"artifactType\"]);\n if (!name || !packageName || !text(asset?.[\"id\"])) {\n throw new Error(\n \"Expected a Wiz package vulnerability finding with name, detailedName, and vulnerableAsset.id. Other finding classes need a separate mapping.\",\n );\n }\n const assetType = text(asset?.[\"type\"]);\n const repositoryAsset =\n assetType === \"REPOSITORY_BRANCH\" ||\n asset?.[\"nativeType\"] === \"github#repositoryBranch\";\n // Wiz repository reports prefix root-relative paths with '/'. Workload paths\n // are not source locations and must remain only in the original evidence.\n const locationPath = text(record[\"locationPath\"]);\n const repositoryPath =\n repositoryAsset && locationPath ? locationPath.replace(/^\\/+/, \"\") : null;\n const digest =\n text(asset?.[\"imageDigest\"]) ??\n text(record[\"imageDigest\"]) ??\n (assetType === null ||\n assetType === \"CONTAINER_IMAGE\" ||\n assetType === \"CONTAINER\"\n ? (text(asset?.[\"imageId\"]) ??\n text(asset?.[\"containerImageId\"]) ??\n text(asset?.[\"ImageExternalId\"]))\n : null);\n // lastDetectedAt is not proof that the entire vendor record was updated.\n const evidence = {\n title:\n text(record[\"title\"]) ??\n [packageName, version, name].filter(Boolean).join(\" \"),\n description: text(record[\"description\"]),\n severity: severity === \"none\" ? \"unknown\" : severity,\n url: text(record[\"portalUrl\"]),\n advisory_ids: [text(record[\"vulnerabilityExternalId\"]) ?? name],\n packages: [\n {\n name: packageName,\n ecosystem:\n text(record[\"packageManager\"]) ??\n text(artifact?.[\"osPackageManager\"]) ??\n text(artifact?.[\"codeLibraryLanguage\"]) ??\n text(record[\"codeLibraryLanguage\"]),\n installed_version: version,\n manifest_path: repositoryPath,\n fixed_versions: text(record[\"fixedVersion\"])\n ? [record[\"fixedVersion\"]]\n : [],\n },\n ],\n locations: repositoryPath ? [{ path: repositoryPath }] : [],\n branch: null,\n code_revision: null,\n source_scan_id: null,\n image_digests: digest ? [digest] : [],\n source_updated_at: updatedAt(record[\"updatedAt\"], \"updatedAt\"),\n source_data: record,\n };\n return {\n source_finding_id: id,\n evidence: validateExternalEvidence(evidence, target),\n };\n}\n\ntype RepositoryFindingKind = \"sast\" | \"secret\" | \"iac\";\n\ntype InputRecord = {\n value: unknown;\n kind?: \"sca\" | \"sca_csv\" | RepositoryFindingKind | \"cloud_configuration\";\n};\n\ntype RepositoryMetadata = {\n id: string | null;\n name: string | null;\n url: string;\n};\n\ntype FindingInput = {\n records: InputRecord[];\n repositories: Map<string, RepositoryMetadata & { platform: string | null }>;\n legacyRepositories?: FindingInput[\"repositories\"];\n};\n\n// Wiz's documented inventory platform establishes custom GitHub host semantics.\n// Keep this context separate from the repository metadata published as evidence.\nfunction inventoryRepositoryUrlKey(\n value: string,\n platform: string | null | undefined,\n): string {\n const key = repositoryUrlKey(value);\n return platform === \"GITHUB\" ? key.toLowerCase() : key;\n}\n\nfunction sourceRepository(\n repository: Record<string, unknown> | undefined,\n repositories: FindingInput[\"repositories\"],\n): RepositoryMetadata {\n const id = text(repository?.[\"id\"]);\n const inventory = id ? repositories.get(id) : undefined;\n const suppliedUrl = text(repository?.[\"url\"]);\n if (\n suppliedUrl &&\n inventory &&\n inventoryRepositoryUrlKey(suppliedUrl, inventory.platform) !==\n inventoryRepositoryUrlKey(inventory.url, inventory.platform)\n )\n throw new Error(\n \"The finding and repository inventory have conflicting repository URLs.\",\n );\n const url = suppliedUrl ?? inventory?.url;\n if (!url)\n throw new Error(\n \"A verified source repository URL is required. Include repository.url or the matching repository.id and repository.url from data.versionControlResources.nodes; names and Wiz IDs are not Cloud repository IDs.\",\n );\n return {\n id,\n name: text(repository?.[\"name\"]) ?? inventory?.name ?? null,\n url,\n };\n}\n\nfunction sourceBranch(\n branch: Record<string, unknown> | undefined,\n repository: RepositoryMetadata,\n legacy = false,\n): string | null {\n const name = text(branch?.[\"name\"]);\n if (!name) return null;\n // Repository names and URL paths can both be literal branch prefixes. Keep\n // the old mapping only for an already approved publication checkpoint.\n if (!legacy) return name;\n const qualifiers = repository.name ? [repository.name] : [];\n\n // Include the URL qualifier before selecting the longest repository prefix.\n // Keep URL normalization and the branch suffix's original case and slashes.\n const repositoryKey = repositoryUrlKey(repository.url).toLowerCase();\n const url = /^(https?:\\/\\/[^/?#]+)\\/([^?#]+)$/iu.exec(repositoryKey);\n if (url) {\n const prefixParts = url[2]!.split(\"/\").length;\n const parts = name.split(\"/\");\n const qualifier = parts.slice(0, prefixParts).join(\"/\");\n if (\n parts.length > prefixParts &&\n repositoryUrlKey(url[1] + \"/\" + qualifier).toLowerCase() === repositoryKey\n )\n qualifiers.push(qualifier);\n }\n for (const qualifier of qualifiers.sort(\n (left, right) => right.length - left.length,\n )) {\n const prefix = qualifier + \"/\";\n if (name.toLowerCase().startsWith(prefix.toLowerCase()))\n return name.slice(prefix.length) || null;\n }\n return url || repository.name ? name : null;\n}\n\nfunction updatedAt(value: unknown, field: string): number | null {\n const timestamp = text(value);\n if (!timestamp) return null;\n const seconds = Date.parse(timestamp) / 1000;\n if (!Number.isFinite(seconds) || seconds < 0)\n throw new Error(`Wiz ${field} is not a valid timestamp.`);\n return Math.floor(seconds);\n}\n\n// Empty code and configuration strings are meaningful vendor evidence.\nfunction content(value: unknown): string | null {\n return typeof value === \"string\" ? value : null;\n}\n\n/** Map only explicitly identified repository finding collections. */\nfunction repositoryFinding(\n kind: RepositoryFindingKind,\n record: Record<string, unknown>,\n repositories: FindingInput[\"repositories\"],\n legacy = false,\n target: ExternalImportTarget = \"cloud\",\n): VendorFinding {\n const id = sourceFindingId(record[\"id\"], target);\n const resource = object(record[\"resource\"]);\n if (kind === \"secret\" && resource?.[\"type\"] !== \"REPOSITORY_BRANCH\")\n throw new Error(\n \"Only repository-branch secret findings can be published to a repository. Workload secrets require a resource-scoped import and are not supported.\",\n );\n const suppliedRepository =\n kind === \"secret\"\n ? object(object(resource?.[\"typedProperties\"])?.[\"repository\"])\n : object(record[\"repository\"]);\n const repository = sourceRepository(suppliedRepository, repositories);\n const branch =\n kind === \"secret\"\n ? resource\n : object(record[kind === \"sast\" ? \"repositoryBranch\" : \"branch\"]);\n const rule = object(record[\"rule\"]);\n const path = text(record[kind === \"secret\" ? \"path\" : \"filePath\"]);\n const line = record[kind === \"secret\" ? \"lineNumber\" : \"startLine\"];\n const details = {\n kind,\n repository,\n source_status: text(record[\"status\"]),\n scanner_origin: kind === \"sast\" ? text(record[\"origin\"]) : null,\n scanner_verdict:\n kind === \"sast\" ? text(object(record[\"aiAnalysis\"])?.[\"verdict\"]) : null,\n rule: rule\n ? {\n id: text(rule[\"id\"]),\n short_id: text(rule[\"shortId\"]),\n name: text(rule[\"name\"]),\n }\n : null,\n weakness_ids:\n kind === \"sast\" && Array.isArray(record[\"weaknesses\"])\n ? record[\"weaknesses\"].map((weakness) => object(weakness)?.[\"id\"])\n : [],\n remediation_instructions:\n text(record[\"remediationInstructions\"]) ??\n text(rule?.[\"remediationInstructions\"]),\n code:\n path && kind !== \"secret\"\n ? {\n end_line: record[\"endLine\"] ?? null,\n snippet: content(\n record[kind === \"sast\" ? \"snippet\" : \"matchContent\"],\n ),\n }\n : null,\n secret:\n kind === \"secret\"\n ? {\n type: text(record[\"type\"]),\n confidence: text(record[\"confidence\"]),\n validation_status: text(record[\"validationStatus\"]),\n is_encrypted: record[\"isEncrypted\"] ?? null,\n is_managed: record[\"isManaged\"] ?? null,\n introduced_commit: text(\n object(record[\"vcsDetails\"])?.[\"initialCommitHash\"],\n ),\n }\n : null,\n configuration:\n kind === \"iac\"\n ? {\n platform: text(record[\"platform\"]),\n cloud_platform: text(record[\"cloudPlatform\"]),\n expected: content(record[\"expectedContent\"]),\n actual: content(record[\"foundContent\"]),\n }\n : null,\n file_url: text(record[\"fileURL\"]),\n };\n return {\n // Existing package occurrence IDs remain unchanged. New families cannot\n // collide with one another when the same tenant source key is used.\n source_finding_id: sourceFindingId(`${kind}:${id}`, target),\n evidence: validateExternalEvidence(\n {\n title: text(record[\"name\"]) ?? text(rule?.[\"name\"]),\n severity: text(record[\"severity\"])?.toLowerCase(),\n description: text(record[\"description\"]) ?? text(rule?.[\"description\"]),\n url: text(record[\"wizUrl\"]) ?? text(record[\"portalUrl\"]),\n locations: path ? [{ path, line: line ?? null }] : [],\n branch: sourceBranch(branch, repository, legacy),\n code_revision: null,\n source_scan_id: null,\n source_updated_at:\n kind === \"secret\"\n ? updatedAt(record[\"lastUpdatedAt\"], \"lastUpdatedAt\")\n : kind === \"iac\"\n ? updatedAt(record[\"updatedAt\"], \"updatedAt\")\n : null,\n source_data: record,\n details,\n },\n target,\n ),\n };\n}\n\nfunction records(payload: unknown): FindingInput {\n const repositories: FindingInput[\"repositories\"] = new Map();\n const legacyRepositories: FindingInput[\"repositories\"] = new Map();\n if (Array.isArray(payload))\n return { records: payload.map((value) => ({ value })), repositories };\n const envelope = object(payload);\n if (!envelope)\n throw new Error(\n \"Expected finding objects or a named Wiz finding collection.\",\n );\n if (\n object(envelope[\"scannersRunStatuses\"]) &&\n object(envelope[\"codeAnalyzerDetails\"])\n )\n throw new Error(\n \"This is a Wiz Code & Build Scan event, which contains scan metadata rather than vulnerability records. In Vulnerability Findings, filter the repository and selection, then choose Save as → Report with JSON format and Detailed columns. Download that report instead of Raw Event.\",\n );\n if (Array.isArray(envelope[\"errors\"]) && envelope[\"errors\"].length > 0)\n throw new Error(\n \"Wiz returned GraphQL errors. Resolve them before publishing this response.\",\n );\n if (\n envelope[\"source_finding_id\"] !== undefined ||\n envelope[\"id\"] !== undefined\n )\n return { records: [{ value: envelope }], repositories };\n const data = object(envelope[\"data\"]) ?? envelope;\n const inventory = object(data[\"versionControlResources\"]);\n if (object(inventory?.[\"pageInfo\"])?.[\"hasNextPage\"] === true)\n throw new Error(\n \"Wiz repository inventory has another page. Finish the selected inventory before publishing.\",\n );\n if (Array.isArray(inventory?.[\"nodes\"])) {\n const entries = inventory[\"nodes\"].flatMap((entry) => {\n const node = object(entry);\n const repository = object(node?.[\"repository\"]);\n const id = text(repository?.[\"id\"]);\n const url = text(repository?.[\"url\"]);\n return id && url\n ? [\n {\n id,\n name: text(repository?.[\"name\"]),\n url,\n platform: text(node?.[\"platform\"]),\n },\n ]\n : [];\n });\n // Resolve provider hints before comparing URLs, so duplicate row order cannot\n // discard a known platform or reject a case variant before its GITHUB hint.\n for (const entry of entries) {\n const previous = repositories.get(entry.id);\n if (\n previous?.platform &&\n entry.platform &&\n previous.platform !== entry.platform\n )\n throw new Error(\n `Repository inventory contains conflicting platforms for ${JSON.stringify(entry.id)}.`,\n );\n repositories.set(entry.id, {\n ...entry,\n // Equivalent inventory aliases must produce the same evidence when the\n // export reorders its rows. Keep a stable supplied URL and nonempty name.\n url: previous && previous.url < entry.url ? previous.url : entry.url,\n name:\n previous?.name && (!entry.name || previous.name < entry.name)\n ? previous.name\n : entry.name,\n platform: entry.platform ?? previous?.platform ?? null,\n });\n legacyRepositories.set(entry.id, {\n ...entry,\n platform: entry.platform ?? previous?.platform ?? null,\n });\n }\n for (const entry of entries) {\n const resolved = repositories.get(entry.id)!;\n if (\n inventoryRepositoryUrlKey(entry.url, resolved.platform) !==\n inventoryRepositoryUrlKey(resolved.url, resolved.platform)\n )\n throw new Error(\n `Repository inventory contains conflicting URLs for ${JSON.stringify(entry.id)}.`,\n );\n }\n }\n const collections = {\n vulnerabilityFindings: \"sca\",\n sastFindings: \"sast\",\n secretInstances: \"secret\",\n iacFindings: \"iac\",\n configurationFindings: \"cloud_configuration\",\n } as const;\n const selected: InputRecord[] = [];\n let found = false;\n for (const [root, kind] of Object.entries(collections)) {\n const collection = object(data[root]);\n if (!collection) continue;\n found = true;\n if (!Array.isArray(collection[\"nodes\"]))\n throw new Error(`Wiz ${root}.nodes must be an array.`);\n if (object(collection[\"pageInfo\"])?.[\"hasNextPage\"] === true)\n throw new Error(\n \"Wiz response has another page. Complete the requested pages or save the explicitly selected records in their named collection before publishing.\",\n );\n for (const value of collection[\"nodes\"]) selected.push({ value, kind });\n }\n if (found)\n return {\n records: selected,\n repositories,\n legacyRepositories,\n };\n throw new Error(\n \"Unsupported Wiz export. Supply repository vulnerability CSV, vulnerability finding objects, named sastFindings/secretInstances/iacFindings collections, or normalized JSONL. Other CSV reports need an explicit normalized JSONL mapping.\",\n );\n}\n\nexport async function readVendorFindings(\n path: string,\n target: ExternalImportTarget = \"cloud\",\n): Promise<VendorFindings> {\n return normalizeFindings(await readFindingInput(path), target);\n}\n\n/** @internal Preserve older inventory projections only for saved publication replay. */\nexport async function readVendorFindingsForPublication(\n path: string,\n target: ExternalImportTarget = \"cloud\",\n): Promise<{\n current: VendorFindings;\n legacy: VendorFindings;\n currentIdentity: unknown[];\n legacyIdentity: unknown[];\n sourceRepositories: ExternalSourceRepository[];\n}> {\n const input = await readFindingInput(path);\n const normalized = new WeakSet<VendorFinding>();\n const current = normalizeFindings(input, target, normalized);\n const legacy = normalizeFindings(\n { ...input, repositories: input.legacyRepositories ?? input.repositories },\n target,\n normalized,\n true,\n );\n const identity = (parsed: VendorFindings) =>\n parsed.findings.map((finding) => {\n if (normalized.has(finding)) return finding;\n const repository = finding.evidence.details?.repository;\n return {\n source_finding_id: finding.source_finding_id,\n evidence: {\n // Raw vendor records retain every original branch/ref and source field.\n // Inventory display aliases must not change an outstanding request's identity.\n source_data: finding.evidence.source_data,\n repository: repository\n ? {\n id: repository.id,\n // Publication targets use Cloud's GitHub URL semantics. Input\n // joins above still require provenance for custom-host folding.\n url: repositoryUrlKey(repository.url).toLowerCase(),\n }\n : null,\n },\n };\n });\n return {\n current,\n legacy,\n currentIdentity: identity(current),\n legacyIdentity: identity(legacy),\n sourceRepositories: current.findings.flatMap(({ evidence }) => {\n const repository = evidence.details?.repository;\n const inventory = input.repositories.get(repository?.id ?? \"\");\n // Forward provenance only for selected findings that match the inventory.\n // Use the emitted spelling so typed evidence and reader hints share it.\n return repository &&\n inventory?.platform === \"GITHUB\" &&\n inventoryRepositoryUrlKey(repository.url, inventory.platform) ===\n inventoryRepositoryUrlKey(inventory.url, inventory.platform)\n ? [{ url: repository.url, platform: \"github\" as const }]\n : [];\n }),\n };\n}\n\nasync function readFindingInput(path: string): Promise<FindingInput> {\n try {\n const contents = await readScannerText(path);\n let payload: unknown;\n try {\n payload = JSON.parse(contents);\n } catch {\n const csv = readWizCsv(contents);\n if (csv)\n return {\n records: csv.map((value) => ({ value, kind: \"sca_csv\" })),\n repositories: new Map(),\n };\n payload = parseJsonOrJsonl(contents);\n }\n return records(payload);\n } catch (cause) {\n throw new CodexSecurityError(\n `Could not read vendor findings as UTF-8 JSON, JSONL, or Wiz CSV: ${cause instanceof Error ? cause.message : String(cause)}`,\n { cause },\n );\n }\n}\n\nfunction normalizeFindings(\n input: FindingInput,\n target: ExternalImportTarget,\n normalized?: WeakSet<VendorFinding>,\n legacy = false,\n): VendorFindings {\n const result: VendorFindings = {\n read: input.records.length,\n findings: [],\n excluded: [],\n };\n const identities = new Set<string>();\n for (const [index, item] of input.records.entries()) {\n const record = object(item.value);\n try {\n if (!record) throw new Error(\"Finding must be an object.\");\n let finding: VendorFinding;\n if (item.kind === \"sca_csv\") {\n finding = wizCsvFinding(\n record,\n sourceFindingId(record[\"ID\"], target),\n target,\n );\n } else if (\"source_finding_id\" in record) {\n if (\n Object.keys(record).some(\n (key) => ![\"source_finding_id\", \"evidence\"].includes(key),\n )\n ) {\n throw new Error(\n \"Normalized input permits only source_finding_id and evidence.\",\n );\n }\n finding = {\n source_finding_id: sourceFindingId(\n record[\"source_finding_id\"],\n target,\n ),\n evidence: validateExternalEvidence(record[\"evidence\"], target),\n };\n } else if (item.kind === \"cloud_configuration\") {\n throw new Error(\n \"Cloud configuration findings require a resource-scoped import and cannot be published to a repository.\",\n );\n } else if (item.kind && item.kind !== \"sca\") {\n finding = repositoryFinding(\n item.kind,\n record,\n input.repositories,\n legacy,\n target,\n );\n } else {\n if (\n !item.kind &&\n (object(record[\"repository\"]) ||\n object(record[\"repositoryBranch\"]) ||\n object(record[\"resource\"]))\n )\n throw new Error(\n \"Raw SAST, secret, and IaC records require their named sastFindings, secretInstances, or iacFindings collection. Bare arrays do not identify the finding family; use normalized JSONL for an explicit mapping.\",\n );\n finding = wizFinding(record, target);\n }\n if (identities.has(finding.source_finding_id)) {\n throw new CodexSecurityError(\n `Duplicate source finding id ${JSON.stringify(finding.source_finding_id)}. Select each vendor occurrence once.`,\n );\n }\n identities.add(finding.source_finding_id);\n result.findings.push(finding);\n if (item.kind !== \"sca_csv\" && \"source_finding_id\" in record)\n normalized?.add(finding);\n } catch (error) {\n if (error instanceof CodexSecurityError) throw error;\n result.excluded.push({\n position: index + 1,\n source_finding_id:\n item.kind === \"sca_csv\"\n ? text(record?.[\"ID\"])\n : (text(record?.[\"source_finding_id\"]) ?? text(record?.[\"id\"])),\n reason: error instanceof Error ? error.message : String(error),\n });\n }\n }\n return result;\n}\n"]}
|
|
@@ -3,13 +3,12 @@
|
|
|
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
|
|
10
|
-
version `1`.
|
|
11
|
-
|
|
12
|
-
not advertise `--records` in `classify-severity --help` cannot run this protocol.
|
|
10
|
+
version `1`. Before using the protocol, confirm that your installed CLI lists
|
|
11
|
+
`--records` in `classify-severity --help`.
|
|
13
12
|
|
|
14
13
|
## Immutable inputs
|
|
15
14
|
|
|
@@ -25,6 +24,15 @@ Send one newline-delimited JSON-RPC request with `method: "run"` and these param
|
|
|
25
24
|
}
|
|
26
25
|
```
|
|
27
26
|
|
|
27
|
+
The `rubric` field is optional. Omit it to classify with the
|
|
28
|
+
[built-in severity rubric](https://github.com/openai/codex-security/blob/main/sdk/typescript/src/default-severity-rubric.ts), using the same configured
|
|
29
|
+
independent host reviews and usage accounting. The result echoes its built-in
|
|
30
|
+
revision (currently `1`) and exact Markdown SHA-256. Supplying a custom rubric
|
|
31
|
+
replaces the default completely and preserves the supplied revision/hash binding.
|
|
32
|
+
Do not reuse cached results across differing rubric hashes; preserve the default
|
|
33
|
+
snapshot from the review prompt alongside its returned binding. Default revisions
|
|
34
|
+
are local to the bundled policy, not workspace rubric revisions.
|
|
35
|
+
|
|
28
36
|
`findingJson` is the exact JSON text of an object with nonblank `findingId`,
|
|
29
37
|
`title`, and `summary`. `findingId` must equal the canonical `id`. Optional
|
|
30
38
|
`severity.level` uses `critical`, `high`, `medium`, `low`, or `informational`.
|
|
@@ -36,7 +44,7 @@ normalizing newlines, whitespace, Unicode, object key order, or JSON numbers.
|
|
|
36
44
|
Compute `inputSha256` from `findingJson`, not from its parsed/reserialized object.
|
|
37
45
|
For example, Node uses `createHash("sha256").update(text, "utf8").digest("hex")`;
|
|
38
46
|
Python uses `hashlib.sha256(text.encode("utf-8")).hexdigest()`.
|
|
39
|
-
The CLI recomputes
|
|
47
|
+
The CLI recomputes supplied hashes before requesting any review. Rubric revisions are
|
|
40
48
|
positive safe integers; record revisions are nonnegative safe integers. Duplicate
|
|
41
49
|
canonical IDs and invalid records reject the entire input before host work.
|
|
42
50
|
The implementation snapshots caller input before awaiting model execution and
|
|
@@ -45,8 +53,10 @@ numeric evidence that JavaScript cannot represent exactly.
|
|
|
45
53
|
|
|
46
54
|
## Host execution contract
|
|
47
55
|
|
|
48
|
-
|
|
49
|
-
|
|
56
|
+
The `classificationRuns` SDK option or CLI `--runs N` flag accepts
|
|
57
|
+
an integer from 1 through 10 (default: 3), validated before any host work.
|
|
58
|
+
For each record the CLI emits that many sequential `method: "review.run"` requests,
|
|
59
|
+
each with a unique request ID and params containing `requestId`, `stage: "severity-classification"`, explicit
|
|
50
60
|
`model` and `effort`, `trustedInstructions`, untrusted report/rubric `prompt`, and
|
|
51
61
|
an output JSON `schema`. The host must authorize the requested model and effort,
|
|
52
62
|
create a fresh independent review context, preserve the instruction/data boundary,
|
|
@@ -61,7 +71,14 @@ object. Do not wrap the assessment in a string or an array. An assessment contai
|
|
|
61
71
|
`rubricLabel`, `rationale`, separate `confidence`, and nullable `reviewTrigger`.
|
|
62
72
|
Excluded assessments require null level and label; assessed ones require both.
|
|
63
73
|
|
|
64
|
-
The
|
|
74
|
+
The reviews receive identical inputs and do not see earlier answers. The
|
|
75
|
+
most common normalized severity wins; the highest among tied top counts wins
|
|
76
|
+
(`critical` > `high` > `medium` > `low` > `informational`). Exclusion is a separate
|
|
77
|
+
vote: exclusions can win by count, but lose ties to assessed severities. The first answer matching the winner supplies all assessment fields.
|
|
78
|
+
|
|
79
|
+
The host owns model budgets, usage accounting, transport limits, timeouts, and
|
|
80
|
+
session cancellation. Account for every review request, including work preceding
|
|
81
|
+
a later failure; classification results do not aggregate or report token usage.
|
|
65
82
|
Use the transport's `cancel` notification with the active run ID and also stop
|
|
66
83
|
any remote execution. EOF or a broken pipe means disconnection, not successful
|
|
67
84
|
completion. No review is retried automatically, including after an ambiguous
|
|
@@ -70,20 +87,20 @@ host execution error.
|
|
|
70
87
|
## Results and persistence
|
|
71
88
|
|
|
72
89
|
A completed result contains `version: 1`, `status: "completed"`, the rubric's
|
|
73
|
-
`revision` and `sha256`, and `assessments`. Each assessment replaces model-provided
|
|
90
|
+
`revision` and `sha256`, `classificationRuns`, and `assessments`. Each assessment replaces model-provided
|
|
74
91
|
`findingId` with the verified canonical `id`, `revision`, and `inputSha256`.
|
|
75
92
|
The original report and severity are never rewritten.
|
|
76
93
|
|
|
77
94
|
Invalid or mismatched model output and host failures return `status: "unresolved"`,
|
|
78
95
|
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
|
|
96
|
+
`invalid_assessment` or `review_failed`. All requested reviews must succeed; partial
|
|
97
|
+
votes and earlier assessments in that invocation are discarded. Invalid input,
|
|
98
|
+
protocol errors, and cancellation use JSON-RPC error responses. Exit codes are 0 for completion, 1 for unresolved review, and 2 for
|
|
82
99
|
input/protocol failure (130/143 for SIGINT/SIGTERM).
|
|
83
100
|
|
|
84
101
|
Prefer one canonical record per workflow invocation when the host needs independent
|
|
85
102
|
retries and partial success. The host should retain immutable rubric/report
|
|
86
|
-
snapshots, compare every echoed binding
|
|
103
|
+
snapshots, compare every echoed binding including `classificationRuns`, and conditionally persist only computed
|
|
87
104
|
prioritization fields if the expected canonical version and rubric still apply.
|
|
88
105
|
Keep manual edits and original severity intact. Repeating the same inputs binds
|
|
89
106
|
results to the same hashes; it does not promise deterministic model answers.
|