@openai/codex-security 0.8.1 → 0.8.3
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 +45 -57
- package/_bundled_plugin/.app.json +4 -0
- 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 +4 -4
- 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/linux-x64-musl/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/permission-profile-preflight.mjs +46 -12
- 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/artifact-storage.md +1 -1
- package/_bundled_plugin/references/core-scan.md +14 -5
- package/_bundled_plugin/references/default-severity-rubric.md +28 -0
- package/_bundled_plugin/references/finding-detail-fields.md +1 -0
- package/_bundled_plugin/references/threat-model.md +1 -0
- package/_bundled_plugin/scripts/deep_scan_workbench.py +23 -112
- package/_bundled_plugin/scripts/finalize_scan_contract.py +167 -153
- package/_bundled_plugin/scripts/finding_preview.py +5 -29
- package/_bundled_plugin/scripts/posix_scan_local_files.py +187 -0
- package/_bundled_plugin/scripts/report_projection.py +87 -136
- package/_bundled_plugin/scripts/validate_scan_contract.py +2 -6
- package/_bundled_plugin/scripts/windows_scan_local_files.py +212 -55
- package/_bundled_plugin/scripts/workbench/retained_coverage.py +8 -24
- package/_bundled_plugin/scripts/workbench/saved_coverage.py +143 -231
- package/_bundled_plugin/scripts/workbench_cli.py +102 -13
- package/_bundled_plugin/scripts/workbench_constants.py +9 -0
- package/_bundled_plugin/scripts/workbench_coverage_receipts.py +0 -17
- package/_bundled_plugin/scripts/workbench_db.py +187 -363
- package/_bundled_plugin/scripts/workbench_finding_workflows.py +86 -4
- package/_bundled_plugin/scripts/workbench_native_indexes.py +17 -21
- package/_bundled_plugin/scripts/workbench_remediation.py +495 -11
- package/_bundled_plugin/scripts/workbench_saved_results.py +0 -66
- package/_bundled_plugin/scripts/workbench_scan_history.py +22 -25
- package/_bundled_plugin/scripts/workbench_scan_start.py +1 -1
- package/_bundled_plugin/scripts/workbench_scan_usage.py +25 -52
- package/_bundled_plugin/scripts/workbench_schema.py +1 -1
- package/_bundled_plugin/scripts/workbench_setup.py +239 -0
- package/_bundled_plugin/scripts/workbench_source_scopes.py +15 -23
- package/_bundled_plugin/scripts/workbench_target.py +120 -35
- package/_bundled_plugin/scripts/workbench_validation.py +1 -9
- package/_bundled_plugin/shared/workbench-history-repairs.json +7 -0
- package/_bundled_plugin/shared/workbench-migrations.json +19 -0
- package/_bundled_plugin/skills/attack-path-analysis/SKILL.md +1 -1
- package/_bundled_plugin/skills/attack-path-analysis/references/severity-policy.md +4 -68
- package/_bundled_plugin/skills/check-skills/SKILL.md +43 -0
- package/_bundled_plugin/skills/check-skills/agents/openai.yaml +4 -0
- package/_bundled_plugin/skills/cloud-findings/SKILL.md +2 -0
- package/_bundled_plugin/skills/fix-finding/SKILL.md +18 -1
- package/_bundled_plugin/skills/publish-findings/SKILL.md +68 -35
- package/_bundled_plugin/skills/publish-findings/references/wiz-import.md +2 -21
- package/_bundled_plugin/skills/resolve-dependency-alert/SKILL.md +18 -0
- package/_bundled_plugin/skills/resolve-dependency-alert/agents/openai.yaml +4 -0
- package/_bundled_plugin/skills/threat-model-visualize/SKILL.md +83 -0
- package/_bundled_plugin/skills/threat-model-visualize/agents/openai.yaml +4 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/context-reference-overview.svg +366 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/context-reference-path.svg +558 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/control-effects.js +85 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/explorer.css +17 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/explorer.html +38 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/explorer.js +372 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/route-paths.js +71 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/source-roles.js +47 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/svg-layout.js +149 -0
- package/_bundled_plugin/skills/threat-model-visualize/references/context-explorer.md +21 -0
- package/_bundled_plugin/skills/threat-model-visualize/references/view-model.md +49 -0
- package/_bundled_plugin/skills/threat-model-visualize/scripts/build_explorer.py +569 -0
- package/_bundled_plugin/skills/track-findings/SKILL.md +5 -3
- package/_bundled_plugin/skills/triage-finding/references/github-rest-intake.md +22 -68
- package/_bundled_plugin/skills/triage-finding/references/ticket-intake.md +6 -4
- package/dist/api.d.ts +6 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +414 -163
- package/dist/api.js.map +1 -1
- package/dist/auth.js +7 -2
- package/dist/auth.js.map +1 -1
- package/dist/blackduck-findings.d.ts +8 -0
- package/dist/blackduck-findings.d.ts.map +1 -0
- package/dist/blackduck-findings.js +305 -0
- package/dist/blackduck-findings.js.map +1 -0
- package/dist/bulk-scan-discovery.d.ts.map +1 -1
- package/dist/bulk-scan-discovery.js +51 -36
- package/dist/bulk-scan-discovery.js.map +1 -1
- package/dist/classify-severity-records.d.ts +5 -0
- package/dist/classify-severity-records.d.ts.map +1 -1
- package/dist/classify-severity-records.js +6 -8
- package/dist/classify-severity-records.js.map +1 -1
- package/dist/classify-severity.d.ts +4 -1
- package/dist/classify-severity.d.ts.map +1 -1
- package/dist/classify-severity.js +28 -9
- package/dist/classify-severity.js.map +1 -1
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +635 -266
- package/dist/cli.js.map +1 -1
- package/dist/codex-prompt.d.ts +2 -0
- package/dist/codex-prompt.d.ts.map +1 -1
- package/dist/codex-prompt.js +6 -0
- package/dist/codex-prompt.js.map +1 -1
- package/dist/component-scan.d.ts.map +1 -1
- package/dist/component-scan.js +6 -5
- package/dist/component-scan.js.map +1 -1
- package/dist/config.d.ts +2 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +162 -40
- package/dist/config.js.map +1 -1
- package/dist/continuum-findings.d.ts +7 -0
- package/dist/continuum-findings.d.ts.map +1 -0
- package/dist/continuum-findings.js +157 -0
- package/dist/continuum-findings.js.map +1 -0
- package/dist/contract-values.d.ts +28 -0
- package/dist/contract-values.d.ts.map +1 -0
- package/dist/contract-values.js +75 -0
- package/dist/contract-values.js.map +1 -0
- package/dist/contract.d.ts +2 -20
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +58 -669
- package/dist/contract.js.map +1 -1
- package/dist/cost-model.d.ts.map +1 -1
- package/dist/cost-model.js +1 -4
- package/dist/cost-model.js.map +1 -1
- package/dist/cost.d.ts +19 -1
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +2120 -39
- package/dist/cost.js.map +1 -1
- package/dist/custom-validation-prompt.d.ts +1 -1
- package/dist/custom-validation-prompt.d.ts.map +1 -1
- package/dist/custom-validation-prompt.js +5 -0
- package/dist/custom-validation-prompt.js.map +1 -1
- package/dist/custom-validation.d.ts +2 -0
- package/dist/custom-validation.d.ts.map +1 -1
- package/dist/custom-validation.js +6 -2
- package/dist/custom-validation.js.map +1 -1
- package/dist/deduplication/deduplication-prompts.d.ts +4 -4
- package/dist/deduplication/deduplication-prompts.d.ts.map +1 -1
- package/dist/deduplication/deduplication-prompts.js +2 -2
- package/dist/deduplication/deduplication-prompts.js.map +1 -1
- package/dist/deduplication/deduplication-reviewer.d.ts +14 -11
- package/dist/deduplication/deduplication-reviewer.d.ts.map +1 -1
- package/dist/deduplication/deduplication-reviewer.js +12 -5
- package/dist/deduplication/deduplication-reviewer.js.map +1 -1
- package/dist/deduplication/deduplication.js.map +1 -1
- package/dist/deduplication/finding-schema.d.ts +19 -1
- package/dist/deduplication/finding-schema.d.ts.map +1 -1
- package/dist/deduplication/finding-schema.js +25 -0
- package/dist/deduplication/finding-schema.js.map +1 -1
- package/dist/deduplication/local.d.ts.map +1 -1
- package/dist/deduplication/local.js +3 -8
- package/dist/deduplication/local.js.map +1 -1
- package/dist/deduplication/records.d.ts +11 -3
- package/dist/deduplication/records.d.ts.map +1 -1
- package/dist/deduplication/records.js +48 -16
- package/dist/deduplication/records.js.map +1 -1
- package/dist/deep-scan.d.ts +11 -0
- package/dist/deep-scan.d.ts.map +1 -1
- package/dist/deep-scan.js +235 -4
- package/dist/deep-scan.js.map +1 -1
- package/dist/default-severity-rubric.d.ts +1 -2
- package/dist/default-severity-rubric.d.ts.map +1 -1
- package/dist/default-severity-rubric.js +2 -66
- package/dist/default-severity-rubric.js.map +1 -1
- package/dist/endor-findings.d.ts.map +1 -1
- package/dist/endor-findings.js +44 -89
- package/dist/endor-findings.js.map +1 -1
- package/dist/errors.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/external-findings-import.d.ts.map +1 -1
- package/dist/external-findings-import.js +11 -15
- package/dist/external-findings-import.js.map +1 -1
- package/dist/external-findings-local.d.ts +12 -1
- package/dist/external-findings-local.d.ts.map +1 -1
- package/dist/external-findings-local.js +411 -184
- package/dist/external-findings-local.js.map +1 -1
- package/dist/external-findings-publish.d.ts +15 -1
- package/dist/external-findings-publish.d.ts.map +1 -1
- package/dist/external-findings-publish.js +1238 -226
- package/dist/external-findings-publish.js.map +1 -1
- package/dist/external-findings-read.d.ts +10 -0
- package/dist/external-findings-read.d.ts.map +1 -1
- package/dist/external-findings-read.js +71 -51
- package/dist/external-findings-read.js.map +1 -1
- package/dist/external-findings.d.ts +13 -0
- package/dist/external-findings.d.ts.map +1 -1
- package/dist/external-findings.js +124 -1
- package/dist/external-findings.js.map +1 -1
- package/dist/external-import-contract.d.ts +29 -1
- package/dist/external-import-contract.d.ts.map +1 -1
- package/dist/external-import-contract.js +314 -44
- package/dist/external-import-contract.js.map +1 -1
- package/dist/external-import-models.d.ts +1 -1
- package/dist/external-import-models.d.ts.map +1 -1
- package/dist/external-import-models.js.map +1 -1
- package/dist/finding-normalization.d.ts +1 -1
- package/dist/finding-normalization.d.ts.map +1 -1
- package/dist/finding-normalization.js +46 -11
- package/dist/finding-normalization.js.map +1 -1
- package/dist/finding-retrieval.d.ts +3 -3
- package/dist/finding-retrieval.d.ts.map +1 -1
- package/dist/finding-retrieval.js.map +1 -1
- package/dist/finding-workflow.d.ts +6 -1
- package/dist/finding-workflow.d.ts.map +1 -1
- package/dist/finding-workflow.js +2 -2
- package/dist/finding-workflow.js.map +1 -1
- package/dist/git-remote.d.ts +4 -0
- package/dist/git-remote.d.ts.map +1 -1
- package/dist/git-remote.js +20 -0
- package/dist/git-remote.js.map +1 -1
- package/dist/github-advisories.d.ts +3 -12
- package/dist/github-advisories.d.ts.map +1 -1
- package/dist/github-advisories.js +9 -29
- package/dist/github-advisories.js.map +1 -1
- package/dist/github-dependabot-findings.d.ts.map +1 -1
- package/dist/github-dependabot-findings.js +7 -16
- package/dist/github-dependabot-findings.js.map +1 -1
- package/dist/github-findings.d.ts.map +1 -1
- package/dist/github-findings.js +344 -56
- package/dist/github-findings.js.map +1 -1
- package/dist/github.d.ts +17 -7
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +43 -30
- package/dist/github.js.map +1 -1
- package/dist/host-protocol.d.ts +7 -2
- package/dist/host-protocol.d.ts.map +1 -1
- package/dist/host-protocol.js +27 -3
- package/dist/host-protocol.js.map +1 -1
- package/dist/host-records-protocol.d.ts +10 -11
- package/dist/host-records-protocol.d.ts.map +1 -1
- package/dist/host-records-protocol.js +69 -9
- package/dist/host-records-protocol.js.map +1 -1
- package/dist/hosted-scan.d.ts +15 -0
- package/dist/hosted-scan.d.ts.map +1 -1
- package/dist/hosted-scan.js +55 -33
- package/dist/hosted-scan.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/inspector-findings.d.ts +9 -0
- package/dist/inspector-findings.d.ts.map +1 -0
- package/dist/inspector-findings.js +512 -0
- package/dist/inspector-findings.js.map +1 -0
- package/dist/knowledge-base.js +18 -5
- package/dist/knowledge-base.js.map +1 -1
- package/dist/local-git-metadata.d.ts +5 -0
- package/dist/local-git-metadata.d.ts.map +1 -0
- package/dist/local-git-metadata.js +131 -0
- package/dist/local-git-metadata.js.map +1 -0
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +22 -12
- package/dist/multiscan.js.map +1 -1
- package/dist/opengrep-findings.d.ts.map +1 -1
- package/dist/opengrep-findings.js +34 -20
- package/dist/opengrep-findings.js.map +1 -1
- package/dist/patch-tui.d.ts +1 -1
- package/dist/patch-tui.d.ts.map +1 -1
- package/dist/patch-tui.js +94 -36
- package/dist/patch-tui.js.map +1 -1
- package/dist/private-finding-import.d.ts +246 -0
- package/dist/private-finding-import.d.ts.map +1 -0
- package/dist/private-finding-import.js +387 -0
- package/dist/private-finding-import.js.map +1 -0
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +2 -2
- package/dist/project-config.js.map +1 -1
- package/dist/provider-profile.d.ts +10 -2
- package/dist/provider-profile.d.ts.map +1 -1
- package/dist/provider-profile.js +72 -10
- package/dist/provider-profile.js.map +1 -1
- package/dist/publication.js +7 -1
- package/dist/publication.js.map +1 -1
- package/dist/reader-selection.d.ts +13 -0
- package/dist/reader-selection.d.ts.map +1 -0
- package/dist/reader-selection.js +81 -0
- package/dist/reader-selection.js.map +1 -0
- package/dist/record.d.ts +6 -1
- package/dist/record.d.ts.map +1 -1
- package/dist/record.js +53 -2
- package/dist/record.js.map +1 -1
- package/dist/remediation.d.ts +5 -0
- package/dist/remediation.d.ts.map +1 -1
- package/dist/remediation.js +30 -0
- package/dist/remediation.js.map +1 -1
- package/dist/result.d.ts +2 -0
- package/dist/result.d.ts.map +1 -1
- package/dist/result.js +3 -1
- package/dist/result.js.map +1 -1
- package/dist/runtime.d.ts +5 -3
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +110 -57
- package/dist/runtime.js.map +1 -1
- package/dist/scan-activity.js +40 -17
- package/dist/scan-activity.js.map +1 -1
- package/dist/scan-comparison.d.ts +1 -1
- package/dist/scan-comparison.d.ts.map +1 -1
- package/dist/scan-comparison.js +11 -13
- package/dist/scan-comparison.js.map +1 -1
- package/dist/scan-dashboard.d.ts +1 -0
- package/dist/scan-dashboard.d.ts.map +1 -1
- package/dist/scan-dashboard.js +37 -48
- package/dist/scan-dashboard.js.map +1 -1
- package/dist/scan-executor.d.ts +2 -0
- package/dist/scan-executor.d.ts.map +1 -1
- package/dist/scan-executor.js.map +1 -1
- package/dist/scan-history-renderer.d.ts.map +1 -1
- package/dist/scan-history-renderer.js +22 -9
- package/dist/scan-history-renderer.js.map +1 -1
- package/dist/scan-logs.d.ts.map +1 -1
- package/dist/scan-logs.js +5 -5
- package/dist/scan-logs.js.map +1 -1
- package/dist/scanner-import.d.ts +48 -3
- package/dist/scanner-import.d.ts.map +1 -1
- package/dist/scanner-import.js +214 -39
- package/dist/scanner-import.js.map +1 -1
- package/dist/scanner-repository-url.d.ts +14 -0
- package/dist/scanner-repository-url.d.ts.map +1 -0
- package/dist/scanner-repository-url.js +67 -0
- package/dist/scanner-repository-url.js.map +1 -0
- package/dist/semgrep-findings.d.ts.map +1 -1
- package/dist/semgrep-findings.js +50 -88
- package/dist/semgrep-findings.js.map +1 -1
- package/dist/semgrep-platform-findings.d.ts +12 -0
- package/dist/semgrep-platform-findings.d.ts.map +1 -0
- package/dist/semgrep-platform-findings.js +198 -0
- package/dist/semgrep-platform-findings.js.map +1 -0
- package/dist/severity-rubric.d.ts +20 -0
- package/dist/severity-rubric.d.ts.map +1 -0
- package/dist/severity-rubric.js +73 -0
- package/dist/severity-rubric.js.map +1 -0
- package/dist/severity-store.js +15 -5
- package/dist/severity-store.js.map +1 -1
- package/dist/snyk-findings.d.ts.map +1 -1
- package/dist/snyk-findings.js +97 -106
- package/dist/snyk-findings.js.map +1 -1
- package/dist/sonar-collector.d.ts +16 -0
- package/dist/sonar-collector.d.ts.map +1 -0
- package/dist/sonar-collector.js +383 -0
- package/dist/sonar-collector.js.map +1 -0
- package/dist/sonar-findings.d.ts +49 -0
- package/dist/sonar-findings.d.ts.map +1 -0
- package/dist/sonar-findings.js +288 -0
- package/dist/sonar-findings.js.map +1 -0
- package/dist/sonar-import.d.ts +111 -0
- package/dist/sonar-import.d.ts.map +1 -0
- package/dist/sonar-import.js +279 -0
- package/dist/sonar-import.js.map +1 -0
- package/dist/suggest-owners.d.ts.map +1 -1
- package/dist/suggest-owners.js +2 -1
- package/dist/suggest-owners.js.map +1 -1
- package/dist/targets.d.ts +3 -0
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +18 -12
- package/dist/targets.js.map +1 -1
- package/dist/terminal-columns.d.ts +4 -0
- package/dist/terminal-columns.d.ts.map +1 -0
- package/dist/terminal-columns.js +19 -0
- package/dist/terminal-columns.js.map +1 -0
- package/dist/validation-records.d.ts +0 -3
- package/dist/validation-records.d.ts.map +1 -1
- package/dist/validation-records.js +0 -16
- package/dist/validation-records.js.map +1 -1
- package/dist/veracode-findings.d.ts +7 -0
- package/dist/veracode-findings.d.ts.map +1 -0
- package/dist/veracode-findings.js +371 -0
- package/dist/veracode-findings.js.map +1 -0
- package/dist/windows-path.d.ts.map +1 -1
- package/dist/windows-path.js +1 -0
- package/dist/windows-path.js.map +1 -1
- package/dist/wiz-csv.d.ts +2 -2
- package/dist/wiz-csv.d.ts.map +1 -1
- package/dist/wiz-csv.js +1 -3
- package/dist/wiz-csv.js.map +1 -1
- package/dist/wiz-findings.d.ts +10 -2
- package/dist/wiz-findings.d.ts.map +1 -1
- package/dist/wiz-findings.js +88 -49
- package/dist/wiz-findings.js.map +1 -1
- package/docs/classify-severity-records.md +1 -1
- package/docs/cli.md +320 -481
- package/docs/dedupe-records.md +27 -4
- package/docs/findings-service.md +21 -8
- package/docs/hosted-scans.md +16 -1
- package/package.json +9 -10
- package/schemas/external-findings.schema.json +12 -1
- package/schemas/hosted-scan-v2.fixture.json +16 -1
- package/_bundled_plugin/scripts/validate_tracking_source.py +0 -82
- package/_bundled_plugin/scripts/workbench_local_dedupe.py +0 -136
- package/dist/deduplication/records-protocol.d.ts +0 -4
- package/dist/deduplication/records-protocol.d.ts.map +0 -1
- package/dist/deduplication/records-protocol.js +0 -35
- package/dist/deduplication/records-protocol.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-findings-publish.js","sourceRoot":"","sources":["../src/external-findings-publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,MAAM,EACN,EAAE,GACH,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,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AE,OAAO;oBACd,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBACnD,EACD,KAAK,CACN,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { hash, randomUUID } from \"node:crypto\";\nimport { chmodSync } from \"node:fs\";\nimport {\n lstat,\n mkdir,\n open,\n readFile,\n readdir,\n rename,\n rm,\n} from \"node:fs/promises\";\nimport { createRequire } from \"node:module\";\nimport { join } from \"node:path\";\nimport { setTimeout as delay } from \"node:timers/promises\";\nimport { readCloudCredentials } from \"./cloud-publish.js\";\nimport {\n cloudBaseUrl,\n cloudFindingsUrl,\n DEFAULT_CLOUD_BASE_URL,\n} from \"./cloud-endpoint.js\";\nimport { CodexSecurityError } from \"./errors.js\";\nimport { requireExternalImports } from \"./external-imports-feature.js\";\nimport {\n codexSecurityStateDirectory,\n createWindowsOutputDirectory,\n validatePreparedOutputDir,\n} from \"./runtime.js\";\nimport {\n EXTERNAL_FINDINGS_PROVIDERS,\n readExternalFindings,\n type ExternalFindingsReaderOptions,\n} from \"./external-findings-read.js\";\nimport { canonicalJson } from \"./record.js\";\nimport { wizCsvRepositoryUrl } from \"./wiz-csv.js\";\nimport { dependabotRepository } from \"./github-dependabot-findings.js\";\nimport { snykRepositoryUrls } from \"./snyk-findings.js\";\nimport { endorRepositoryUrls } from \"./endor-findings.js\";\nimport type {\n ExternalFindings,\n ExternalPublicationInput,\n} from \"./external-findings.js\";\nimport {\n cloudRepositoryUrlKey,\n validateImportRequest,\n validateExternalEvidence,\n validateExternalReport,\n validateImportReceipt,\n validateRepositories,\n validateSourceReports,\n validateSourceReport,\n} from \"./external-import-contract.js\";\nimport type {\n FindingImportRequest,\n FindingImportReceipt,\n ImportRepository,\n SourceReportSummary,\n} from \"./external-import-models.js\";\n\nconst MAX_REQUEST_BYTES = 5 * 1024 * 1024;\n\n/** Source and destination for evidence already normalized to the Cloud contract. */\nexport interface NormalizedExternalPublicationOptions {\n repository: string;\n provider: FindingImportRequest[\"source\"][\"provider\"];\n sourceKey: string;\n}\n\n/** File readers accept the vendor formats installed in this SDK. */\nexport interface ExternalPublicationOptions extends Omit<\n NormalizedExternalPublicationOptions,\n \"provider\"\n> {\n provider: ExternalFindingsReaderOptions[\"provider\"];\n sourceRepositoryUrl?: string;\n}\n\n/** Optional transport, account, cancellation, and progress hooks. */\nexport interface ExternalPublicationDependencies {\n environment?: NodeJS.ProcessEnv;\n fetch?: (url: string, options: RequestInit) => Promise<Response>;\n credentials?: () => Promise<{ access_token: string; account_id: string }>;\n signal?: AbortSignal;\n onProgress?: (event: ExternalPublicationProgress) => void;\n}\n\nexport interface ExternalPublicationProgress {\n phase:\n | \"reading\"\n | \"discovering\"\n | \"preparing\"\n | \"waiting\"\n | \"uploading\"\n | \"verifying\";\n completed: number;\n total?: number;\n}\n\n/** Counts describe acknowledged receipts, even when later transport or readback fails. */\nexport interface ExternalPublicationResult {\n cloudApiUrl: string;\n cloudUrl?: string;\n status: \"complete\" | \"partial\" | \"interrupted\";\n read: number;\n report?: ExternalFindings[\"report\"];\n ready: number;\n excluded: ExternalFindings[\"excluded\"];\n receipts: FindingImportReceipt[];\n counts: Required<FindingImportReceipt[\"counts\"]>;\n failures: { source_finding_id: string; code: string; message: string }[];\n unacknowledged: number;\n verified: number;\n error?: string;\n savedSubmission?: string;\n}\n\n/** Preserve accepted work in CLI JSON output when publication cannot finish. */\nexport class ExternalPublicationError extends CodexSecurityError {\n constructor(\n message: string,\n public readonly result: ExternalPublicationResult,\n cause: unknown,\n ) {\n super(message, { cause });\n }\n}\n\ninterface SavedSubmission {\n accountId: string;\n requests: FindingImportRequest[];\n receipts?: FindingImportReceipt[];\n inputProjection?: { inputDigest: string; savedEvidenceDigest: string };\n}\n\nexport interface ExternalPublicationPreview extends ExternalFindings {\n cloudApiUrl: string;\n cloudUrl?: string;\n accountId: string;\n destination: ImportRepository;\n source: FindingImportRequest[\"source\"];\n resumed: boolean;\n requests: FindingImportRequest[];\n}\n\nexport interface PreparedExternalPublication {\n preview: ExternalPublicationPreview;\n publish(): Promise<ExternalPublicationResult>;\n}\n\n// Limit read concurrency to avoid one network round trip per finding in series.\n// Wait for the entire batch on failure so callers never outlive their read tasks.\nasync function readInBatches<T, U>(\n items: T[],\n read: (item: T) => Promise<U>,\n): Promise<U[]> {\n const output: U[] = [];\n for (let start = 0; start < items.length; start += 4) {\n const batch = await Promise.allSettled(\n items.slice(start, start + 4).map(read),\n );\n for (const result of batch) {\n if (result.status === \"rejected\") throw result.reason;\n output.push(result.value);\n }\n }\n return output;\n}\n\nfunction sameSubmission(\n left: SavedSubmission,\n right: SavedSubmission,\n): boolean {\n return (\n left.accountId === right.accountId &&\n canonicalJson(left.requests) === canonicalJson(right.requests)\n );\n}\n\nfunction submissionFindings(\n requests: readonly FindingImportRequest[],\n): ExternalFindings[\"findings\"] {\n return requests.flatMap((batch) =>\n batch.items.map(({ source_finding_id, evidence }) => ({\n source_finding_id,\n evidence,\n })),\n );\n}\n\nfunction sameFindingSelection(\n left: ExternalFindings[\"findings\"],\n right: ExternalFindings[\"findings\"],\n): boolean {\n return (\n left.length === right.length &&\n left.every(\n (finding, index) =>\n finding.source_finding_id === right[index]!.source_finding_id,\n )\n );\n}\n\nasync function readOptionalFile(path: string): Promise<string | undefined> {\n return readFile(path, \"utf8\").catch((error: NodeJS.ErrnoException) => {\n if (error.code === \"ENOENT\") return undefined;\n throw error;\n });\n}\n\nfunction reportForJson(report: ExternalFindings[\"report\"]) {\n const errors = report?.[\"errors\"];\n if (!Array.isArray(errors)) return report;\n const json = JSON.stringify(errors, (_key, entry: unknown) =>\n entry instanceof Error ? { message: entry.message } : entry,\n );\n return { ...report, errors: JSON.parse(json) as unknown[] };\n}\n\nasync function writeAtomicJson(path: string, value: unknown): Promise<void> {\n const temporary = `${path}.${randomUUID()}.tmp`;\n try {\n const file = await open(temporary, \"wx\", 0o600);\n try {\n await file.writeFile(JSON.stringify(value));\n await file.sync();\n } finally {\n await file.close();\n }\n await rename(temporary, path);\n } finally {\n await rm(temporary, { force: true });\n }\n}\n\nfunction sourcePath(repository: ImportRepository): string {\n return `/repository_connectors/${encodeURIComponent(repository.repo_connector_id)}/repositories/${encodeURIComponent(repository.id)}/source_reports`;\n}\n\nclass CloudImportError extends CodexSecurityError {\n constructor(\n public readonly status: number,\n message: string,\n ) {\n super(message);\n }\n}\n\nfunction validatePublicationReceipt(\n value: unknown,\n batch: FindingImportRequest,\n): FindingImportReceipt {\n const receipt = validateImportReceipt(value);\n const batchItems = new Map(batch.items.map((item) => [item.client_id, item]));\n if (\n receipt.id !== batch.request_id ||\n canonicalJson(receipt.repository) !== canonicalJson(batch.repository) ||\n canonicalJson(receipt.source) !== canonicalJson(batch.source) ||\n receipt.item_count !== batch.items.length ||\n receipt.results.length !== batch.items.length ||\n new Set(receipt.results.map((item) => item.client_id)).size !==\n batch.items.length ||\n receipt.results.some((item) => !batchItems.has(item.client_id))\n )\n throw new CodexSecurityError(\n \"Cloud returned a receipt for a different publication.\",\n );\n const actual = { created: 0, updated: 0, unchanged: 0, error: 0 };\n for (const result of receipt.results) {\n actual[result.outcome]++;\n if (result.outcome === \"error\") {\n if (\n !result.error ||\n result.source_report_id !== null ||\n result.observation_id !== null ||\n result.canonical_finding_id !== null ||\n result.version !== null\n )\n throw new CodexSecurityError(\n \"Cloud returned inconsistent item error fields.\",\n );\n } else if (\n result.error !== null ||\n !result.source_report_id ||\n !result.observation_id ||\n !result.canonical_finding_id ||\n result.version === null\n )\n throw new CodexSecurityError(\n \"Cloud returned an incomplete saved finding.\",\n );\n }\n if (canonicalJson(receipt.counts) !== canonicalJson(actual))\n throw new CodexSecurityError(\n \"Cloud returned inconsistent publication counts.\",\n );\n return receipt;\n}\n\nasync function withImportLock<T>(\n state: string,\n key: string,\n signal: AbortSignal | undefined,\n operation: () => Promise<T>,\n): Promise<T> {\n if (process.platform === \"win32\")\n await createWindowsOutputDirectory(state, true);\n else await mkdir(state, { recursive: true, mode: 0o700 });\n await validatePreparedOutputDir(state, undefined, true);\n const path = join(state, `${key}.lock.sqlite`);\n const metadata = await lstat(path).catch((error: NodeJS.ErrnoException) => {\n if (error.code === \"ENOENT\") return undefined;\n throw error;\n });\n if (metadata && !metadata.isFile())\n throw new CodexSecurityError(\"The publication lock is not a regular file.\");\n const require = createRequire(import.meta.url);\n const Database = (\n process.versions[\"bun\"]\n ? require(\"bun:sqlite\").Database\n : require(\"node:sqlite\").DatabaseSync\n ) as new (path: string) => { exec(sql: string): void; close(): void };\n const guard = new Database(path);\n try {\n if (process.platform !== \"win32\") chmodSync(path, 0o600);\n guard.exec(\"PRAGMA busy_timeout = 0\");\n for (;;) {\n signal?.throwIfAborted();\n try {\n // Keep this inode across invocations. SQLite releases the transaction\n // on process exit, so a paused publisher cannot lose its lock to a lease.\n guard.exec(\"BEGIN EXCLUSIVE\");\n break;\n } catch (error) {\n const sqliteError = error as { code?: string; errcode?: number };\n if (sqliteError.errcode !== 5 && sqliteError.code !== \"SQLITE_BUSY\")\n throw error;\n await delay(50, undefined, { signal });\n }\n }\n return await operation();\n } finally {\n guard.close();\n }\n}\n\nexport async function prepareExternalPublication(\n path: string,\n options: ExternalPublicationOptions,\n dependencies: ExternalPublicationDependencies = {},\n): Promise<PreparedExternalPublication> {\n requireExternalImports(dependencies.environment);\n const parsed = await readExternalFindings(path, options);\n const normalizedOptions = {\n ...options,\n provider: EXTERNAL_FINDINGS_PROVIDERS[options.provider],\n };\n return parsed.publication\n ? preparePublicationInput(\n parsed.publication,\n normalizedOptions,\n dependencies,\n )\n : prepareNormalizedExternalPublication(\n parsed.findings,\n normalizedOptions,\n dependencies,\n );\n}\n\n/** Prepare normalized provider evidence without reading a vendor export. */\nexport async function prepareNormalizedExternalPublication(\n input: ExternalFindings,\n options: NormalizedExternalPublicationOptions,\n dependencies: ExternalPublicationDependencies = {},\n): Promise<PreparedExternalPublication> {\n requireExternalImports(dependencies.environment);\n // Validation adds Cloud defaults; leave the caller's objects unchanged.\n const { report, ...parsed } = input;\n const current: ExternalFindings = structuredClone(parsed);\n if (report !== undefined) {\n current.report = structuredClone(report);\n validateExternalReport(current.report);\n }\n // structuredClone preserves aliases. Detach every raw record before adding\n // typed defaults, including aliases shared with another finding's evidence.\n for (const finding of current.findings)\n if (finding.evidence.source_data !== undefined)\n finding.evidence.source_data = structuredClone(\n finding.evidence.source_data,\n );\n const identities = new Set<string>();\n for (const finding of current.findings) {\n const id = finding.source_finding_id;\n if (!id.trim() || id.includes(\"\\0\") || Buffer.byteLength(id) > 512)\n throw new CodexSecurityError(\n \"Source finding id must contain 1–512 UTF-8 bytes and no NUL characters.\",\n );\n if (identities.has(id))\n throw new CodexSecurityError(\n `Duplicate source finding id ${JSON.stringify(id)}.`,\n );\n identities.add(id);\n finding.evidence = validateExternalEvidence(finding.evidence);\n }\n const identity =\n current.report === undefined\n ? current.findings\n : { findings: current.findings, report: reportForJson(current.report) };\n return preparePublicationInput(\n {\n current,\n legacy: current,\n currentIdentity: identity,\n legacyIdentity: identity,\n },\n options,\n dependencies,\n );\n}\n\nasync function preparePublicationInput(\n input: ExternalPublicationInput,\n options: NormalizedExternalPublicationOptions,\n dependencies: ExternalPublicationDependencies,\n): Promise<PreparedExternalPublication> {\n const progress = (event: ExternalPublicationProgress): void => {\n try {\n dependencies.onProgress?.(event);\n } catch {\n // Optional progress must not interrupt preparation or publication.\n }\n };\n if (\n !options.sourceKey.trim() ||\n options.sourceKey.includes(\"\\0\") ||\n Buffer.byteLength(options.sourceKey) > 512\n ) {\n throw new CodexSecurityError(\n \"The source key must contain 1–512 UTF-8 bytes and no NUL characters. Use a stable scanner organization/project/branch namespace across imports.\",\n );\n }\n progress({ phase: \"reading\", completed: 0 });\n const {\n current: parsed,\n legacy: legacyParsed,\n currentIdentity,\n legacyIdentity,\n } = input;\n if (parsed.findings.length === 0) {\n const diagnostics = reportForJson(parsed.report)?.[\"errors\"];\n throw new CodexSecurityError(\n `No supported findings are ready to publish. ${parsed.excluded.map((item) => `Item ${item.position}: ${item.reason}`).join(\" \")}${Array.isArray(diagnostics) && diagnostics.length ? ` Scanner diagnostics: ${JSON.stringify(diagnostics)}` : \"\"}`,\n );\n }\n progress({ phase: \"discovering\", completed: 0 });\n const environment = dependencies.environment ?? process.env;\n requireExternalImports(environment);\n const apiBaseUrl = cloudBaseUrl(environment);\n const cloudApiUrl = `${apiBaseUrl}/external`;\n // Validate the configured return destination before authentication or uploads.\n cloudFindingsUrl(environment, options.repository);\n const credentials = await (\n dependencies.credentials ?? (() => readCloudCredentials(environment))\n )();\n async function request(\n endpoint: string,\n body?: FindingImportRequest,\n ): Promise<unknown> {\n dependencies.signal?.throwIfAborted();\n // Allow upload and response transport around the server's publication budget.\n const timeout = AbortSignal.timeout(body ? 60_000 : 30_000);\n const response = await (dependencies.fetch ?? globalThis.fetch)(\n `${cloudApiUrl}${endpoint}`,\n {\n method: body ? \"POST\" : \"GET\",\n headers: {\n Authorization: `Bearer ${credentials.access_token}`,\n \"ChatGPT-Account-ID\": credentials.account_id,\n Accept: \"application/json\",\n ...(body ? { \"Content-Type\": \"application/json\" } : {}),\n },\n ...(body ? { body: JSON.stringify(body) } : {}),\n redirect: \"error\",\n signal: dependencies.signal\n ? AbortSignal.any([dependencies.signal, timeout])\n : timeout,\n },\n );\n if (!response.ok) {\n const payload = (await response.json().catch(() => null)) as {\n error?: { message?: string };\n } | null;\n const retryAfter = response.headers.get(\"Retry-After\");\n throw new CloudImportError(\n response.status,\n `Cloud import failed (HTTP ${response.status}). ${payload?.error?.message ?? response.statusText}${retryAfter ? ` Retry-After: ${retryAfter}.` : \"\"}`,\n );\n }\n return response.json();\n }\n const destinations: ImportRepository[] = [];\n let page: string | null = null;\n const seenPages = new Set<string>();\n do {\n const result = validateRepositories(\n await request(\n `/repositories?limit=20&repository=${encodeURIComponent(options.repository)}${page ? `&page=${encodeURIComponent(page)}` : \"\"}`,\n ),\n );\n destinations.push(\n ...result.data.filter(\n (item) =>\n item.id === options.repository ||\n cloudRepositoryUrlKey(item.url) ===\n cloudRepositoryUrlKey(options.repository),\n ),\n );\n page = result.next;\n if (\n result.has_more !== (page !== null) ||\n (page !== null && seenPages.has(page))\n )\n throw new CodexSecurityError(\n \"Cloud returned invalid repository pagination.\",\n );\n if (page !== null) seenPages.add(page);\n } while (page !== null);\n if (destinations.length !== 1)\n throw new CodexSecurityError(\n destinations.length\n ? \"The repository matches multiple connectors. Select an unambiguous Cloud repository.\"\n : \"The destination repository is not available to this Cloud account. Copy its repository URL or ID from Codex Security Cloud and check that you are signed into the intended account.\",\n );\n const destination = destinations[0]!;\n const source = { provider: options.provider, source_key: options.sourceKey };\n const state = join(\n codexSecurityStateDirectory(environment),\n \"external-finding-publications\",\n );\n const checkpointIdentity = [\n // Keep existing production checkpoints readable; other deployments must\n // never share a saved request or receipt with the production default.\n ...(apiBaseUrl === DEFAULT_CLOUD_BASE_URL ? [] : [apiBaseUrl]),\n credentials.account_id,\n destination.id,\n destination.repo_connector_id,\n source,\n ];\n const inputDigest = hash(\"sha256\", canonicalJson(currentIdentity));\n const legacyInputDigest = hash(\"sha256\", canonicalJson(legacyIdentity));\n function validateSaved(serialized: string, legacy = false): SavedSubmission {\n const content = JSON.parse(serialized) as SavedSubmission;\n if (\n content.accountId !== credentials.account_id ||\n !Array.isArray(content.requests) ||\n content.requests.length === 0\n )\n throw new Error(\"Saved import account or requests do not match.\");\n content.requests = content.requests.map(validateImportRequest);\n const savedFindings = submissionFindings(content.requests);\n const savedEvidence = canonicalJson(savedFindings);\n const expected = legacy ? legacyParsed.findings : parsed.findings;\n const matches =\n content.inputProjection !== undefined\n ? sameFindingSelection(savedFindings, expected) &&\n content.inputProjection?.inputDigest ===\n (legacy ? legacyInputDigest : inputDigest) &&\n content.inputProjection?.savedEvidenceDigest ===\n hash(\"sha256\", savedEvidence)\n : savedEvidence === canonicalJson(expected);\n if (!matches)\n throw new Error(\n \"Saved import evidence does not match the selected input.\",\n );\n for (const submission of content.requests) {\n if (\n submission.repository.id !== destination.id ||\n submission.repository.repo_connector_id !==\n destination.repo_connector_id ||\n canonicalJson(submission.source) !== canonicalJson(source)\n )\n throw new Error(\"Saved import destination does not match.\");\n }\n return content;\n }\n const key = hash(\n \"sha256\",\n canonicalJson([...checkpointIdentity, currentIdentity]),\n );\n const pendingPath = join(state, `${key}.pending.json`);\n const historicalKey = hash(\n \"sha256\",\n canonicalJson(\n [...checkpointIdentity, legacyParsed.findings],\n (left, right) => left.localeCompare(right),\n ),\n );\n const legacyKeys = new Set([\n hash(\"sha256\", canonicalJson([...checkpointIdentity, legacyIdentity])),\n historicalKey,\n ]);\n async function rejectUnidentifiedLegacyCheckpoint(): Promise<void> {\n const entries = await readdir(state, { withFileTypes: true }).catch(\n (error: NodeJS.ErrnoException) => {\n if (error.code === \"ENOENT\") return [];\n throw error;\n },\n );\n if (entries.length) await validatePreparedOutputDir(state, undefined, true);\n for (const entry of entries) {\n if (!entry.isFile() || !/^[a-f0-9]{64}\\.pending\\.json$/u.test(entry.name))\n continue;\n const candidateKey = entry.name.slice(0, -\".pending.json\".length);\n if (candidateKey === key || legacyKeys.has(candidateKey)) continue;\n const serialized = await readOptionalFile(join(state, entry.name));\n if (serialized === undefined) continue;\n try {\n // Locale-dependent filenames predate input projections. Later formats\n // must remain isolated by their deployment-bound checkpoint keys.\n const content = JSON.parse(serialized) as SavedSubmission | null;\n if (!content || content.inputProjection !== undefined) continue;\n validateSaved(serialized, true);\n } catch {\n continue;\n }\n // These older bodies contain no deployment identity. Do not guess a\n // destination or replace their immutable request with a fresh publication.\n throw new CodexSecurityError(\n \"An older pending import matches this input, but its checkpoint identity could not be established. Resume it using the original deployment and locale before publishing this selection. The saved request was preserved without uploading.\",\n );\n }\n }\n let recovered: SavedSubmission | undefined;\n for (const legacyKey of legacyKeys) {\n if (legacyKey === key) continue;\n const legacyPath = join(state, `${legacyKey}.pending.json`);\n const captured = await readOptionalFile(legacyPath);\n if (captured !== undefined) {\n // Preserve requests staged by the earlier locale-based filename format.\n // Hold both publication locks while moving the original checkpoint.\n await withImportLock(state, key, dependencies.signal, async () =>\n withImportLock(state, legacyKey, dependencies.signal, async () => {\n const current = await readOptionalFile(pendingPath);\n const serialized = await readOptionalFile(legacyPath);\n if (current !== undefined) {\n recovered = validateSaved(current);\n if (serialized !== undefined) {\n // A crash may leave both copies after installing the canonical file.\n // Retire only an identical immutable submission, never another request.\n let duplicate: SavedSubmission | null = null;\n try {\n duplicate = JSON.parse(serialized) as SavedSubmission | null;\n } catch (error) {\n if (!(error instanceof SyntaxError)) throw error;\n }\n if (\n duplicate !== null &&\n typeof duplicate === \"object\" &&\n sameSubmission(duplicate, recovered)\n )\n await rm(legacyPath);\n }\n return;\n }\n // A competing resumer may have completed and removed both paths while\n // this caller waited. Retain its observed immutable request and receipts.\n const content = validateSaved(serialized ?? captured, true);\n if (!sameFindingSelection(legacyParsed.findings, parsed.findings))\n throw new CodexSecurityError(\n \"The saved import selects different findings from this input. Resume the original selection before publishing this selection.\",\n );\n if (\n content.requests.some(\n (submission) =>\n submission.repository.reset_marker !== destination.reset_marker,\n )\n ) {\n if (serialized !== undefined) await rm(legacyPath);\n throw new CloudImportError(\n 409,\n \"The repository was reset after this submission. The saved request was retired without uploading. Review the destination and run the command again to approve a fresh publication.\",\n );\n }\n const savedEvidenceDigest =\n content.inputProjection?.savedEvidenceDigest ??\n hash(\"sha256\", canonicalJson(legacyParsed.findings));\n const rebindProjection =\n content.inputProjection !== undefined ||\n savedEvidenceDigest !== inputDigest;\n if (rebindProjection)\n content.inputProjection = { inputDigest, savedEvidenceDigest };\n recovered = content;\n if (serialized === undefined) return;\n if (!rebindProjection) {\n await rename(legacyPath, pendingPath);\n } else {\n // Bind the new input projection to the original immutable evidence,\n // so later inventory reordering still resumes these exact requests.\n await writeAtomicJson(pendingPath, content);\n await rm(legacyPath);\n }\n }),\n );\n }\n }\n const serialized = await readOptionalFile(pendingPath);\n const saved =\n serialized === undefined ? recovered : validateSaved(serialized);\n if (!saved) await rejectUnidentifiedLegacyCheckpoint();\n if (saved) {\n const content = saved;\n for (const submission of content.requests) {\n if (submission.repository.reset_marker !== destination.reset_marker) {\n // The old request is never sent after reset. A subsequent explicit\n // invocation prepares a fresh submission and asks for approval again.\n await withImportLock(state, key, dependencies.signal, async () => {\n const current = await readOptionalFile(pendingPath);\n if (\n current !== undefined &&\n sameSubmission(JSON.parse(current) as SavedSubmission, content)\n )\n await rm(pendingPath);\n });\n throw new CloudImportError(\n 409,\n \"The repository was reset after this submission. The saved request was retired without uploading. Review the destination and run the command again to approve a fresh publication.\",\n );\n }\n }\n }\n let requests = saved?.requests;\n if (!requests) {\n for (const finding of parsed.findings) {\n const sourceRepositories = [\n finding.evidence.details?.repository?.url,\n ...(options.provider === \"wiz\"\n ? [wizCsvRepositoryUrl(finding.evidence)]\n : []),\n ...(options.provider === \"snyk\"\n ? snykRepositoryUrls(finding.evidence.source_data, {\n cloudRepositoryUrl: destination.url,\n })\n : []),\n ...(options.provider === \"endor\"\n ? endorRepositoryUrls(finding.evidence.source_data)\n : []),\n options.provider === \"github\"\n ? dependabotRepository(finding)\n : undefined,\n ];\n for (const sourceRepository of sourceRepositories)\n if (\n sourceRepository &&\n cloudRepositoryUrlKey(sourceRepository) !==\n cloudRepositoryUrlKey(destination.url)\n )\n throw new CodexSecurityError(\n `Finding ${JSON.stringify(finding.source_finding_id)} belongs to ${JSON.stringify(sourceRepository)}, which does not match the selected Cloud repository ${JSON.stringify(destination.url)}. Verify the source repository mapping before publishing.`,\n );\n }\n let preparedCount = 0;\n progress({\n phase: \"preparing\",\n completed: 0,\n total: parsed.findings.length,\n });\n const previousReports = await readInBatches(\n parsed.findings,\n async (finding): Promise<SourceReportSummary | undefined> => {\n const query = new URLSearchParams({\n provider: source.provider,\n source_key: source.source_key,\n source_finding_id: finding.source_finding_id,\n limit: \"2\",\n });\n const summaries = validateSourceReports(\n await request(`${sourcePath(destination)}?${query}`),\n );\n if (summaries.has_more || summaries.data.length > 1)\n throw new CodexSecurityError(\n \"Cloud returned more than one report for a source identity.\",\n );\n const previous = summaries.data[0];\n if (\n previous &&\n (previous.source_finding_id !== finding.source_finding_id ||\n previous.source.provider !== source.provider ||\n previous.source.source_key !== source.source_key ||\n previous.repo_id !== destination.id ||\n previous.repo_connector_id !== destination.repo_connector_id)\n )\n throw new CodexSecurityError(\n \"Cloud returned a different source identity.\",\n );\n progress({\n phase: \"preparing\",\n completed: ++preparedCount,\n total: parsed.findings.length,\n });\n return previous;\n },\n );\n requests = [];\n let current: FindingImportRequest | undefined;\n let currentBytes = 0;\n for (const [index, finding] of parsed.findings.entries()) {\n const previous = previousReports[index];\n const environmentId =\n previous?.environment_id ?? destination.import_environment_id;\n if (environmentId == null)\n throw new CodexSecurityError(\n \"Configure an authorized Cloud environment for this repository before importing findings.\",\n );\n const item = {\n client_id: `item-${index + 1}`,\n source_finding_id: finding.source_finding_id,\n expected_version: previous?.version ?? 0,\n evidence: finding.evidence,\n };\n const itemBytes = Buffer.byteLength(JSON.stringify(item));\n if (\n current &&\n (current.repository.environment_id !== environmentId ||\n current.items.length === 100 ||\n currentBytes + 1 + itemBytes > MAX_REQUEST_BYTES)\n ) {\n requests.push(validateImportRequest(current));\n current = undefined;\n }\n if (!current) {\n current = {\n request_id: randomUUID(),\n repository: {\n id: destination.id,\n repo_connector_id: destination.repo_connector_id,\n environment_id: environmentId,\n reset_marker: destination.reset_marker,\n },\n source,\n items: [],\n };\n currentBytes = Buffer.byteLength(JSON.stringify(current));\n } else {\n currentBytes++;\n }\n current.items.push(item);\n currentBytes += itemBytes;\n }\n if (current) requests.push(validateImportRequest(current));\n }\n const submission: SavedSubmission = {\n accountId: credentials.account_id,\n requests,\n receipts: saved?.receipts,\n inputProjection: saved?.inputProjection ?? {\n inputDigest,\n savedEvidenceDigest: hash(\n \"sha256\",\n canonicalJson(submissionFindings(requests)),\n ),\n },\n };\n const preview: ExternalPublicationPreview = {\n ...parsed,\n findings: submissionFindings(requests),\n cloudApiUrl,\n cloudUrl: cloudFindingsUrl(environment, destination.id),\n accountId: credentials.account_id,\n destination,\n source,\n resumed: saved !== undefined,\n requests,\n };\n return {\n preview: structuredClone(preview),\n async publish() {\n progress({ phase: \"waiting\", completed: 0 });\n const result = (\n acknowledged: FindingImportReceipt[],\n verified: number,\n ): ExternalPublicationResult => {\n const counts = { created: 0, updated: 0, unchanged: 0, error: 0 };\n const failures: ExternalPublicationResult[\"failures\"] = [];\n for (const [index, receipt] of acknowledged.entries()) {\n for (const outcome of Object.keys(counts) as (keyof typeof counts)[])\n counts[outcome] += receipt.counts[outcome] ?? 0;\n const ids = new Map(\n requests[index]!.items.map((item) => [\n item.client_id,\n item.source_finding_id,\n ]),\n );\n for (const item of receipt.results)\n if (item.error)\n failures.push({\n source_finding_id: ids.get(item.client_id)!,\n ...item.error,\n });\n }\n return {\n cloudApiUrl,\n cloudUrl: preview.cloudUrl,\n status:\n parsed.excluded.length || counts.error ? \"partial\" : \"complete\",\n read: parsed.read,\n ...(parsed.report === undefined\n ? {}\n : { report: structuredClone(parsed.report) }),\n ready: parsed.findings.length,\n excluded: parsed.excluded,\n receipts: acknowledged,\n counts,\n failures,\n unacknowledged:\n parsed.findings.length -\n Object.values(counts).reduce((sum, count) => sum + count, 0),\n verified,\n };\n };\n let acquired = false;\n return await withImportLock(state, key, dependencies.signal, async () => {\n acquired = true;\n // Re-read under the lock to keep checkpoints from another publisher.\n const pending = await readOptionalFile(pendingPath);\n if (pending === undefined && !saved)\n await rejectUnidentifiedLegacyCheckpoint();\n const current =\n pending === undefined\n ? submission\n : (JSON.parse(pending) as SavedSubmission);\n if (!sameSubmission(current, submission))\n throw new CodexSecurityError(\n \"Another publication prepared this input. Run the command again to review and resume that saved request.\",\n );\n const receipts = (current.receipts ?? []).map(validateImportReceipt);\n if (receipts.length > requests.length)\n throw new CodexSecurityError(\n \"Saved publication has more receipts than requests.\",\n );\n const acknowledged: FindingImportReceipt[] = [];\n let verified = 0;\n let persisted = pending !== undefined;\n try {\n if (pending === undefined) {\n await writeAtomicJson(pendingPath, submission);\n persisted = true;\n }\n progress({\n phase: \"uploading\",\n completed: 0,\n total: parsed.findings.length,\n });\n let acknowledgedCount = 0;\n for (const [batchIndex, batch] of requests.entries()) {\n const receipt = validatePublicationReceipt(\n receipts[batchIndex] ??\n (await request(\"/finding_imports\", batch)),\n batch,\n );\n acknowledged.push(receipt);\n acknowledgedCount += receipt.item_count;\n progress({\n phase: \"uploading\",\n completed: acknowledgedCount,\n total: parsed.findings.length,\n });\n if (batchIndex === receipts.length) {\n receipts.push(receipt);\n // Acknowledged batches must not consume another POST quota on retry.\n // Readback can still resume after this checkpoint without replaying writes.\n await writeAtomicJson(pendingPath, {\n ...submission,\n receipts,\n });\n }\n }\n // Verify readable source records without mistaking a newer concurrent\n // observation for failure of the original, immutable import receipt.\n const readbacks = receipts.flatMap((receipt, batchIndex) => {\n const batch = requests[batchIndex]!;\n const batchItems = new Map(\n batch.items.map((item) => [item.client_id, item]),\n );\n return receipt.results\n .filter((item) => item.outcome !== \"error\")\n .map((item) => ({\n item,\n expected: batchItems.get(item.client_id)!,\n batch,\n }));\n });\n progress({\n phase: \"verifying\",\n completed: 0,\n total: readbacks.length,\n });\n await readInBatches(readbacks, async ({ item, expected, batch }) => {\n const report = validateSourceReport(\n await request(\n `${sourcePath(destination)}/${encodeURIComponent(item.source_report_id!)}`,\n ),\n );\n if (\n report.id !== item.source_report_id ||\n report.canonical_finding_id !== item.canonical_finding_id ||\n report.version < item.version! ||\n (report.version === item.version &&\n (report.observation_id !== item.observation_id ||\n canonicalJson(report.evidence) !==\n canonicalJson(expected.evidence))) ||\n report.source_finding_id !== expected.source_finding_id ||\n report.repo_id !== destination.id ||\n report.repo_connector_id !== destination.repo_connector_id ||\n report.environment_id !== batch.repository.environment_id ||\n canonicalJson(report.source) !== canonicalJson(source)\n )\n throw new CodexSecurityError(\n \"Cloud readback did not match the saved finding identity.\",\n );\n progress({\n phase: \"verifying\",\n completed: ++verified,\n total: readbacks.length,\n });\n });\n const completed = result(acknowledged, verified);\n await writeAtomicJson(join(state, `${key}.result.json`), {\n ...completed,\n report: reportForJson(completed.report),\n });\n await rm(pendingPath, { force: true });\n return completed;\n } catch (error) {\n if (error instanceof CloudImportError && error.status === 409) {\n await rm(pendingPath, { force: true });\n persisted = false;\n }\n const message = `${error instanceof Error ? error.message : String(error)} ${error instanceof CloudImportError && error.status === 409 ? \"The old submission was retired. Rediscover and approve a fresh publication.\" : persisted ? `Repeat the same command to resume the saved request. Saved submission: ${pendingPath}` : \"No resumable request was saved. Correct the error and review the input before retrying.\"}`;\n throw new ExternalPublicationError(\n message,\n {\n ...result(acknowledged, verified),\n status: \"interrupted\",\n error: message,\n ...(persisted ? { savedSubmission: pendingPath } : {}),\n },\n error,\n );\n }\n }).catch((error: unknown) => {\n if (acquired || !dependencies.signal?.aborted) throw error;\n // The active publisher owns the checkpoint. Report only acknowledgements\n // already observed during preparation, without rewriting its files.\n const known = submission.receipts ?? [];\n if (known.length > requests.length)\n throw new CodexSecurityError(\n \"Saved publication has more receipts than requests.\",\n );\n const acknowledged = known.map((receipt, index) =>\n validatePublicationReceipt(receipt, requests[index]!),\n );\n const message = saved\n ? `Publication canceled while waiting. Repeat the same command to resume the saved request. Saved submission: ${pendingPath}`\n : \"Publication canceled while waiting. No resumable request was saved by this invocation.\";\n throw new ExternalPublicationError(\n message,\n {\n ...result(acknowledged, 0),\n status: \"interrupted\",\n error: message,\n ...(saved ? { savedSubmission: pendingPath } : {}),\n },\n error,\n );\n });\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"external-findings-publish.js","sourceRoot":"","sources":["../src/external-findings-publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,QAAQ,EAC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AO,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,YAAY,gBAAgB,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,6EAA6E,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,0EAA0E,WAAW,EAAE,CAAC,CAAC,CAAC,yFAAyF,EAAE,CAAC;oBAC3Z,MAAM,IAAI,wBAAwB,CAChC,OAAO,EACP;wBACE,GAAG,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC;wBACjC,MAAM,EAAE,aAAa;wBACrB,KAAK,EAAE,OAAO;wBACd,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;qBACvD,EACD,KAAK,CACN,CAAC;gBACJ,CAAC;YACH,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;gBAC1B,IAAI,QAAQ,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO;oBAAE,MAAM,KAAK,CAAC;gBAC3D,MAAM,OAAO,GAAG,KAAK;oBACnB,CAAC,CAAC,8GAA8G,WAAW,EAAE;oBAC7H,CAAC,CAAC,wFAAwF,CAAC;gBAC7F,MAAM,kBAAkB,CACtB,OAAO,EACP,KAAK,EACL,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAChC,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import { hash, randomUUID } from \"node:crypto\";\nimport { chmodSync } from \"node:fs\";\nimport {\n lstat,\n mkdir,\n open,\n readFile,\n readdir,\n rename,\n rm,\n} from \"node:fs/promises\";\nimport { createRequire } from \"node:module\";\nimport { join } from \"node:path\";\nimport { setTimeout as delay } from \"node:timers/promises\";\nimport { isBoxedPrimitive, isNativeError, isProxy } from \"node:util/types\";\nimport {\n privateImportClient,\n selectPrivateReport,\n type PrivateImportFormat,\n readPrivateCheckpoint,\n unsuccessfulJob,\n type PrivateImportJob,\n} from \"./private-finding-import.js\";\nimport { readCloudCredentials } from \"./cloud-publish.js\";\nimport {\n cloudBaseUrl,\n cloudFindingsUrl,\n DEFAULT_CLOUD_BASE_URL,\n} from \"./cloud-endpoint.js\";\nimport { CodexSecurityError, errorMessage } from \"./errors.js\";\nimport { requireExternalImports } from \"./external-imports-feature.js\";\nimport {\n codexSecurityStateDirectory,\n createWindowsOutputDirectory,\n validatePreparedOutputDir,\n} from \"./runtime.js\";\nimport {\n EXTERNAL_FINDINGS_PROVIDERS,\n readExternalFindings,\n type ExternalFindingsReaderOptions,\n} from \"./external-findings-read.js\";\nimport {\n canSnapshotWithoutGetters,\n canonicalJson,\n isRecord,\n} from \"./record.js\";\nimport { notify } from \"./value.js\";\nimport { wizCsvRepositoryUrl } from \"./wiz-csv.js\";\nimport { wizFindingRepository } from \"./wiz-findings.js\";\nimport { previousReaderSelection } from \"./reader-selection.js\";\nimport { dependabotRepository } from \"./github-dependabot-findings.js\";\nimport { snykRepositoryUrls } from \"./snyk-findings.js\";\nimport { endorRepositoryUrls } from \"./endor-findings.js\";\nimport {\n blackDuckReportRepositories,\n projectedBlackDuckRepositoryUrl,\n} from \"./blackduck-findings.js\";\nimport { continuumReportRepositories } from \"./continuum-findings.js\";\nimport { veracodeReportRepositories } from \"./veracode-findings.js\";\nimport { inspectorReportRepository } from \"./inspector-findings.js\";\nimport { sonarRepositoryUrls } from \"./sonar-findings.js\";\nimport {\n snapshotImportOptions,\n cloneImportPreview,\n nativeErrorStackGetter,\n snapshotNormalizedFindings,\n type ExternalFindings,\n type ExternalPublicationInput,\n} from \"./external-findings.js\";\nimport {\n cloudRepositoryUrlKey,\n CloudEvidenceDepthError,\n validateImportRequest,\n validateExternalEvidence,\n validatePreviousCloudEvidence,\n validateExternalReport,\n validateImportReceipt,\n validateRepositories,\n validateSourceReports,\n validateSourceReport,\n} from \"./external-import-contract.js\";\nimport type {\n FindingImportRequest,\n FindingImportReceipt,\n ImportRepository,\n SourceReportSummary,\n} from \"./external-import-models.js\";\n\nconst MAX_REQUEST_BYTES = 5 * 1024 * 1024;\n\n/** Source and destination for evidence already normalized to the Cloud contract. */\nexport interface NormalizedExternalPublicationOptions {\n repository: string;\n provider: FindingImportRequest[\"source\"][\"provider\"];\n sourceKey: string;\n /** Full Inspector project ARNs mapped to independently verified repository URLs. */\n inspectorProjectMap?: ReadonlyMap<string, string>;\n}\n\n/** File readers accept the vendor formats installed in this SDK. */\nexport interface ExternalPublicationOptions extends Omit<\n NormalizedExternalPublicationOptions,\n \"provider\"\n> {\n provider: ExternalFindingsReaderOptions[\"provider\"];\n sourceRepositoryUrl?: string;\n}\n\n/** Optional transport, account, cancellation, and progress hooks. */\nexport interface ExternalPublicationDependencies {\n environment?: NodeJS.ProcessEnv;\n fetch?: (url: string, options: RequestInit) => Promise<Response>;\n credentials?: () => Promise<{ access_token: string; account_id: string }>;\n signal?: AbortSignal;\n onProgress?: (event: ExternalPublicationProgress) => void;\n}\n\nexport interface ExternalPublicationProgress {\n phase:\n | \"reading\"\n | \"discovering\"\n | \"preparing\"\n | \"waiting\"\n | \"uploading\"\n | \"verifying\";\n completed: number;\n total?: number;\n}\n\n/** Counts describe acknowledged receipts, even when later transport or readback fails. */\nexport interface ExternalPublicationResult {\n cloudApiUrl: string;\n cloudUrl?: string;\n status: \"complete\" | \"partial\" | \"interrupted\";\n read: number;\n report?: ExternalFindings[\"report\"];\n ready: number;\n excluded: ExternalFindings[\"excluded\"];\n receipts: FindingImportReceipt[];\n counts: Required<FindingImportReceipt[\"counts\"]>;\n failures: { source_finding_id: string; code: string; message: string }[];\n unacknowledged: number;\n verified: number;\n error?: string;\n savedSubmission?: string;\n /** Private jobs expose aggregate outcomes before assessment or publication. */\n privateJob?: PrivateImportJob;\n}\n\n/** Preserve accepted work in CLI JSON output when publication cannot finish. */\nexport class ExternalPublicationError extends CodexSecurityError {\n constructor(\n message: string,\n public readonly result: ExternalPublicationResult,\n cause: unknown,\n ) {\n super(message, { cause });\n }\n}\n\ninterface SavedSubmission {\n accountId: string;\n requests: FindingImportRequest[];\n receipts?: FindingImportReceipt[];\n inputProjection?: {\n identityFormat?: 2;\n inputDigest: string;\n savedEvidenceDigest: string;\n };\n // A verified older approval stays at its original deployment-bound filename.\n wireKey?: string;\n // Only a verified released approval may preserve a native value different from fresh JSON.\n legacyApproval?: true;\n // The older canonical file was checked under its lock for a second approval.\n canonicalChecked?: true;\n inspectorProjectMapRequired?: true;\n}\n\nexport interface ExternalPublicationPreview extends ExternalFindings {\n cloudApiUrl: string;\n cloudUrl?: string;\n accountId: string;\n destination: ImportRepository;\n source: FindingImportRequest[\"source\"];\n resumed: boolean;\n requests: FindingImportRequest[];\n privateImport?: {\n format: PrivateImportFormat;\n contextVersion: string;\n sha256: string;\n bytes: number;\n retryOfJobId?: string;\n };\n}\n\nexport interface PreparedExternalPublication {\n preview: ExternalPublicationPreview;\n publish(): Promise<ExternalPublicationResult>;\n}\n\n// Limit read concurrency to avoid one network round trip per finding in series.\n// Wait for the entire batch on failure so callers never outlive their read tasks.\nasync function readInBatches<T, U>(\n items: T[],\n read: (item: T) => Promise<U>,\n): Promise<U[]> {\n const output: U[] = [];\n for (let start = 0; start < items.length; start += 4) {\n const batch = await Promise.allSettled(\n items.slice(start, start + 4).map(read),\n );\n for (const result of batch) {\n if (result.status === \"rejected\") throw result.reason;\n output.push(result.value);\n }\n }\n return output;\n}\n\n// JSON.stringify serializes boxed primitives after the replacer. Let it\n// produce their actual wire values, including false and strings.\nfunction wireJson(value: unknown): string {\n return canonicalJson(value, undefined, isBoxedPrimitive);\n}\n\nfunction jsonDigest(value: unknown, serialize = wireJson): string {\n return hash(\"sha256\", serialize(value));\n}\n\nfunction sameSubmission(\n left: SavedSubmission,\n right: SavedSubmission,\n): boolean {\n return (\n left.accountId === right.accountId &&\n left.inspectorProjectMapRequired === right.inspectorProjectMapRequired &&\n wireJson(left.requests) === wireJson(right.requests)\n );\n}\n\nfunction wireFinding({\n source_finding_id,\n evidence,\n}: ExternalFindings[\"findings\"][number]) {\n return { source_finding_id, evidence };\n}\n\nfunction submissionFindings(\n requests: readonly FindingImportRequest[],\n): ExternalFindings[\"findings\"] {\n return requests.flatMap((batch) => batch.items.map(wireFinding));\n}\n\nfunction sameLegacyJson(\n saved: unknown,\n current: unknown,\n equivalent: (saved: unknown, current: unknown) => boolean,\n): boolean {\n if (saved === current || equivalent(saved, current)) return true;\n if (Array.isArray(saved) && Array.isArray(current))\n return (\n saved.length === current.length &&\n saved.every((child, i) => sameLegacyJson(child, current[i], equivalent))\n );\n if (!isRecord(saved) || !isRecord(current)) return false;\n return (\n Object.keys(current).every((key) => Object.hasOwn(saved, key)) &&\n Object.keys(saved).every((key) =>\n sameLegacyJson(saved[key], current[key], equivalent),\n )\n );\n}\n\n// A copied reader result can retain the JSON from Buffer.toJSON but lose\n// the native Buffer that the previous reader cloned into a Uint8Array.\nfunction previousBufferJson(saved: unknown, current: unknown): boolean {\n if (\n !isRecord(current) ||\n current[\"type\"] !== \"Buffer\" ||\n !Array.isArray(current[\"data\"])\n )\n return false;\n return (\n isRecord(saved) &&\n Object.keys(current).length === 2 &&\n Object.keys(saved).length === current[\"data\"].length &&\n current[\"data\"].every(\n (byte, index) =>\n Number.isInteger(byte) &&\n byte >= 0 &&\n byte <= 255 &&\n saved[index] === byte,\n )\n );\n}\n\nfunction sameFindingSelection(\n left: ExternalFindings[\"findings\"],\n right: ExternalFindings[\"findings\"],\n): boolean {\n return (\n left.length === right.length &&\n left.every(\n (finding, index) =>\n finding.source_finding_id === right[index]!.source_finding_id,\n )\n );\n}\n\nasync function readOptionalFile(path: string): Promise<string | undefined> {\n return readFile(path, \"utf8\").catch((error: NodeJS.ErrnoException) => {\n if (error.code === \"ENOENT\") return undefined;\n throw error;\n });\n}\n\nfunction reportForJson(report: ExternalFindings[\"report\"]) {\n const errors = report?.[\"errors\"];\n if (!Array.isArray(errors)) return report;\n const json = JSON.stringify(errors, (_key, entry: unknown) =>\n entry instanceof Error ? { ...entry, message: entry.message } : entry,\n );\n return { ...report, errors: JSON.parse(json) as unknown[] };\n}\n\nexport function externalPublicationStateDirectory(\n environment: NodeJS.ProcessEnv,\n): string {\n return join(\n codexSecurityStateDirectory(environment),\n \"external-finding-publications\",\n );\n}\n\nexport async function writeAtomicJson(\n path: string,\n value: unknown,\n): Promise<void> {\n const temporary = `${path}.${randomUUID()}.tmp`;\n try {\n const file = await open(temporary, \"wx\", 0o600);\n try {\n await file.writeFile(JSON.stringify(value));\n await file.sync();\n } finally {\n await file.close();\n }\n await rename(temporary, path);\n } finally {\n await rm(temporary, { force: true });\n }\n}\n\nfunction sourcePath(repository: ImportRepository): string {\n return `/repository_connectors/${encodeURIComponent(repository.repo_connector_id)}/repositories/${encodeURIComponent(repository.id)}/source_reports`;\n}\n\nclass CloudImportError extends CodexSecurityError {\n constructor(\n public readonly status: number,\n message: string,\n ) {\n super(message);\n }\n}\n\nfunction validatePublicationReceipt(\n value: unknown,\n batch: FindingImportRequest,\n): FindingImportReceipt {\n const receipt = validateImportReceipt(value);\n const batchItems = new Map(batch.items.map((item) => [item.client_id, item]));\n if (\n receipt.id !== batch.request_id ||\n wireJson(receipt.repository) !== wireJson(batch.repository) ||\n wireJson(receipt.source) !== wireJson(batch.source) ||\n receipt.item_count !== batch.items.length ||\n receipt.results.length !== batch.items.length ||\n new Set(receipt.results.map((item) => item.client_id)).size !==\n batch.items.length ||\n receipt.results.some((item) => !batchItems.has(item.client_id))\n )\n throw new CodexSecurityError(\n \"Cloud returned a receipt for a different publication.\",\n );\n const actual = { created: 0, updated: 0, unchanged: 0, error: 0 };\n for (const result of receipt.results) {\n actual[result.outcome]++;\n if (result.outcome === \"error\") {\n if (\n !result.error ||\n result.source_report_id !== null ||\n result.observation_id !== null ||\n result.canonical_finding_id !== null ||\n result.version !== null\n )\n throw new CodexSecurityError(\n \"Cloud returned inconsistent item error fields.\",\n );\n } else if (\n result.error !== null ||\n !result.source_report_id ||\n !result.observation_id ||\n !result.canonical_finding_id ||\n result.version === null\n )\n throw new CodexSecurityError(\n \"Cloud returned an incomplete saved finding.\",\n );\n }\n if (wireJson(receipt.counts) !== wireJson(actual))\n throw new CodexSecurityError(\n \"Cloud returned inconsistent publication counts.\",\n );\n return receipt;\n}\n\nasync function withImportLocks<T>(\n state: string,\n keys: string[],\n signal: AbortSignal | undefined,\n operation: () => Promise<T>,\n): Promise<T> {\n if (process.platform === \"win32\")\n await createWindowsOutputDirectory(state, true);\n else await mkdir(state, { recursive: true, mode: 0o700 });\n await validatePreparedOutputDir(state, undefined, true);\n const require = createRequire(import.meta.url);\n const Database = (\n process.versions[\"bun\"]\n ? require(\"bun:sqlite\").Database\n : require(\"node:sqlite\").DatabaseSync\n ) as new (path: string) => { exec(sql: string): void; close(): void };\n const guards: InstanceType<typeof Database>[] = [];\n try {\n for (const key of [...new Set(keys)].sort()) {\n const path = join(state, `${key}.lock.sqlite`);\n const metadata = await lstat(path).catch(\n (error: NodeJS.ErrnoException) => {\n if (error.code === \"ENOENT\") return undefined;\n throw error;\n },\n );\n if (metadata && !metadata.isFile())\n throw new CodexSecurityError(\n \"The publication lock is not a regular file.\",\n );\n const guard = new Database(path);\n guards.push(guard);\n if (process.platform !== \"win32\") chmodSync(path, 0o600);\n guard.exec(\"PRAGMA busy_timeout = 0\");\n }\n for (;;) {\n signal?.throwIfAborted();\n let acquired = 0;\n try {\n // SQLite releases these transactions on process exit.\n for (const guard of guards) {\n guard.exec(\"BEGIN EXCLUSIVE\");\n acquired++;\n }\n break;\n } catch (error) {\n const sqliteError = error as { code?: string; errcode?: number };\n if (sqliteError.errcode !== 5 && sqliteError.code !== \"SQLITE_BUSY\")\n throw error;\n // Older SDKs can acquire historical keys in a different order.\n for (const guard of guards.slice(0, acquired)) guard.exec(\"ROLLBACK\");\n await delay(50, undefined, { signal });\n }\n }\n return await operation();\n } finally {\n for (const guard of guards) guard.close();\n }\n}\n\nexport async function prepareExternalPublication(\n path: string,\n options: ExternalPublicationOptions,\n dependencies: ExternalPublicationDependencies = {},\n): Promise<PreparedExternalPublication> {\n requireExternalImports(dependencies.environment);\n const settings = snapshotImportOptions(options);\n const parsed = await readExternalFindings(path, settings);\n return preparePublicationInput(\n parsed.publication ?? normalizedPublicationInput(parsed.findings),\n { ...settings, provider: EXTERNAL_FINDINGS_PROVIDERS[settings.provider] },\n dependencies,\n path,\n );\n}\n\n/** Prepare normalized provider evidence without reading a vendor export. */\nexport async function prepareNormalizedExternalPublication(\n input: ExternalFindings,\n options: NormalizedExternalPublicationOptions,\n dependencies: ExternalPublicationDependencies = {},\n): Promise<PreparedExternalPublication> {\n requireExternalImports(dependencies.environment);\n const settings = snapshotImportOptions(options);\n return preparePublicationInput(\n normalizedPublicationInput(input),\n settings,\n dependencies,\n );\n}\n\ninterface PublicationSelection extends ExternalPublicationInput {\n original?: {\n parsed: ExternalFindings;\n identity: unknown;\n wire: string;\n hasBoxedScalars: boolean;\n };\n\n potentialIds?: (string | undefined)[] | null;\n uncertainFindingIds?: string[];\n unprovenOccurrenceCount?: number;\n knownFindings?: ExternalFindings[\"findings\"];\n unprovenIdPrefixes?: string[];\n freshError?: Error;\n}\n\nfunction ownData(value: unknown, key: string) {\n return isRecord(value) && !isProxy(value)\n ? (Object.getOwnPropertyDescriptor(value, key)?.value as unknown)\n : undefined;\n}\n\n// When native capture would invoke caller code, only the original data\n// properties can identify the earlier selection. Unknown IDs cannot rule it out.\nfunction previousFindingIds(\n input: ExternalFindings,\n): (string | undefined)[] | null {\n const rows = ownData(input, \"findings\");\n if (!Array.isArray(rows) || isProxy(rows)) return null;\n return Array.from({ length: rows.length }, (_, index) => {\n const row: unknown = Object.getOwnPropertyDescriptor(rows, index)?.value;\n const id = ownData(row, \"source_finding_id\");\n return typeof id === \"string\" ? id : undefined;\n });\n}\n\nfunction withDataProperty<T extends object>(\n record: T,\n key: string,\n value: unknown,\n): T {\n const fields = Object.getOwnPropertyDescriptors(record);\n return Object.create(Object.getPrototypeOf(record) as object | null, {\n ...fields,\n [key]: { ...fields[key], value },\n }) as T;\n}\n\n// Native cloning discarded enumerable diagnostic fields. Recover its message\n// without reading the caller's stack getter or changing their report.\nconst nativeDiagnosticPrototypes = new Set<unknown>([\n Error.prototype,\n EvalError.prototype,\n RangeError.prototype,\n ReferenceError.prototype,\n SyntaxError.prototype,\n TypeError.prototype,\n URIError.prototype,\n]);\n\nfunction previousDiagnosticMessage(diagnostic: Error): string | undefined {\n const stack = Object.getOwnPropertyDescriptor(diagnostic, \"stack\");\n const message = ownData(diagnostic, \"message\");\n const cause = Object.getOwnPropertyDescriptor(diagnostic, \"cause\");\n const name = Object.getOwnPropertyDescriptor(diagnostic, \"name\");\n if (\n !nativeDiagnosticPrototypes.has(Object.getPrototypeOf(diagnostic)) ||\n typeof message !== \"string\" ||\n (stack?.get && stack.get !== nativeErrorStackGetter) ||\n (name && typeof name.value !== \"string\") ||\n (cause &&\n (!Object.hasOwn(cause, \"value\") ||\n !canSnapshotWithoutGetters(cause.value)))\n )\n return;\n return message;\n}\n\nfunction previousDiagnosticInput(\n input: ExternalFindings,\n nativeDiagnostics: Map<number, Error>,\n): ExternalFindings {\n const report = ownData(input, \"report\");\n const errors = ownData(report, \"errors\");\n if (!isRecord(report) || !Array.isArray(errors) || isProxy(errors))\n return input;\n let entries: PropertyDescriptorMap | undefined;\n for (let index = 0; index < errors.length; index++) {\n const descriptor = Object.getOwnPropertyDescriptor(errors, index);\n const diagnostic: unknown = descriptor?.value;\n if (!descriptor || !isNativeError(diagnostic)) continue;\n const message = previousDiagnosticMessage(diagnostic);\n if (message === undefined) return input;\n nativeDiagnostics.set(index, diagnostic);\n (entries ??= Object.getOwnPropertyDescriptors(errors as object))[index] = {\n ...descriptor,\n value: { message },\n };\n }\n if (!entries) return input;\n const capturedErrors = Object.defineProperties([], entries) as unknown[];\n const capturedReport = withDataProperty(report, \"errors\", capturedErrors);\n return withDataProperty(input, \"report\", capturedReport);\n}\n\n// Capture before JSON hooks can change their source. If native capture would\n// invoke caller code too, the original bytes cannot be observed independently.\nfunction previousNormalizedFindings(\n input: ExternalFindings,\n nativeDiagnostics: Map<number, Error>,\n observe: (value: object) => void,\n): ExternalFindings | undefined {\n input = previousDiagnosticInput(input, nativeDiagnostics);\n if (!canSnapshotWithoutGetters(input, observe)) return;\n // Object spread skips a hidden report, but explicitly reading it could run a getter.\n const reportField = Object.getOwnPropertyDescriptor(input, \"report\");\n if (reportField && !Object.hasOwn(reportField, \"value\")) return;\n const { report, ...parsed } = input;\n const snapshot: ExternalFindings = structuredClone(parsed);\n if (report !== undefined) snapshot.report = structuredClone(report);\n return snapshot;\n}\n\nfunction publicationIdentity(parsed: ExternalFindings) {\n return parsed.report === undefined\n ? parsed.findings\n : { findings: parsed.findings, report: reportForJson(parsed.report) };\n}\n\nfunction validatePublicationFindings(\n parsed: ExternalFindings,\n validateEvidence: typeof validateExternalEvidence,\n) {\n validateExternalReport(parsed.report);\n const ids = new Set<string>();\n for (const finding of parsed.findings) {\n const id = finding.source_finding_id;\n if (!id.trim() || id.includes(\"\\0\") || Buffer.byteLength(id) > 512)\n throw new CodexSecurityError(\n \"Source finding id must contain 1–512 UTF-8 bytes and no NUL characters.\",\n );\n if (ids.has(id))\n throw new CodexSecurityError(\n `Duplicate source finding id ${JSON.stringify(id)}.`,\n );\n ids.add(id);\n finding.evidence = validateEvidence(finding.evidence);\n }\n}\n\nfunction historicalPublication(\n native: ExternalFindings | undefined,\n): PublicationSelection[\"original\"] {\n if (!native) return;\n try {\n // Older SDKs detached all raw records before Cloud validation added defaults.\n for (const finding of native.findings)\n if (finding.evidence.source_data !== undefined)\n finding.evidence.source_data = structuredClone(\n finding.evidence.source_data,\n );\n validatePublicationFindings(native, validatePreviousCloudEvidence);\n const identity = publicationIdentity(native);\n let hasBoxedScalars = false;\n const wire = canonicalJson(identity, undefined, (value) => {\n if (!isBoxedPrimitive(value)) return false;\n hasBoxedScalars = true;\n return true;\n });\n return { parsed: native, identity, wire, hasBoxedScalars };\n } catch {\n // The caller may export valid JSON even if the native candidate cannot be\n // validated or hashed, for example when an unused row property holds a BigInt.\n return;\n }\n}\n\nfunction normalizedPublicationInput(\n input: ExternalFindings,\n): PublicationSelection {\n const nativeDiagnostics = new Map<number, Error>();\n let native: ExternalFindings | undefined;\n let plainJson = true;\n try {\n native = previousNormalizedFindings(input, nativeDiagnostics, (value) => {\n if (!plainJson) return;\n const prototype = Object.getPrototypeOf(value);\n plainJson =\n (prototype === null ||\n prototype === Object.prototype ||\n prototype === Array.prototype) &&\n !(\"toJSON\" in value);\n });\n } catch {\n /* A valid JSON export can contain an uncloneable value. */\n }\n let priorIds = native ? undefined : previousFindingIds(input);\n let current: ExternalFindings;\n let freshError: Error | undefined;\n try {\n current = snapshotNormalizedFindings(input, undefined, \"cloud\");\n } catch (error) {\n if (\n (!isNativeError(error) && !(error instanceof Error)) ||\n !native?.findings.length\n )\n throw error;\n freshError = error;\n current = { read: native.read, findings: [], excluded: [] };\n }\n if (native && nativeDiagnostics.size) {\n const historical = native.report![\"errors\"] as Error[];\n const exported = current.report?.[\"errors\"];\n for (const [index, source] of nativeDiagnostics) {\n const message = historical[index]!.message;\n let diagnostic: unknown = Array.isArray(exported) && exported[index];\n // A failed export may never reach the report. Its hooks have already run,\n // so check the original descriptors again before native cloning reads a stack.\n if (freshError && previousDiagnosticMessage(source) === message)\n diagnostic = source;\n if (\n isNativeError(diagnostic) &&\n Object.getPrototypeOf(diagnostic) === Object.getPrototypeOf(source)\n ) {\n try {\n const copy = structuredClone(diagnostic);\n if (copy.message === message) {\n historical[index] = copy;\n continue;\n }\n } catch {\n // A failed native clone cannot establish a historical report.\n }\n }\n if (freshError) throw freshError;\n priorIds = previousFindingIds(native);\n native = undefined;\n break;\n }\n }\n // A Cloud depth error can interrupt a local reader's JSON export. Its plain,\n // independently captured output can still verify the original reader selection.\n const readerOutput = freshError\n ? freshError instanceof CloudEvidenceDepthError &&\n plainJson &&\n !nativeDiagnostics.size &&\n native\n : current;\n const reader = readerOutput\n ? previousReaderSelection(input, readerOutput, native ?? null)\n : undefined;\n if (reader) native = reader.snapshot;\n const original = historicalPublication(native);\n try {\n validatePublicationFindings(current, validateExternalEvidence);\n } catch (error) {\n if (!(error instanceof Error) || !original?.parsed.findings.length)\n throw error;\n freshError = error;\n }\n if (freshError) {\n if (!original) throw freshError;\n // Only the old selection can be reviewed when fresh validation failed.\n current = { read: original.parsed.read, findings: [], excluded: [] };\n }\n const identity = publicationIdentity(current);\n return {\n current,\n legacy: current,\n currentIdentity: identity,\n legacyIdentity: identity,\n original,\n freshError,\n unprovenIdPrefixes: reader?.unprovenIdPrefixes,\n uncertainFindingIds: reader?.uncertainFindingIds,\n unprovenOccurrenceCount: reader?.unprovenOccurrenceCount,\n knownFindings: reader?.knownFindings,\n potentialIds:\n reader?.sourceFindingIds ??\n (original\n ? undefined\n : (native?.findings.map((row) => row.source_finding_id) ?? priorIds)),\n };\n}\n\n// The old hash represented Number objects as {}. Unpublished row properties\n// and report metadata cannot be recovered from the immutable saved request.\nfunction verifiableLegacyMetadata(\n { report, findings }: ExternalFindings,\n wireIdentity: boolean,\n): boolean {\n let verifiable = true;\n // Only values in these records can be old scalar projections. Their record\n // containers are required by the normalized selection, including an empty report.\n const { errors, ...metadata } = report ?? {};\n JSON.stringify(\n [\n Object.values(metadata),\n // The original hash used the serialized form of report.errors arrays.\n Array.isArray(errors) ? undefined : errors,\n findings.map(({ evidence: _, ...fields }) => Object.values(fields)),\n ],\n (_key, value: unknown) => {\n if (isRecord(value) && !(wireIdentity && isBoxedPrimitive(value))) {\n // {} and string-index records can both be the old form of a scalar.\n let index = 0;\n if (\n Object.keys(value).every((key) => {\n const item = value[key];\n return (\n item === undefined ||\n (key === String(index++) &&\n typeof item === \"string\" &&\n item.length === 1)\n );\n })\n )\n verifiable = false;\n }\n return value;\n },\n );\n return verifiable;\n}\n\nasync function preparePublicationInput(\n input: PublicationSelection,\n options: NormalizedExternalPublicationOptions,\n dependencies: ExternalPublicationDependencies,\n nativePath?: string,\n): Promise<PreparedExternalPublication> {\n const { inspectorProjectMap } = options;\n const progress = (event: ExternalPublicationProgress): void =>\n notify(() => dependencies.onProgress?.(event));\n if (\n !options.sourceKey.trim() ||\n options.sourceKey.includes(\"\\0\") ||\n Buffer.byteLength(options.sourceKey) > 512\n ) {\n throw new CodexSecurityError(\n \"The source key must contain 1–512 UTF-8 bytes and no NUL characters. Use a stable scanner organization/project/branch namespace across imports.\",\n );\n }\n progress({ phase: \"reading\", completed: 0 });\n let {\n current: parsed,\n legacy: legacyParsed,\n currentIdentity,\n legacyIdentity,\n } = input;\n function noFindings(): never {\n const diagnostics = reportForJson(parsed.report)?.[\"errors\"];\n throw new CodexSecurityError(\n `No supported findings are ready to publish. ${parsed.excluded.map((item) => `Item ${item.position}: ${item.reason}`).join(\" \")}${Array.isArray(diagnostics) && diagnostics.length ? ` Scanner diagnostics: ${JSON.stringify(diagnostics)}` : \"\"}`,\n );\n }\n if (\n !parsed.findings.length &&\n !input.original?.parsed.findings.length &&\n input.potentialIds !== null &&\n !input.potentialIds?.length &&\n !input.uncertainFindingIds?.length &&\n !input.unprovenOccurrenceCount &&\n !input.unprovenIdPrefixes?.length\n )\n noFindings();\n progress({ phase: \"discovering\", completed: 0 });\n const environment = dependencies.environment ?? process.env;\n requireExternalImports(environment);\n const apiBaseUrl = cloudBaseUrl(environment);\n const cloudApiUrl = `${apiBaseUrl}/external`;\n // Validate the configured return destination before authentication or uploads.\n cloudFindingsUrl(environment, options.repository);\n const credentials = await (\n dependencies.credentials ?? (() => readCloudCredentials(environment))\n )();\n let privateProviders: Set<string> | undefined;\n async function request(\n endpoint: string,\n body?: FindingImportRequest,\n ): Promise<unknown> {\n dependencies.signal?.throwIfAborted();\n // Allow upload and response transport around the server's publication budget.\n const timeout = AbortSignal.timeout(body ? 60_000 : 30_000);\n const response = await (dependencies.fetch ?? globalThis.fetch)(\n `${cloudApiUrl}${endpoint}`,\n {\n method: body ? \"POST\" : \"GET\",\n headers: {\n Authorization: `Bearer ${credentials.access_token}`,\n \"ChatGPT-Account-ID\": credentials.account_id,\n Accept: \"application/json\",\n ...(body ? { \"Content-Type\": \"application/json\" } : {}),\n },\n ...(body ? { body: JSON.stringify(body) } : {}),\n redirect: \"error\",\n signal: dependencies.signal\n ? AbortSignal.any([dependencies.signal, timeout])\n : timeout,\n },\n );\n if (!response.ok) {\n const payload = (await response.json().catch(() => null)) as {\n error?: { message?: string };\n } | null;\n const retryAfter = response.headers.get(\"Retry-After\");\n throw new CloudImportError(\n response.status,\n `Cloud import failed (HTTP ${response.status}). ${payload?.error?.message ?? response.statusText}${retryAfter ? ` Retry-After: ${retryAfter}.` : \"\"}`,\n );\n }\n if (endpoint.startsWith(\"/repositories?\")) {\n const advertised = response.headers.get(\n \"Codex-Security-Private-Import-Providers\",\n );\n if (advertised !== null)\n privateProviders = new Set(\n advertised.split(\",\").map((provider) => provider.trim()),\n );\n }\n return response.json();\n }\n const destinations: ImportRepository[] = [];\n let page: string | null = null;\n const seenPages = new Set<string>();\n do {\n const result = validateRepositories(\n await request(\n `/repositories?limit=20&repository=${encodeURIComponent(options.repository)}${page ? `&page=${encodeURIComponent(page)}` : \"\"}`,\n ),\n );\n destinations.push(\n ...result.data.filter(\n (item) =>\n item.id === options.repository ||\n cloudRepositoryUrlKey(item.url) ===\n cloudRepositoryUrlKey(options.repository),\n ),\n );\n page = result.next;\n if (\n result.has_more !== (page !== null) ||\n (page !== null && seenPages.has(page))\n )\n throw new CodexSecurityError(\n \"Cloud returned invalid repository pagination.\",\n );\n if (page !== null) seenPages.add(page);\n } while (page !== null);\n if (destinations.length !== 1)\n throw new CodexSecurityError(\n destinations.length\n ? \"The repository matches multiple connectors. Select an unambiguous Cloud repository.\"\n : \"The destination repository is not available to this Cloud account. Copy its repository URL or ID from Codex Security Cloud and check that you are signed into the intended account.\",\n );\n const destination = destinations[0]!;\n const source = { provider: options.provider, source_key: options.sourceKey };\n const importPrefix = source.provider === \"sonar\" ? \"/v2\" : \"\";\n const sourceReportsPath = importPrefix + sourcePath(destination);\n const state = externalPublicationStateDirectory(environment);\n const checkpointIdentity = [\n // Keep existing production checkpoints readable; other deployments must\n // never share a saved request or receipt with the production default.\n ...(apiBaseUrl === DEFAULT_CLOUD_BASE_URL ? [] : [apiBaseUrl]),\n credentials.account_id,\n destination.id,\n destination.repo_connector_id,\n source,\n ];\n function scopeKey(identity: unknown, serialize = wireJson) {\n return jsonDigest([...checkpointIdentity, identity], serialize);\n }\n function localeKey(rows: ExternalFindings[\"findings\"]) {\n return hash(\n \"sha256\",\n canonicalJson([...checkpointIdentity, rows], (left, right) =>\n left.localeCompare(right),\n ),\n );\n }\n const original = input.original;\n const originalParsed = original?.parsed ?? parsed;\n const originalIdentity = original?.identity ?? currentIdentity;\n const hasBoxedScalars = original?.hasBoxedScalars === true;\n const changedCapture =\n original && original.wire !== wireJson(currentIdentity);\n const originalKey =\n changedCapture || hasBoxedScalars\n ? scopeKey(originalIdentity, canonicalJson)\n : undefined;\n let historicalOnly = false;\n const originalWireKey = changedCapture\n ? scopeKey(originalIdentity)\n : undefined;\n if (changedCapture && originalKey && originalWireKey) {\n // A released SDK could stage either spelling. A modern approval for the\n // fresh JSON can occupy the very same historical filename.\n for (const pathKey of new Set([\n originalKey,\n originalWireKey,\n localeKey(original.parsed.findings),\n ])) {\n const bytes = await readOptionalFile(\n join(state, `${pathKey}.pending.json`),\n );\n if (bytes === undefined) continue;\n const record = JSON.parse(bytes) as SavedSubmission | null;\n if (\n (record?.legacyApproval &&\n (record.wireKey ?? pathKey) === originalWireKey) ||\n (record?.wireKey === undefined &&\n record?.inputProjection?.identityFormat !== 2 &&\n (pathKey === originalKey ||\n pathKey === originalWireKey ||\n original.parsed.report === undefined ||\n record?.inputProjection?.inputDigest ===\n jsonDigest(originalIdentity, canonicalJson)))\n ) {\n parsed = legacyParsed = original.parsed;\n currentIdentity = legacyIdentity = original.identity;\n historicalOnly = true;\n break;\n }\n }\n }\n if (input.freshError && !historicalOnly) throw input.freshError;\n const inputDigest = jsonDigest(currentIdentity);\n const legacyInputDigest =\n currentIdentity === legacyIdentity\n ? inputDigest\n : jsonDigest(legacyIdentity);\n function matchesSavedDestination(requests: FindingImportRequest[]): boolean {\n return (\n requests.length > 0 &&\n requests.every(\n (batch) =>\n batch.repository.id === destination.id &&\n batch.repository.repo_connector_id ===\n destination.repo_connector_id &&\n wireJson(batch.source) === wireJson(source),\n )\n );\n }\n async function retireIfReset(\n content: SavedSubmission,\n retire: () => Promise<void>,\n ) {\n if (\n content.requests.some(\n (batch) => batch.repository.reset_marker !== destination.reset_marker,\n )\n ) {\n await retire();\n throw new CloudImportError(\n 409,\n \"The repository was reset after this submission. The saved request was retired without uploading. Review the destination and run the command again to approve a fresh publication.\",\n );\n }\n }\n function readSaved(\n content: SavedSubmission | null | undefined,\n ): SavedSubmission {\n if (\n !content ||\n content.accountId !== credentials.account_id ||\n !Array.isArray(content.requests) ||\n content.requests.length === 0\n )\n throw new Error(\"Saved import account or requests do not match.\");\n content.requests = content.requests.map(validateImportRequest);\n if (!matchesSavedDestination(content.requests))\n throw new Error(\"Saved import destination does not match.\");\n return content;\n }\n\n function validateSaved(\n record: SavedSubmission | null | undefined,\n legacy = false,\n ): SavedSubmission {\n const content = readSaved(record);\n const saved = submissionFindings(content.requests);\n const wire = wireJson(saved);\n const expected = legacy ? legacyParsed.findings : parsed.findings;\n const projection = content.inputProjection;\n if (\n projection &&\n (!sameFindingSelection(saved, expected) ||\n projection.inputDigest !== (legacy ? legacyInputDigest : inputDigest) ||\n projection.savedEvidenceDigest !== hash(\"sha256\", wire))\n )\n throw new Error(\n \"Saved import evidence does not match the selected input.\",\n );\n // Older file readers can have a different, explicitly bound projection.\n // A corrected numeric checkpoint must carry the selected evidence verbatim.\n const exactWire =\n historicalOnly || hasBoxedScalars || content.wireKey !== undefined;\n if (\n (!projection || exactWire) &&\n wire !== wireJson(exactWire ? expected.map(wireFinding) : expected)\n )\n throw new Error(\n \"Saved import evidence does not match the selected input.\",\n );\n if (\n !legacy &&\n hasBoxedScalars &&\n projection?.identityFormat !== 2 &&\n !verifiableLegacyMetadata(originalParsed, true)\n )\n throw unmatchedPreviousNumbers();\n return content;\n }\n\n // The original filename and digests identify the previous selection, but\n // contained {} for every boxed number. Only its actual saved request can\n // prove which numbers were approved.\n function readPreviousNumbers(\n record: SavedSubmission | null,\n ): SavedSubmission | \"different-wire\" | undefined {\n const content = readSaved(record);\n const projection = content.inputProjection;\n const savedWire = wireJson(submissionFindings(content.requests));\n const wireDigest = hash(\"sha256\", savedWire);\n if (projection?.inputDigest !== jsonDigest(originalIdentity, canonicalJson))\n throw unmatchedPreviousNumbers();\n if (projection.identityFormat === 2) {\n // A current writer may own the old filename for an ordinary object.\n if (projection.savedEvidenceDigest === wireDigest) return undefined;\n throw unmatchedPreviousNumbers();\n }\n const selected = originalParsed.findings.map(wireFinding);\n if (projection.savedEvidenceDigest !== jsonDigest(selected, canonicalJson))\n throw unmatchedPreviousNumbers();\n if (savedWire !== wireJson(selected)) {\n // A genuinely empty object at this key is a separate ordinary selection.\n if (wireDigest === projection.savedEvidenceDigest) return undefined;\n return \"different-wire\";\n }\n if (\n (changedCapture && !historicalOnly) ||\n !verifiableLegacyMetadata(originalParsed, false)\n )\n throw unmatchedPreviousNumbers();\n content.legacyApproval = true;\n content.inputProjection = {\n identityFormat: 2,\n inputDigest,\n savedEvidenceDigest: wireDigest,\n };\n return content;\n }\n function unmatchedPreviousNumbers() {\n return new CodexSecurityError(\n \"The older saved import cannot be matched to the selected input. Its checkpoint was preserved without uploading.\",\n );\n }\n const key = scopeKey(currentIdentity);\n const stagingKey = originalKey ?? key;\n const canonicalPath = join(state, `${key}.pending.json`);\n const lookupPath = join(state, `${key}.lookup.json`);\n // A lookup only suggests a regular file to validate. A missing or stale hint\n // leaves the same on-disk discovery available as before.\n async function readOptionalRegularFile(path: string) {\n try {\n if ((await lstat(path)).isFile()) return await readFile(path, \"utf8\");\n } catch {\n // Optional discovery must not veto an independently verified checkpoint.\n }\n }\n async function lookupFileKey() {\n const serialized = await readOptionalRegularFile(lookupPath);\n return serialized?.trim().match(/^\"([a-f0-9]{64})\"$/u)?.[1];\n }\n\n const historicalKey = localeKey(legacyParsed.findings);\n const legacyIdentityKey = scopeKey(legacyIdentity);\n const legacyKeys = new Set([legacyIdentityKey, historicalKey]);\n function underLocks<T>(keys: string[], operation: () => Promise<T>) {\n return withImportLocks(state, keys, dependencies.signal, operation);\n }\n let recovered: SavedSubmission | undefined;\n for (const legacyKey of legacyKeys) {\n if (legacyKey === key || legacyKey === originalKey) continue;\n const legacyPath = join(state, `${legacyKey}.pending.json`);\n const captured = await readOptionalFile(legacyPath);\n if (captured !== undefined) {\n // Preserve requests staged by the earlier locale-based filename format.\n // Hold both publication locks while moving the original checkpoint.\n await underLocks([key, legacyKey], async () => {\n const current = await readOptionalFile(canonicalPath);\n const serialized = await readOptionalFile(legacyPath);\n let prior: SavedSubmission | undefined | null;\n if (serialized !== undefined) {\n try {\n prior = JSON.parse(serialized) as SavedSubmission | null;\n } catch (error) {\n if (current === undefined || !(error instanceof SyntaxError))\n throw error;\n }\n }\n if (prior?.wireKey !== undefined) return;\n if (current !== undefined) {\n recovered = validateSaved(JSON.parse(current));\n if (prior && sameSubmission(prior, recovered)) await rm(legacyPath);\n return;\n }\n // A report-free approval at the locale-era filename can be a separate input.\n if (\n legacyKey !== legacyIdentityKey &&\n prior?.inputProjection &&\n prior.inputProjection.inputDigest !== legacyInputDigest\n ) {\n const projection = prior.inputProjection;\n const rows = legacyParsed.findings;\n if (\n projection.identityFormat === 2 ||\n (projection.inputDigest === jsonDigest(rows) &&\n projection.savedEvidenceDigest ===\n jsonDigest(submissionFindings(prior.requests)))\n )\n return;\n // The released SDK hashed report-free rows as an array and boxed scores as {}.\n const originalRows = original?.parsed.findings ?? rows;\n if (\n hasBoxedScalars &&\n legacyParsed.report !== undefined &&\n legacyKey === scopeKey(originalRows, canonicalJson) &&\n projection.inputDigest ===\n jsonDigest(originalRows, canonicalJson) &&\n projection.savedEvidenceDigest ===\n jsonDigest(originalRows.map(wireFinding), canonicalJson) &&\n sameFindingSelection(\n submissionFindings(readSaved(prior).requests),\n rows,\n )\n )\n return;\n }\n const content = validateSaved(\n serialized === undefined ? JSON.parse(captured) : prior,\n true,\n );\n if (!sameFindingSelection(legacyParsed.findings, parsed.findings))\n throw new CodexSecurityError(\n \"The saved import selects different findings from this input. Resume the original selection before publishing this selection.\",\n );\n await retireIfReset(content, async () => {\n if (serialized !== undefined) await rm(legacyPath);\n });\n const savedEvidenceDigest =\n content.inputProjection?.savedEvidenceDigest ??\n jsonDigest(legacyParsed.findings);\n const rebindProjection =\n content.inputProjection !== undefined ||\n savedEvidenceDigest !== inputDigest;\n if (rebindProjection) {\n if (content.inputProjection?.identityFormat !== 2)\n content.legacyApproval = true;\n content.inputProjection = {\n ...content.inputProjection,\n identityFormat: 2,\n inputDigest,\n savedEvidenceDigest,\n };\n }\n recovered = content;\n if (serialized === undefined) return;\n if (!rebindProjection) {\n await rename(legacyPath, canonicalPath);\n } else {\n // Bind the new input projection to the original immutable evidence,\n // so later inventory reordering still resumes these exact requests.\n await writeAtomicJson(canonicalPath, content);\n await rm(legacyPath);\n }\n });\n }\n }\n\n interface Checkpoint {\n fileKey: string;\n content: SavedSubmission;\n historical: boolean;\n checkedCanonical?: true;\n }\n // Some getter-backed batches cannot reproduce a released filename. Their IDs\n // can stop a conflicting upload, but never authorize replay of a saved request.\n const potentialIds =\n input.potentialIds === undefined && changedCapture\n ? original.parsed.findings.map((row) => row.source_finding_id)\n : input.potentialIds;\n const unprovenPrefixes = new Set(input.unprovenIdPrefixes);\n const uncertainIds = new Set(input.uncertainFindingIds);\n const uncertainMembership =\n input.unprovenOccurrenceCount ||\n uncertainIds.size > 0 ||\n unprovenPrefixes.size > 0;\n function uncertainId(id: string) {\n return (\n uncertainIds.has(id) ||\n unprovenPrefixes.has(id.replace(/\\/[a-f0-9]{64}$/u, \"/\"))\n );\n }\n const stableIds = uncertainMembership\n ? (\n potentialIds ?? parsed.findings.map((row) => row.source_finding_id)\n ).filter((id) => id === undefined || !uncertainId(id))\n : undefined;\n const knownMembership = input.unprovenOccurrenceCount\n ? new Set(stableIds)\n : undefined;\n const knownRows = new Map(\n input.knownFindings?.map((row) => [\n row.source_finding_id,\n wireFinding(row),\n ]),\n );\n let originalInputDigest: string | undefined;\n const cannotCaptureOriginal =\n !input.original &&\n (potentialIds === null || !!(potentialIds?.length || uncertainMembership));\n const possibleBufferExport =\n options.provider === \"github\" && original && !changedCapture;\n function potentialOriginal(record: SavedSubmission, fileKey: string) {\n const projection = record.inputProjection;\n if (record.accountId !== credentials.account_id) return false;\n if (!projection) {\n // Locale-era requests had no projection. Their scoped occurrence IDs\n // can stop an opaque retry but cannot authorize replay.\n if (!cannotCaptureOriginal || record.wireKey !== undefined) return false;\n } else if (\n !/^[a-f0-9]{64}$/u.test(projection.inputDigest) ||\n !/^[a-f0-9]{64}$/u.test(projection.savedEvidenceDigest) ||\n (projection.identityFormat === 2 && !record.legacyApproval)\n )\n return false;\n try {\n // Older evidence may fail today's limits. Scope and selection can still\n // identify an outstanding approval and prevent a duplicate submission.\n if (!matchesSavedDestination(record.requests)) return false;\n const rows = submissionFindings(record.requests);\n const savedWire = wireJson(rows);\n const evidenceMatches =\n projection &&\n projection.savedEvidenceDigest === hash(\"sha256\", savedWire);\n if (evidenceMatches) {\n // Matching old digests reconstruct its scoped filename. A report from\n // this caller is useful only when the saved digest independently binds it.\n const reportFree =\n projection.inputDigest === projection.savedEvidenceDigest;\n const identity = reportFree\n ? rows\n : parsed.report !== undefined\n ? { findings: rows, report: reportForJson(parsed.report) }\n : undefined;\n if (\n identity &&\n (reportFree || projection.inputDigest === jsonDigest(identity))\n ) {\n if (\n record.wireKey\n ? record.wireKey !== scopeKey(identity)\n : fileKey !== scopeKey(identity, canonicalJson) &&\n fileKey !== localeKey(rows)\n )\n return false;\n if (\n possibleBufferExport &&\n projection.inputDigest !== inputDigest &&\n sameLegacyJson(identity, currentIdentity, previousBufferJson)\n ) {\n return true;\n }\n }\n if (\n !record.wireKey &&\n reportFree &&\n original &&\n original.wire !== savedWire\n )\n return false;\n }\n if (record.wireKey && !cannotCaptureOriginal) return false;\n if (\n projection &&\n original &&\n fileKey !== stagingKey &&\n fileKey !== originalWireKey &&\n projection.inputDigest ===\n (originalInputDigest ??= jsonDigest(\n original.identity,\n canonicalJson,\n )) &&\n fileKey !== localeKey(original.parsed.findings) &&\n projection.savedEvidenceDigest ===\n jsonDigest(\n original.parsed.findings.map(wireFinding),\n canonicalJson,\n ) &&\n savedWire === wireJson(original.parsed.findings.map(wireFinding))\n )\n return false;\n if (stableIds) {\n // An opaque occurrence may have had a different old ID. Compare all\n // definite members and count the remaining IDs without claiming them.\n const certain = rows.filter(\n (row) => !uncertainId(row.source_finding_id),\n );\n const stableSaved = knownMembership\n ? certain.filter((row) => knownMembership.has(row.source_finding_id))\n : certain;\n if (\n certain.length - stableSaved.length >\n (input.unprovenOccurrenceCount ?? 0)\n )\n return false;\n return (\n rows.length > 0 &&\n stableSaved.length === stableIds.length &&\n stableSaved.every((row, i) => {\n const known = knownRows.get(row.source_finding_id);\n return (\n row.source_finding_id === stableIds[i] &&\n (!known || wireJson(row) === wireJson(known))\n );\n })\n );\n }\n const candidates = originalParsed.findings;\n const ids =\n potentialIds === undefined\n ? parsed.findings.map((row) => row.source_finding_id)\n : potentialIds;\n if (\n ids &&\n (!ids.length ||\n rows.length !== ids.length ||\n !rows.every(\n (row, i) =>\n ids[i] === undefined || row.source_finding_id === ids[i],\n ))\n )\n return false;\n // An opaque serializer can add a report or replace every visible field.\n // Only scoped, independently known occurrences can rule out its old request.\n if (cannotCaptureOriginal || !projection) return true;\n if (\n projection.inputDigest === projection.savedEvidenceDigest &&\n parsed.report !== undefined\n )\n return false;\n if (potentialIds === undefined && (hasBoxedScalars || evidenceMatches))\n return false;\n return (\n !sameFindingSelection(rows, candidates) ||\n rows.every((row, i) => {\n const { source_data: savedData, ...savedFields } = row.evidence;\n const { source_data: selectedData, ...selectedFields } =\n candidates[i]!.evidence;\n if (wireJson(savedFields) !== wireJson(selectedFields)) return false;\n // Once the original SDK discarded boxed positions, a plain JSON export\n // alone cannot attribute a new numeric spelling to that saved request.\n return sameLegacyJson(\n savedData,\n selectedData,\n (value) => typeof value === \"number\",\n );\n })\n );\n } catch {\n return false;\n }\n }\n async function selectedCheckpoint(knownFileKey?: string, preparing = false) {\n const directory = await validatePreparedOutputDir(\n state,\n undefined,\n true,\n ).catch((error: NodeJS.ErrnoException) => {\n if (error.code === \"ENOENT\") return undefined;\n throw error;\n });\n if (!directory) return undefined;\n const known = new Set(\n [key, originalKey, knownFileKey].filter((value) => value !== undefined),\n );\n let unidentified = false;\n let unprovenOriginal = false;\n let incomplete = false;\n let stagingPathOccupied = false;\n async function readCandidate(\n fileKey: string,\n selected?: Checkpoint,\n contents?: string,\n ): Promise<Checkpoint | undefined> {\n const path = join(state, `${fileKey}.pending.json`);\n const serialized =\n contents ??\n (selected?.fileKey === key && !known.has(fileKey)\n ? await readOptionalRegularFile(path)\n : await readOptionalFile(path));\n if (serialized === undefined) {\n if (!known.has(fileKey)) incomplete = true;\n return selected;\n }\n if (fileKey === stagingKey) stagingPathOccupied = true;\n let record: SavedSubmission | null;\n try {\n record = JSON.parse(serialized) as SavedSubmission | null;\n } catch (error) {\n if (known.has(fileKey)) throw error;\n incomplete = true;\n return selected;\n }\n // A migrated checkpoint records the wire identity it belongs to even\n // when a separate input hashes to its historical filename.\n const tag = record?.wireKey;\n const tagged = tag !== undefined;\n const ownerKey = tagged ? tag : fileKey;\n const historical = !tagged && fileKey === originalKey && fileKey !== key;\n if (ownerKey !== key && !historical) {\n if (\n record &&\n (!tagged || cannotCaptureOriginal || possibleBufferExport) &&\n potentialOriginal(record, fileKey)\n )\n unprovenOriginal = true;\n // Some early locale filenames carry no deployment identity. Never guess their target.\n if (\n !tagged &&\n record &&\n !record.inputProjection &&\n !legacyKeys.has(fileKey)\n ) {\n try {\n // A different locale cannot authorize replay, even when the\n // original native capture proves these rows were selected.\n if (\n !original ||\n wireJson(submissionFindings(readSaved(record).requests)) !==\n wireJson(original.parsed.findings.map(wireFinding))\n )\n validateSaved(record, true);\n unidentified = true;\n } catch {\n /* Unrelated input. */\n }\n }\n return selected;\n }\n const content = historical\n ? readPreviousNumbers(record)\n : validateSaved(record);\n if (content === \"different-wire\") {\n // Another spelling may already have a verified checkpoint for this wire value.\n unprovenOriginal = true;\n return selected;\n }\n if (!content) return selected;\n if (selected) {\n const conflict = new CodexSecurityError(\n \"Two saved imports match this input. Their original requests and receipts were preserved without uploading.\",\n );\n if (!preparing) throw conflict;\n // The two unlocked reads may have straddled completion of the first request.\n return await underLocks([key, selected.fileKey, fileKey], async () => {\n const first = await readCandidate(selected.fileKey);\n if (first) {\n if (await readCandidate(fileKey)) throw conflict;\n if (sameSubmission(first.content, selected.content)) return first;\n }\n return completedCheckpoint(selected);\n });\n }\n return { fileKey, content, historical };\n }\n let selected: Checkpoint | undefined;\n for (const fileKey of known)\n selected = await readCandidate(fileKey, selected);\n // A known file that disappeared can be checked against its completed receipt.\n if (!selected && knownFileKey !== undefined) return undefined;\n const hint = await lookupFileKey();\n if (hint && !known.has(hint)) {\n const contents = await readOptionalRegularFile(\n join(state, `${hint}.pending.json`),\n );\n if (contents !== undefined) {\n selected = await readCandidate(hint, selected, contents);\n known.add(hint);\n }\n }\n // A released publisher could stage the canonical request while another SDK\n // tagged its old filename but had not yet written the optional lookup.\n if (\n selected &&\n !cannotCaptureOriginal &&\n !selected.historical &&\n (selected.fileKey !== key ||\n selected.content.canonicalChecked ||\n selected.content.inputProjection?.identityFormat === 2)\n )\n return selected;\n const entries = await readdir(state, { withFileTypes: true }).catch(\n (error: NodeJS.ErrnoException) => {\n if (error.code === \"ENOENT\") return [];\n throw error;\n },\n );\n for (const entry of entries) {\n if (!entry.isFile() || !/^[a-f0-9]{64}\\.pending\\.json$/u.test(entry.name))\n continue;\n const fileKey = entry.name.slice(0, -\".pending.json\".length);\n if (!known.has(fileKey))\n selected = await readCandidate(fileKey, selected);\n }\n if (unprovenOriginal && (!selected || cannotCaptureOriginal))\n throw unmatchedPreviousNumbers();\n if (!selected && stagingPathOccupied) throw occupiedCheckpoint();\n if (!selected && unidentified)\n throw new CodexSecurityError(\n \"An older pending import matches this input, but its checkpoint identity could not be established. Resume it using the original deployment and locale before publishing this selection. The saved request was preserved without uploading.\",\n );\n if (selected?.fileKey === key && !preparing && !incomplete)\n selected.checkedCanonical = true;\n return selected;\n }\n async function readCompletedPublication(\n requests: FindingImportRequest[],\n observedKey: string,\n ) {\n for (const resultKey of new Set([key, observedKey])) {\n const serialized = await readOptionalFile(\n join(state, `${resultKey}.result.json`),\n );\n if (serialized === undefined) continue;\n const completed = JSON.parse(\n serialized,\n ) as ExternalPublicationResult | null;\n if (\n (completed?.status === \"complete\" || completed?.status === \"partial\") &&\n Array.isArray(completed.receipts) &&\n completed.receipts.length === requests.length &&\n completed.receipts.every(\n (receipt, i) => receipt?.id === requests[i]!.request_id,\n )\n )\n return {\n receipts: completed.receipts.map((receipt, i) =>\n validatePublicationReceipt(receipt, requests[i]!),\n ),\n verified: completed.verified,\n };\n }\n }\n async function completedCheckpoint(observed: Checkpoint) {\n if (\n await readCompletedPublication(\n observed.content.requests,\n observed.fileKey,\n )\n )\n return observed;\n throw new CodexSecurityError(\n \"The saved publication changed while preparing this input. Review it again.\",\n );\n }\n function occupiedCheckpoint() {\n return new CodexSecurityError(\n \"Finish the other pending import at this checkpoint first, then review this input again.\",\n );\n }\n let selected = await selectedCheckpoint(recovered ? key : undefined, true);\n const fileKey = selected?.fileKey ?? (recovered ? key : stagingKey);\n const pendingPath = join(state, `${fileKey}.pending.json`);\n async function rememberFile() {\n if (fileKey !== key && (await lookupFileKey()) !== fileKey)\n await writeAtomicJson(lookupPath, fileKey).catch(() => undefined);\n }\n async function removePending() {\n await rm(pendingPath, { force: true });\n if (fileKey !== key && (await lookupFileKey()) === fileKey)\n await rm(lookupPath, { force: true }).catch(() => undefined);\n }\n\n const lockKeys = [key, fileKey, stagingKey];\n if (selected?.historical) {\n const observed = selected;\n selected = await underLocks(lockKeys, async () => {\n const current = await selectedCheckpoint(fileKey);\n if (\n !current ||\n current.fileKey !== fileKey ||\n !sameSubmission(current.content, observed.content)\n )\n return completedCheckpoint(observed);\n if (current.historical) {\n current.content.wireKey = key;\n await writeAtomicJson(pendingPath, current.content);\n await rememberFile();\n }\n return current;\n });\n }\n const saved = selected?.content ?? recovered;\n if (historicalOnly && !saved) throw unmatchedPreviousNumbers();\n if (!parsed.findings.length) noFindings();\n if (saved) {\n await retireIfReset(saved, () =>\n underLocks(lockKeys, async () => {\n const current = await readOptionalFile(pendingPath);\n if (\n current !== undefined &&\n sameSubmission(JSON.parse(current) as SavedSubmission, saved)\n )\n await removePending();\n }),\n );\n }\n if (saved?.inspectorProjectMapRequired && !inspectorProjectMap)\n throw new CodexSecurityError(\n \"Supply the verified Inspector project binding again to resume.\",\n );\n\n function checkRepositories(\n findings: ExternalFindings[\"findings\"],\n report?: ExternalFindings[\"report\"],\n ) {\n function requireDestination(id: string, url: string | null | undefined) {\n if (\n url &&\n cloudRepositoryUrlKey(url) !== cloudRepositoryUrlKey(destination.url)\n )\n throw new CodexSecurityError(\n `Finding ${JSON.stringify(id)} belongs to ${JSON.stringify(url)}, which does not match the selected Cloud repository ${JSON.stringify(destination.url)}. Verify the source repository mapping before publishing.`,\n );\n }\n // Historical checkpoints already fixed the provider and request bytes.\n // Recheck any projected source against the destination discovered for this retry.\n const replay = saved && options.provider !== \"blackduck\";\n if (!saved || options.provider === \"sonar\") {\n for (const url of sonarRepositoryUrls(\n options.provider,\n findings,\n report,\n \"cloud\",\n ))\n requireDestination(\"Sonar source\", url);\n }\n const repositories = replay\n ? undefined\n : blackDuckReportRepositories(options.provider, findings, \"cloud\");\n for (const [provider, repositories] of [\n [\"veracode\", veracodeReportRepositories],\n [\"continuum\", continuumReportRepositories],\n ] as const) {\n if (saved && options.provider !== provider) continue;\n for (const [id, source] of repositories(\n options.provider,\n findings,\n \"cloud\",\n ))\n requireDestination(id, source.url);\n }\n if (\n !replay ||\n options.provider === \"inspector\" ||\n options.provider === \"veracode\"\n ) {\n const binding = inspectorReportRepository(\n options.provider,\n findings,\n \"cloud\",\n inspectorProjectMap,\n );\n if (binding) requireDestination(binding.findingId, binding.url);\n }\n for (const finding of findings) {\n const { source_finding_id: id, evidence } = finding;\n const projected = repositories\n ? repositories.get(id)?.url\n : projectedBlackDuckRepositoryUrl(finding, \"cloud\");\n if (\n replay &&\n !projected &&\n options.provider !== \"inspector\" &&\n options.provider !== \"veracode\" &&\n options.provider !== \"continuum\" &&\n options.provider !== \"sonar\"\n )\n continue;\n const urls = [\n projected,\n evidence.details?.repository?.url,\n options.provider === \"wiz\"\n ? projected\n ? wizFindingRepository(evidence, \"cloud\")?.url\n : wizCsvRepositoryUrl(evidence)\n : undefined,\n ...(options.provider === \"snyk\"\n ? snykRepositoryUrls(evidence.source_data, {\n cloudRepositoryUrl: destination.url,\n })\n : []),\n ...(options.provider === \"endor\"\n ? endorRepositoryUrls(evidence.source_data)\n : []),\n options.provider === \"github\"\n ? dependabotRepository(finding)\n : undefined,\n ];\n for (const url of urls) requireDestination(id, url);\n }\n }\n checkRepositories(parsed.findings, parsed.report);\n // A retry sends its saved projection, which may differ from today's reader.\n if (saved) {\n // A common Sonar ref can supply missing row refs. Only use the report\n // associated with the input digest in the saved checkpoint.\n const report =\n saved.inputProjection?.inputDigest === inputDigest\n ? parsed.report\n : undefined;\n checkRepositories(submissionFindings(saved.requests), report);\n }\n\n // Existing repository submissions keep their original request bodies and receipts.\n const privatePath = join(state, `${key}.private-import.json`);\n const privateSaved = await readOptionalFile(privatePath);\n if (\n !saved &&\n (privateProviders?.has(source.provider) || privateSaved !== undefined)\n ) {\n const client = privateImportClient(\n apiBaseUrl,\n credentials,\n dependencies.fetch ?? globalThis.fetch,\n dependencies.signal,\n );\n const context = await client.context();\n if (source.source_key.trim() !== source.source_key)\n throw new CodexSecurityError(\n \"A private source key cannot have leading or trailing whitespace.\",\n );\n const report = await selectPrivateReport(\n parsed,\n source.provider,\n nativePath,\n context,\n privateSaved,\n );\n const binding = {\n format: report.format,\n apiBaseUrl,\n accountId: credentials.account_id,\n source,\n repository: {\n id: destination.id,\n repo_connector_id: destination.repo_connector_id,\n },\n sha256: report.digest,\n contextVersion: context.context_version,\n };\n function checkpointForContext(data: string | undefined) {\n return data === undefined\n ? undefined\n : readPrivateCheckpoint(data, binding);\n }\n const previous = checkpointForContext(privateSaved);\n function requireAccess(\n value: typeof context,\n savedFile: boolean,\n savedJob: boolean,\n ) {\n if (\n !value.can_read ||\n (!savedJob &&\n ((!savedFile && !value.can_upload) ||\n !value.can_create_import_jobs ||\n !value.formats.includes(report.format)))\n )\n throw new CodexSecurityError(\n \"Private findings import is unavailable for this account or report format.\",\n );\n }\n requireAccess(context, !!previous?.fileId, !!previous?.jobId);\n const retryOfJobId =\n unsuccessfulJob(previous?.receipt) &&\n context.can_upload &&\n context.can_create_import_jobs &&\n context.formats.includes(report.format)\n ? previous?.jobId\n : undefined;\n const privateImport = {\n format: report.format,\n contextVersion: binding.contextVersion,\n sha256: report.digest,\n bytes: Buffer.byteLength(report.bytes),\n ...(retryOfJobId ? { retryOfJobId } : {}),\n };\n const preview: ExternalPublicationPreview = {\n ...parsed,\n cloudApiUrl: `${apiBaseUrl}/finding-imports`,\n accountId: credentials.account_id,\n destination,\n source,\n resumed: previous !== undefined && !retryOfJobId,\n requests: [],\n privateImport,\n };\n return {\n preview: structuredClone(preview),\n publish: () =>\n underLocks(lockKeys, async () => {\n const current = await client.context();\n if (current.context_version !== binding.contextVersion)\n throw new CodexSecurityError(\n \"The private inbox changed. Run the command again to review the new destination.\",\n );\n const stored = checkpointForContext(\n await readOptionalFile(privatePath),\n );\n // Only a preview of this terminal job can start a new attempt.\n const retrying =\n retryOfJobId !== undefined && stored?.receipt?.id === retryOfJobId;\n const active = retrying ? undefined : stored;\n requireAccess(current, !!active?.fileId, !!active?.jobId);\n if (await selectedCheckpoint())\n throw new CodexSecurityError(\n \"A repository submission is pending. Review its saved request before continuing.\",\n );\n const checkpoint = active ?? {\n ...binding,\n uploadRequestId: randomUUID(),\n jobRequestId: randomUUID(),\n fileId: undefined,\n jobId: undefined,\n receipt: undefined,\n previousReceipt: retrying ? stored?.receipt : undefined,\n };\n const result: ExternalPublicationResult = {\n cloudApiUrl: preview.cloudApiUrl,\n status: \"interrupted\",\n read: parsed.read,\n ready: parsed.findings.length,\n report: parsed.report,\n excluded: parsed.excluded,\n receipts: [],\n counts: { created: 0, updated: 0, unchanged: 0, error: 0 },\n failures: [],\n unacknowledged: parsed.findings.length,\n verified: 0,\n };\n function acknowledge(job: PrivateImportJob) {\n const { created, updated, unchanged, error } = job.counts;\n const processed = created + updated + unchanged + error;\n if (\n job.counts.discovered !== processed + job.counts.unprocessed ||\n job.counts.discovered > result.ready ||\n (job.status === \"completed\" &&\n (processed !== result.ready ||\n job.counts.total !== result.ready))\n )\n throw new CodexSecurityError(\n \"Cloud returned counts that do not match the selected report.\",\n );\n result.privateJob = job;\n result.counts = { created, updated, unchanged, error };\n result.unacknowledged = result.ready - processed;\n result.status =\n job.status === \"completed\" && !error && !parsed.excluded.length\n ? \"complete\"\n : \"partial\";\n if (job.error) result.error = job.error.message;\n else delete result.error;\n }\n try {\n const savedReceipt =\n checkpoint.receipt ?? checkpoint.previousReceipt;\n if (savedReceipt) acknowledge(savedReceipt);\n if (!active) await writeAtomicJson(privatePath, checkpoint);\n if (!checkpoint.fileId) {\n progress({ phase: \"uploading\", completed: 0 });\n checkpoint.fileId = await client.upload({\n requestId: checkpoint.uploadRequestId,\n contextVersion: binding.contextVersion,\n ...report,\n recovering: active !== undefined,\n });\n await writeAtomicJson(privatePath, checkpoint);\n }\n progress({ phase: \"verifying\", completed: 0 });\n const job = await client.job(\n {\n requestId: checkpoint.jobRequestId,\n contextVersion: binding.contextVersion,\n fileId: checkpoint.fileId,\n format: report.format,\n source,\n repository: binding.repository,\n jobId: checkpoint.jobId,\n },\n async (id) => {\n checkpoint.jobId = id;\n await writeAtomicJson(privatePath, checkpoint);\n },\n );\n acknowledge(job);\n checkpoint.jobId = job.id;\n checkpoint.receipt = job;\n await writeAtomicJson(privatePath, checkpoint);\n return result;\n } catch (error) {\n result.status = \"interrupted\";\n result.error =\n error instanceof Error ? error.message : String(error);\n result.savedSubmission = privatePath;\n throw new ExternalPublicationError(result.error, result, error);\n }\n }),\n };\n }\n\n let requests = saved?.requests;\n if (!requests) {\n let preparedCount = 0;\n progress({\n phase: \"preparing\",\n completed: 0,\n total: parsed.findings.length,\n });\n const previousReports = await readInBatches(\n parsed.findings,\n async (finding): Promise<SourceReportSummary | undefined> => {\n const query = new URLSearchParams({\n provider: source.provider,\n source_key: source.source_key,\n source_finding_id: finding.source_finding_id,\n limit: \"2\",\n });\n const summaries = validateSourceReports(\n await request(`${sourceReportsPath}?${query}`),\n );\n if (summaries.has_more || summaries.data.length > 1)\n throw new CodexSecurityError(\n \"Cloud returned more than one report for a source identity.\",\n );\n const previous = summaries.data[0];\n if (\n previous &&\n (previous.source_finding_id !== finding.source_finding_id ||\n previous.source.provider !== source.provider ||\n previous.source.source_key !== source.source_key ||\n previous.repo_id !== destination.id ||\n previous.repo_connector_id !== destination.repo_connector_id)\n )\n throw new CodexSecurityError(\n \"Cloud returned a different source identity.\",\n );\n progress({\n phase: \"preparing\",\n completed: ++preparedCount,\n total: parsed.findings.length,\n });\n return previous;\n },\n );\n requests = [];\n let current: FindingImportRequest | undefined;\n let currentBytes = 0;\n for (const [index, finding] of parsed.findings.entries()) {\n const previous = previousReports[index];\n const environmentId =\n previous?.environment_id ?? destination.import_environment_id;\n if (environmentId == null)\n throw new CodexSecurityError(\n \"Configure an authorized Cloud environment for this repository before importing findings.\",\n );\n const item = {\n client_id: `item-${index + 1}`,\n source_finding_id: finding.source_finding_id,\n expected_version: previous?.version ?? 0,\n evidence: finding.evidence,\n };\n const itemBytes = Buffer.byteLength(JSON.stringify(item));\n if (\n current &&\n (current.repository.environment_id !== environmentId ||\n current.items.length === 100 ||\n currentBytes + 1 + itemBytes > MAX_REQUEST_BYTES)\n ) {\n requests.push(validateImportRequest(current));\n current = undefined;\n }\n if (!current) {\n current = {\n request_id: randomUUID(),\n repository: {\n id: destination.id,\n repo_connector_id: destination.repo_connector_id,\n environment_id: environmentId,\n reset_marker: destination.reset_marker,\n },\n source,\n items: [],\n };\n currentBytes = Buffer.byteLength(JSON.stringify(current));\n } else {\n currentBytes++;\n }\n current.items.push(item);\n currentBytes += itemBytes;\n }\n if (current) requests.push(validateImportRequest(current));\n }\n const submission: SavedSubmission = {\n accountId: credentials.account_id,\n requests,\n receipts: saved?.receipts,\n legacyApproval: saved?.legacyApproval,\n wireKey: saved?.wireKey ?? (fileKey === key ? undefined : key),\n inputProjection: saved?.inputProjection ?? {\n identityFormat: saved ? undefined : 2,\n inputDigest,\n savedEvidenceDigest: jsonDigest(submissionFindings(requests)),\n },\n };\n if (inspectorProjectMap) submission.inspectorProjectMapRequired = true;\n const preview: ExternalPublicationPreview = {\n ...parsed,\n findings: submissionFindings(requests),\n cloudApiUrl,\n cloudUrl: cloudFindingsUrl(environment, destination.id),\n accountId: credentials.account_id,\n destination,\n source,\n resumed: saved !== undefined,\n requests,\n };\n return {\n preview: cloneImportPreview(preview),\n async publish() {\n progress({ phase: \"waiting\", completed: 0 });\n const result = (\n acknowledged: FindingImportReceipt[],\n verified: number,\n ): ExternalPublicationResult => {\n const counts = { created: 0, updated: 0, unchanged: 0, error: 0 };\n const failures: ExternalPublicationResult[\"failures\"] = [];\n for (const [index, receipt] of acknowledged.entries()) {\n for (const outcome of Object.keys(counts) as (keyof typeof counts)[])\n counts[outcome] += receipt.counts[outcome] ?? 0;\n const ids = new Map(\n requests[index]!.items.map((item) => [\n item.client_id,\n item.source_finding_id,\n ]),\n );\n for (const item of receipt.results)\n if (item.error)\n failures.push({\n source_finding_id: ids.get(item.client_id)!,\n ...item.error,\n });\n }\n return {\n cloudApiUrl,\n cloudUrl: preview.cloudUrl,\n status:\n parsed.excluded.length || counts.error ? \"partial\" : \"complete\",\n read: parsed.read,\n ...(parsed.report === undefined\n ? {}\n : snapshotNormalizedFindings({ report: parsed.report })),\n ready: parsed.findings.length,\n excluded: parsed.excluded,\n receipts: acknowledged,\n counts,\n failures,\n unacknowledged:\n parsed.findings.length -\n Object.values(counts).reduce((sum, count) => sum + count, 0),\n verified,\n };\n };\n function interruptedPreview(\n message: string,\n cause?: unknown,\n savedSubmission?: string,\n ) {\n // The expected file is gone or another publisher owns the lock. Use only\n // the acknowledgements this caller saw when it prepared the request.\n const known = submission.receipts ?? [];\n if (known.length > submission.requests.length)\n throw new CodexSecurityError(\n \"Saved publication has more receipts than requests.\",\n );\n const acknowledged = known.map((receipt, index) =>\n validatePublicationReceipt(receipt, submission.requests[index]!),\n );\n return new ExternalPublicationError(\n message,\n {\n ...result(acknowledged, 0),\n status: \"interrupted\",\n error: message,\n ...(savedSubmission === undefined ? {} : { savedSubmission }),\n },\n cause,\n );\n }\n let acquired = false;\n return await underLocks(lockKeys, async () => {\n acquired = true;\n // Re-read under the lock to keep checkpoints from another publisher.\n const selected = await selectedCheckpoint(\n saved ? fileKey : undefined,\n ).catch((error: unknown) => {\n if (!submission.receipts?.length) throw error;\n throw interruptedPreview(errorMessage(error), error);\n });\n const pending = selected?.content;\n const current = pending ?? submission;\n const adoptProjectMap =\n submission.inspectorProjectMapRequired &&\n current.inspectorProjectMapRequired === undefined;\n if (adoptProjectMap) current.inspectorProjectMapRequired = true;\n if (\n !selected ||\n selected.fileKey !== fileKey ||\n selected.historical ||\n !sameSubmission(current, submission)\n ) {\n const message = selected\n ? \"Another publication prepared this input. Run the command again to review and resume that saved request.\"\n : \"The saved publication changed after preview. Review its result before publishing again.\";\n if (saved) {\n const completed = await readCompletedPublication(requests, fileKey);\n if (completed)\n return result(completed.receipts, completed.verified);\n throw interruptedPreview(message);\n }\n if (selected) throw new CodexSecurityError(message);\n if ((await readOptionalFile(privatePath)) !== undefined)\n throw new CodexSecurityError(\n \"A private import already owns this selection. Review its saved job before continuing.\",\n );\n if ((await readOptionalFile(pendingPath)) !== undefined)\n throw occupiedCheckpoint();\n }\n const receipts = (current.receipts ?? []).map(validateImportReceipt);\n if (receipts.length > requests.length)\n throw new CodexSecurityError(\n \"Saved publication has more receipts than requests.\",\n );\n const acknowledged: FindingImportReceipt[] = [];\n let verified = 0;\n let persisted = pending !== undefined;\n try {\n if (selected?.checkedCanonical) current.canonicalChecked = true;\n if (pending === undefined || adoptProjectMap) {\n await writeAtomicJson(pendingPath, current);\n persisted = true;\n } else if (selected?.checkedCanonical) {\n // The existing approval and receipts are usable if caching the scan fails.\n await writeAtomicJson(pendingPath, current).catch(() => undefined);\n }\n await rememberFile();\n progress({\n phase: \"uploading\",\n completed: 0,\n total: parsed.findings.length,\n });\n let acknowledgedCount = 0;\n for (const [batchIndex, batch] of requests.entries()) {\n const receipt = validatePublicationReceipt(\n receipts[batchIndex] ??\n (await request(`${importPrefix}/finding_imports`, batch)),\n batch,\n );\n acknowledged.push(receipt);\n acknowledgedCount += receipt.item_count;\n progress({\n phase: \"uploading\",\n completed: acknowledgedCount,\n total: parsed.findings.length,\n });\n if (batchIndex === receipts.length) {\n receipts.push(receipt);\n // Acknowledged batches must not consume another POST quota on retry.\n // Readback can still resume after this checkpoint without replaying writes.\n await writeAtomicJson(pendingPath, {\n ...submission,\n canonicalChecked: current.canonicalChecked,\n receipts,\n });\n }\n }\n // Verify readable source records without mistaking a newer concurrent\n // observation for failure of the original, immutable import receipt.\n const readbacks = receipts.flatMap((receipt, batchIndex) => {\n const batch = requests[batchIndex]!;\n const batchItems = new Map(\n batch.items.map((item) => [item.client_id, item]),\n );\n return receipt.results\n .filter((item) => item.outcome !== \"error\")\n .map((item) => ({\n item,\n expected: batchItems.get(item.client_id)!,\n batch,\n }));\n });\n progress({\n phase: \"verifying\",\n completed: 0,\n total: readbacks.length,\n });\n await readInBatches(readbacks, async ({ item, expected, batch }) => {\n const report = validateSourceReport(\n await request(\n `${sourceReportsPath}/${encodeURIComponent(item.source_report_id!)}`,\n ),\n );\n if (\n report.id !== item.source_report_id ||\n report.canonical_finding_id !== item.canonical_finding_id ||\n report.version < item.version! ||\n (report.version === item.version &&\n (report.observation_id !== item.observation_id ||\n wireJson(report.evidence) !== wireJson(expected.evidence))) ||\n report.source_finding_id !== expected.source_finding_id ||\n report.repo_id !== destination.id ||\n report.repo_connector_id !== destination.repo_connector_id ||\n report.environment_id !== batch.repository.environment_id ||\n wireJson(report.source) !== wireJson(source)\n )\n throw new CodexSecurityError(\n \"Cloud readback did not match the saved finding identity.\",\n );\n progress({\n phase: \"verifying\",\n completed: ++verified,\n total: readbacks.length,\n });\n });\n const completed = result(acknowledged, verified);\n await writeAtomicJson(join(state, `${key}.result.json`), {\n ...completed,\n report: reportForJson(completed.report),\n });\n await removePending();\n return completed;\n } catch (error) {\n if (error instanceof CloudImportError && error.status === 409) {\n await removePending();\n persisted = false;\n }\n const message = `${error instanceof Error ? error.message : String(error)} ${error instanceof CloudImportError && error.status === 409 ? \"The old submission was retired. Rediscover and approve a fresh publication.\" : persisted ? `Repeat the same command to resume the saved request. Saved submission: ${pendingPath}` : \"No resumable request was saved. Correct the error and review the input before retrying.\"}`;\n throw new ExternalPublicationError(\n message,\n {\n ...result(acknowledged, verified),\n status: \"interrupted\",\n error: message,\n ...(persisted ? { savedSubmission: pendingPath } : {}),\n },\n error,\n );\n }\n }).catch((error: unknown) => {\n if (acquired || !dependencies.signal?.aborted) throw error;\n const message = saved\n ? `Publication canceled while waiting. Repeat the same command to resume the saved request. Saved submission: ${pendingPath}`\n : \"Publication canceled while waiting. No resumable request was saved by this invocation.\";\n throw interruptedPreview(\n message,\n error,\n saved ? pendingPath : undefined,\n );\n });\n },\n };\n}\n"]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ExternalFinding, ExternalSourceRepository } from "./external-findings.js";
|
|
2
|
+
import type { Provider } from "./external-import-models.js";
|
|
1
3
|
/** File reader names mapped to their stored and Cloud source provider. */
|
|
2
4
|
export declare const EXTERNAL_FINDINGS_PROVIDERS: {
|
|
3
5
|
readonly wiz: "wiz";
|
|
@@ -6,6 +8,11 @@ export declare const EXTERNAL_FINDINGS_PROVIDERS: {
|
|
|
6
8
|
readonly opengrep: "semgrep";
|
|
7
9
|
readonly endor: "endor";
|
|
8
10
|
readonly github: "github";
|
|
11
|
+
readonly inspector: "inspector";
|
|
12
|
+
readonly blackduck: "blackduck";
|
|
13
|
+
readonly veracode: "veracode";
|
|
14
|
+
readonly sonar: "sonar";
|
|
15
|
+
readonly continuum: "continuum";
|
|
9
16
|
};
|
|
10
17
|
export type ExternalFindingsReader = keyof typeof EXTERNAL_FINDINGS_PROVIDERS;
|
|
11
18
|
export declare const EXTERNAL_FINDINGS_READERS: ExternalFindingsReader[];
|
|
@@ -13,5 +20,8 @@ export declare const EXTERNAL_FINDINGS_READERS: ExternalFindingsReader[];
|
|
|
13
20
|
export interface ExternalFindingsReaderOptions {
|
|
14
21
|
provider: ExternalFindingsReader;
|
|
15
22
|
sourceRepositoryUrl?: string;
|
|
23
|
+
inspectorProjectMap?: ReadonlyMap<string, string>;
|
|
16
24
|
}
|
|
25
|
+
/** Repository references retained by a provider's individual finding. */
|
|
26
|
+
export declare function localFindingRepositories(provider: Provider, finding: ExternalFinding): ExternalSourceRepository[];
|
|
17
27
|
//# sourceMappingURL=external-findings-read.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-findings-read.d.ts","sourceRoot":"","sources":["../src/external-findings-read.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"external-findings-read.d.ts","sourceRoot":"","sources":["../src/external-findings-read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAGf,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAoB5D,0EAA0E;AAC1E,eAAO,MAAM,2BAA2B;kBACjC,KAAK;mBACJ,MAAM;sBACH,SAAS;uBAER,SAAS;oBACZ,OAAO;qBACN,QAAQ;wBACL,WAAW;wBACX,WAAW;uBACZ,UAAU;oBACb,OAAO;wBACH,WAAW;CACqB,CAAC;AAE9C,MAAM,MAAM,sBAAsB,GAAG,MAAM,OAAO,2BAA2B,CAAC;AAE9E,eAAO,MAAM,yBAAyB,EAEjC,sBAAsB,EAAE,CAAC;AAE9B,6EAA6E;AAC7E,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,EAAE,sBAAsB,CAAC;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnD;AAUD,yEAAyE;AACzE,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,eAAe,GACvB,wBAAwB,EAAE,CAiB5B"}
|