@openai/codex-security 0.8.3 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -746
- package/_bundled_plugin/.codex-plugin/plugin.json +2 -0
- package/_bundled_plugin/.mcp.json +7 -1
- package/_bundled_plugin/examples/completed-scan/findings.json +16 -4
- package/_bundled_plugin/examples/completed-scan/report.md +11 -8
- package/_bundled_plugin/examples/completed-scan/scan-manifest.json +4 -2
- package/_bundled_plugin/mcp/fzstd-LICENSE.txt +21 -0
- package/_bundled_plugin/mcp/helpers.mjs +2 -11
- package/_bundled_plugin/mcp/helpers.mjs.br +0 -0
- package/_bundled_plugin/mcp/native/THIRD_PARTY_NOTICES.txt +3 -210
- 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/package.json +1 -0
- package/_bundled_plugin/mcp/permission-profile-preflight.mjs +5 -2
- package/_bundled_plugin/mcp/server.mjs +2 -11
- package/_bundled_plugin/mcp/server.mjs.br +0 -0
- package/_bundled_plugin/mcp/session-decompression.mjs +712 -0
- package/_bundled_plugin/references/artifact-storage.md +1 -1
- package/_bundled_plugin/references/baseline-auditor.md +18 -0
- package/_bundled_plugin/references/core-scan.md +5 -42
- package/_bundled_plugin/references/default-severity-rubric.md +9 -4
- package/_bundled_plugin/references/final-report.md +5 -3
- package/_bundled_plugin/references/finding-detail-fields.md +18 -18
- package/_bundled_plugin/references/focused-investigator.md +13 -0
- package/_bundled_plugin/references/sarif-adapter.md +8 -2
- package/_bundled_plugin/references/scan-artifacts.md +21 -12
- package/_bundled_plugin/references/scan-contract.md +27 -33
- package/_bundled_plugin/references/scan-prologue.md +2 -2
- package/_bundled_plugin/references/scan-runtime.md +4 -2
- package/_bundled_plugin/references/security-guidance.md +14 -1
- package/_bundled_plugin/references/validate-scan-findings.md +3 -0
- package/_bundled_plugin/schemas/tools/scan-draft.schema.json +2 -2
- package/_bundled_plugin/scripts/check_deep_scan_target.py +97 -0
- package/_bundled_plugin/scripts/codex_profile.mjs +7 -1
- package/_bundled_plugin/scripts/deep_scan_config.py +20 -1
- package/_bundled_plugin/scripts/deep_scan_workbench.py +192 -352
- package/_bundled_plugin/scripts/dispatch_inventory_tool +7 -0
- package/_bundled_plugin/scripts/filesystem_identity.py +1 -0
- package/_bundled_plugin/scripts/finalize_scan_contract.py +182 -230
- package/_bundled_plugin/scripts/finding_preview.py +20 -0
- package/_bundled_plugin/scripts/launch_codex_security_mcp +55 -16
- package/_bundled_plugin/scripts/legacy_findings.py +148 -0
- package/_bundled_plugin/scripts/posix_scan_local_files.py +37 -1
- package/_bundled_plugin/scripts/read_codex_session.mjs +21 -0
- package/_bundled_plugin/scripts/report_projection.py +81 -43
- package/_bundled_plugin/scripts/review_state.py +8 -2
- package/_bundled_plugin/scripts/servicenow_avit.py +20 -0
- package/_bundled_plugin/scripts/snapshot_sqlite.py +9 -2
- package/_bundled_plugin/scripts/threat_model_projection.py +22 -26
- package/_bundled_plugin/scripts/validate_scan_contract.py +7 -1
- package/_bundled_plugin/scripts/windows_scan_local_files.py +582 -20
- package/_bundled_plugin/scripts/workbench/__init__.py +1 -1
- package/_bundled_plugin/scripts/workbench/handoff.py +100 -23
- package/_bundled_plugin/scripts/workbench/retained_coverage.py +30 -51
- package/_bundled_plugin/scripts/workbench/retained_records.py +18 -30
- package/_bundled_plugin/scripts/workbench/runtime_toml.py +4 -1
- package/_bundled_plugin/scripts/workbench/saved_coverage.py +9 -17
- package/_bundled_plugin/scripts/workbench/saved_outputs.py +9 -0
- package/_bundled_plugin/scripts/workbench/saved_sources.py +47 -40
- package/_bundled_plugin/scripts/workbench/storage.py +91 -7
- package/_bundled_plugin/scripts/workbench_cli.py +54 -14
- package/_bundled_plugin/scripts/workbench_constants.py +12 -0
- package/_bundled_plugin/scripts/workbench_coverage_receipts.py +3 -3
- package/_bundled_plugin/scripts/workbench_db.py +562 -303
- package/_bundled_plugin/scripts/workbench_feedback.py +57 -11
- package/_bundled_plugin/scripts/workbench_finding_index.py +1 -0
- package/_bundled_plugin/scripts/workbench_finding_workflows.py +4 -0
- package/_bundled_plugin/scripts/workbench_native_indexes.py +238 -41
- package/_bundled_plugin/scripts/workbench_progress.py +169 -4
- package/_bundled_plugin/scripts/workbench_publication.py +16 -13
- package/_bundled_plugin/scripts/workbench_remediation.py +155 -2
- package/_bundled_plugin/scripts/workbench_saved_results.py +176 -81
- package/_bundled_plugin/scripts/workbench_scan_history.py +398 -174
- package/_bundled_plugin/scripts/workbench_scan_start.py +224 -31
- package/_bundled_plugin/scripts/workbench_scan_usage.py +675 -73
- package/_bundled_plugin/scripts/workbench_schema.py +258 -63
- package/_bundled_plugin/scripts/workbench_setup.py +14 -2
- package/_bundled_plugin/scripts/workbench_source_excerpt.py +13 -0
- package/_bundled_plugin/scripts/workbench_source_scopes.py +18 -0
- package/_bundled_plugin/scripts/workbench_target.py +594 -136
- package/_bundled_plugin/scripts/workbench_target_state.py +1110 -21
- package/_bundled_plugin/scripts/workbench_validation.py +43 -3
- package/_bundled_plugin/shared/workbench-history-repairs.json +77 -35
- package/_bundled_plugin/shared/workbench-migrations.json +100 -0
- package/_bundled_plugin/skills/cloud-findings/SKILL.md +5 -5
- package/_bundled_plugin/skills/deep-security-scan/SKILL.md +7 -50
- package/_bundled_plugin/skills/fix-finding/SKILL.md +2 -1
- package/_bundled_plugin/skills/publish-findings/SKILL.md +24 -153
- package/_bundled_plugin/skills/publish-findings/agents/openai.yaml +2 -2
- package/_bundled_plugin/skills/publish-findings/references/checkmarx-import.md +37 -0
- package/_bundled_plugin/skills/publish-findings/references/wiz-import.md +3 -3
- package/_bundled_plugin/skills/publish-findings/scripts/collect_checkmarx.py +409 -0
- package/_bundled_plugin/skills/publish-findings/scripts/collect_continuum.py +224 -0
- package/_bundled_plugin/skills/publish-findings/scripts/collector_paths.py +63 -0
- package/_bundled_plugin/skills/security-scan/SKILL.md +9 -46
- package/_bundled_plugin/skills/security-scan/agents/openai.yaml +2 -2
- package/_bundled_plugin/skills/security-scan/references/desktop-scan.md +3 -21
- package/_bundled_plugin/skills/security-scan/references/managed-scan.md +11 -0
- package/_bundled_plugin/skills/security-scan/references/scan-results.md +15 -0
- package/_bundled_plugin/skills/security-scan/references/scoped-paths.md +23 -0
- package/_bundled_plugin/skills/security-scan/references/sdk-files.md +24 -0
- package/_bundled_plugin/skills/threat-model-visualize/scripts/build_explorer.py +22 -1
- package/_bundled_plugin/skills/triage-finding/references/ticket-intake.md +6 -2
- package/bin/codex-security.mjs +2 -2
- package/dist/api.d.ts +45 -5
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +1192 -427
- package/dist/api.js.map +1 -1
- package/dist/armorcode-findings.d.ts +9 -0
- package/dist/armorcode-findings.d.ts.map +1 -0
- package/dist/armorcode-findings.js +145 -0
- package/dist/armorcode-findings.js.map +1 -0
- package/dist/artifact-export.d.ts +2 -0
- package/dist/artifact-export.d.ts.map +1 -1
- package/dist/artifact-export.js +29 -13
- package/dist/artifact-export.js.map +1 -1
- package/dist/auth.d.ts +6 -2
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +37 -18
- package/dist/auth.js.map +1 -1
- package/dist/batch-cost.d.ts +18 -0
- package/dist/batch-cost.d.ts.map +1 -0
- package/dist/batch-cost.js +41 -0
- package/dist/batch-cost.js.map +1 -0
- package/dist/bedrock-oss-pricing.d.ts +6 -0
- package/dist/bedrock-oss-pricing.d.ts.map +1 -0
- package/dist/bedrock-oss-pricing.js +58 -0
- package/dist/bedrock-oss-pricing.js.map +1 -0
- package/dist/bedrock-pricing.d.ts +15 -0
- package/dist/bedrock-pricing.d.ts.map +1 -0
- package/dist/bedrock-pricing.js +117 -0
- package/dist/bedrock-pricing.js.map +1 -0
- package/dist/blackduck-findings.d.ts +1 -1
- package/dist/blackduck-findings.d.ts.map +1 -1
- package/dist/blackduck-findings.js +24 -22
- package/dist/blackduck-findings.js.map +1 -1
- package/dist/bulk-scan-discovery.d.ts.map +1 -1
- package/dist/bulk-scan-discovery.js +4 -4
- package/dist/bulk-scan-discovery.js.map +1 -1
- package/dist/bundled-plugin.d.ts +4 -0
- package/dist/bundled-plugin.d.ts.map +1 -0
- package/dist/bundled-plugin.js +23 -0
- package/dist/bundled-plugin.js.map +1 -0
- package/dist/checkmarx-evidence.d.ts +19 -0
- package/dist/checkmarx-evidence.d.ts.map +1 -0
- package/dist/checkmarx-evidence.js +36 -0
- package/dist/checkmarx-evidence.js.map +1 -0
- package/dist/checkmarx-findings.d.ts +4 -0
- package/dist/checkmarx-findings.d.ts.map +1 -0
- package/dist/checkmarx-findings.js +27 -0
- package/dist/checkmarx-findings.js.map +1 -0
- package/dist/checkmarx-one.d.ts +4 -0
- package/dist/checkmarx-one.d.ts.map +1 -0
- package/dist/checkmarx-one.js +53 -0
- package/dist/checkmarx-one.js.map +1 -0
- package/dist/checkmarx-repository.d.ts +12 -0
- package/dist/checkmarx-repository.d.ts.map +1 -0
- package/dist/checkmarx-repository.js +181 -0
- package/dist/checkmarx-repository.js.map +1 -0
- package/dist/checkmarx-xml.d.ts +12 -0
- package/dist/checkmarx-xml.d.ts.map +1 -0
- package/dist/checkmarx-xml.js +196 -0
- package/dist/checkmarx-xml.js.map +1 -0
- package/dist/classify-scan-severity.d.ts +1 -1
- package/dist/classify-scan-severity.d.ts.map +1 -1
- package/dist/classify-scan-severity.js +11 -3
- package/dist/classify-scan-severity.js.map +1 -1
- package/dist/classify-severity-records.d.ts +1 -9
- package/dist/classify-severity-records.d.ts.map +1 -1
- package/dist/classify-severity-records.js +3 -13
- package/dist/classify-severity-records.js.map +1 -1
- package/dist/classify-severity.d.ts.map +1 -1
- package/dist/classify-severity.js +11 -10
- package/dist/classify-severity.js.map +1 -1
- package/dist/cli-argument.d.ts +4 -0
- package/dist/cli-argument.d.ts.map +1 -0
- package/dist/cli-argument.js +17 -0
- package/dist/cli-argument.js.map +1 -0
- package/dist/cli-help.d.ts +1 -1
- package/dist/cli-help.d.ts.map +1 -1
- package/dist/cli-help.js +71 -29
- package/dist/cli-help.js.map +1 -1
- package/dist/cli-hook.d.ts +3 -0
- package/dist/cli-hook.d.ts.map +1 -0
- package/dist/cli-hook.js +87 -0
- package/dist/cli-hook.js.map +1 -0
- package/dist/cli-integrations.d.ts +13 -0
- package/dist/cli-integrations.d.ts.map +1 -0
- package/dist/cli-integrations.js +333 -0
- package/dist/cli-integrations.js.map +1 -0
- package/dist/cli-mcp.d.ts +15 -0
- package/dist/cli-mcp.d.ts.map +1 -0
- package/dist/cli-mcp.js +178 -0
- package/dist/cli-mcp.js.map +1 -0
- package/dist/cli-token-view.d.ts +10 -0
- package/dist/cli-token-view.d.ts.map +1 -0
- package/dist/cli-token-view.js +41 -0
- package/dist/cli-token-view.js.map +1 -0
- package/dist/cli.d.ts +16 -8
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +3382 -2017
- package/dist/cli.js.map +1 -1
- package/dist/cloud-publish.d.ts.map +1 -1
- package/dist/cloud-publish.js +35 -33
- package/dist/cloud-publish.js.map +1 -1
- package/dist/codex-sdk-environment.d.ts +6 -0
- package/dist/codex-sdk-environment.d.ts.map +1 -1
- package/dist/codex-sdk-environment.js +19 -0
- package/dist/codex-sdk-environment.js.map +1 -1
- package/dist/command-words.d.ts +3 -0
- package/dist/command-words.d.ts.map +1 -0
- package/dist/command-words.js +46 -0
- package/dist/command-words.js.map +1 -0
- package/dist/component-scan.d.ts +19 -4
- package/dist/component-scan.d.ts.map +1 -1
- package/dist/component-scan.js +67 -9
- package/dist/component-scan.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +130 -67
- package/dist/config.js.map +1 -1
- package/dist/continuum-findings.d.ts +1 -1
- package/dist/continuum-findings.d.ts.map +1 -1
- package/dist/continuum-findings.js +149 -19
- package/dist/continuum-findings.js.map +1 -1
- package/dist/contract-values.d.ts +2 -0
- package/dist/contract-values.d.ts.map +1 -1
- package/dist/contract-values.js +12 -9
- package/dist/contract-values.js.map +1 -1
- package/dist/cost-model.d.ts +13 -1
- package/dist/cost-model.d.ts.map +1 -1
- package/dist/cost-model.js +66 -112
- package/dist/cost-model.js.map +1 -1
- package/dist/cost.d.ts +42 -3
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +484 -149
- package/dist/cost.js.map +1 -1
- package/dist/custom-publish.d.ts +4 -0
- package/dist/custom-publish.d.ts.map +1 -1
- package/dist/custom-publish.js +40 -3
- package/dist/custom-publish.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 +29 -19
- package/dist/custom-validation-prompt.js.map +1 -1
- package/dist/deduplication/local.d.ts +4 -2
- package/dist/deduplication/local.d.ts.map +1 -1
- package/dist/deduplication/local.js +9 -2
- package/dist/deduplication/local.js.map +1 -1
- package/dist/deduplication/refusal.d.ts.map +1 -1
- package/dist/deduplication/refusal.js +26 -5
- package/dist/deduplication/refusal.js.map +1 -1
- package/dist/deduplication/scan.d.ts +5 -0
- package/dist/deduplication/scan.d.ts.map +1 -1
- package/dist/deduplication/scan.js +24 -7
- package/dist/deduplication/scan.js.map +1 -1
- package/dist/deep-config.d.ts +0 -1
- package/dist/deep-config.d.ts.map +1 -1
- package/dist/deep-config.js +22 -33
- package/dist/deep-config.js.map +1 -1
- package/dist/deep-scan-defaults.d.ts +2 -0
- package/dist/deep-scan-defaults.d.ts.map +1 -1
- package/dist/deep-scan-defaults.js +28 -1
- package/dist/deep-scan-defaults.js.map +1 -1
- package/dist/deep-scan.d.ts +2 -0
- package/dist/deep-scan.d.ts.map +1 -1
- package/dist/deep-scan.js +44 -19
- package/dist/deep-scan.js.map +1 -1
- package/dist/default-severity-rubric.d.ts +1 -1
- package/dist/default-severity-rubric.d.ts.map +1 -1
- package/dist/default-severity-rubric.js +1 -1
- package/dist/default-severity-rubric.js.map +1 -1
- package/dist/endor-findings.d.ts +3 -1
- package/dist/endor-findings.d.ts.map +1 -1
- package/dist/endor-findings.js +86 -45
- package/dist/endor-findings.js.map +1 -1
- package/dist/errors.d.ts +4 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +15 -4
- package/dist/errors.js.map +1 -1
- package/dist/executable-path.d.ts +3 -0
- package/dist/executable-path.d.ts.map +1 -1
- package/dist/executable-path.js +26 -0
- package/dist/executable-path.js.map +1 -1
- package/dist/external-findings-import.d.ts +5 -3
- package/dist/external-findings-import.d.ts.map +1 -1
- package/dist/external-findings-import.js +19 -7
- package/dist/external-findings-import.js.map +1 -1
- package/dist/external-findings-local.d.ts +69 -5
- package/dist/external-findings-local.d.ts.map +1 -1
- package/dist/external-findings-local.js +537 -108
- package/dist/external-findings-local.js.map +1 -1
- package/dist/external-findings-publish.d.ts +13 -6
- package/dist/external-findings-publish.d.ts.map +1 -1
- package/dist/external-findings-publish.js +895 -1142
- package/dist/external-findings-publish.js.map +1 -1
- package/dist/external-findings-read.d.ts +21 -2
- package/dist/external-findings-read.d.ts.map +1 -1
- package/dist/external-findings-read.js +130 -68
- package/dist/external-findings-read.js.map +1 -1
- package/dist/external-findings.d.ts +15 -3
- package/dist/external-findings.d.ts.map +1 -1
- package/dist/external-findings.js +54 -2
- package/dist/external-findings.js.map +1 -1
- package/dist/external-import-contract.d.ts +8 -12
- package/dist/external-import-contract.d.ts.map +1 -1
- package/dist/external-import-contract.js +51 -184
- 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/feedback.d.ts.map +1 -1
- package/dist/feedback.js +5 -4
- package/dist/feedback.js.map +1 -1
- package/dist/finding-prompt.d.ts +5 -0
- package/dist/finding-prompt.d.ts.map +1 -0
- package/dist/finding-prompt.js +32 -0
- package/dist/finding-prompt.js.map +1 -0
- package/dist/findings-client.d.ts +1 -0
- package/dist/findings-client.d.ts.map +1 -1
- package/dist/findings-client.js +27 -3
- package/dist/findings-client.js.map +1 -1
- package/dist/github-advisories.d.ts.map +1 -1
- package/dist/github-advisories.js +0 -2
- package/dist/github-advisories.js.map +1 -1
- package/dist/github-dependabot-findings.d.ts.map +1 -1
- package/dist/github-dependabot-findings.js +18 -8
- package/dist/github-dependabot-findings.js.map +1 -1
- package/dist/github-findings.d.ts +4 -1
- package/dist/github-findings.d.ts.map +1 -1
- package/dist/github-findings.js +73 -316
- package/dist/github-findings.js.map +1 -1
- package/dist/hosted-git-remotes.d.ts +5 -0
- package/dist/hosted-git-remotes.d.ts.map +1 -0
- package/dist/hosted-git-remotes.js +285 -0
- package/dist/hosted-git-remotes.js.map +1 -0
- package/dist/hosted-git-repository.d.ts +28 -0
- package/dist/hosted-git-repository.d.ts.map +1 -0
- package/dist/hosted-git-repository.js +222 -0
- package/dist/hosted-git-repository.js.map +1 -0
- package/dist/hosted-remediation.d.ts +1 -0
- package/dist/hosted-remediation.d.ts.map +1 -1
- package/dist/hosted-remediation.js +23 -3
- package/dist/hosted-remediation.js.map +1 -1
- package/dist/hosted-scan-protocol.js +2 -2
- package/dist/hosted-scan-protocol.js.map +1 -1
- package/dist/hosted-scan.d.ts.map +1 -1
- package/dist/hosted-scan.js +16 -11
- package/dist/hosted-scan.js.map +1 -1
- package/dist/hosted-scanner-http.d.ts +21 -0
- package/dist/hosted-scanner-http.d.ts.map +1 -0
- package/dist/hosted-scanner-http.js +204 -0
- package/dist/hosted-scanner-http.js.map +1 -0
- package/dist/import-scan.d.ts.map +1 -1
- package/dist/import-scan.js +3 -0
- package/dist/import-scan.js.map +1 -1
- package/dist/index.d.ts +21 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/inspector-findings.d.ts.map +1 -1
- package/dist/inspector-findings.js +52 -86
- package/dist/inspector-findings.js.map +1 -1
- package/dist/knowledge-base.d.ts +1 -1
- package/dist/knowledge-base.d.ts.map +1 -1
- package/dist/knowledge-base.js +102 -32
- package/dist/knowledge-base.js.map +1 -1
- package/dist/linear.d.ts +11 -0
- package/dist/linear.d.ts.map +1 -1
- package/dist/linear.js.map +1 -1
- package/dist/local-git-metadata.d.ts +5 -2
- package/dist/local-git-metadata.d.ts.map +1 -1
- package/dist/local-git-metadata.js +8 -5
- package/dist/local-git-metadata.js.map +1 -1
- package/dist/multiscan.d.ts +10 -4
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +217 -102
- package/dist/multiscan.js.map +1 -1
- package/dist/native-json-findings.d.ts +2 -1
- package/dist/native-json-findings.d.ts.map +1 -1
- package/dist/native-json-findings.js +12 -2
- package/dist/native-json-findings.js.map +1 -1
- package/dist/opengrep-findings.d.ts +5 -2
- package/dist/opengrep-findings.d.ts.map +1 -1
- package/dist/opengrep-findings.js +54 -33
- package/dist/opengrep-findings.js.map +1 -1
- package/dist/operation-telemetry.d.ts +104 -0
- package/dist/operation-telemetry.d.ts.map +1 -0
- package/dist/operation-telemetry.js +293 -0
- package/dist/operation-telemetry.js.map +1 -0
- package/dist/plugin-python-probe.d.ts +4 -0
- package/dist/plugin-python-probe.d.ts.map +1 -0
- package/dist/plugin-python-probe.js +10 -0
- package/dist/plugin-python-probe.js.map +1 -0
- package/dist/private-finding-import.d.ts +99 -9
- package/dist/private-finding-import.d.ts.map +1 -1
- package/dist/private-finding-import.js +116 -152
- package/dist/private-finding-import.js.map +1 -1
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +53 -13
- package/dist/project-config.js.map +1 -1
- package/dist/prompt-files.d.ts +7 -2
- package/dist/prompt-files.d.ts.map +1 -1
- package/dist/prompt-files.js +42 -20
- package/dist/prompt-files.js.map +1 -1
- package/dist/provider-profile.d.ts +1 -1
- package/dist/provider-profile.d.ts.map +1 -1
- package/dist/provider-profile.js +12 -10
- package/dist/provider-profile.js.map +1 -1
- package/dist/publication-telemetry.d.ts +45 -0
- package/dist/publication-telemetry.d.ts.map +1 -0
- package/dist/publication-telemetry.js +50 -0
- package/dist/publication-telemetry.js.map +1 -0
- package/dist/publication.d.ts +1 -1
- package/dist/publication.d.ts.map +1 -1
- package/dist/publication.js.map +1 -1
- package/dist/publish.d.ts +4 -0
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +42 -2
- package/dist/publish.js.map +1 -1
- package/dist/record.d.ts +1 -5
- package/dist/record.d.ts.map +1 -1
- package/dist/record.js +3 -51
- package/dist/record.js.map +1 -1
- package/dist/remediation.d.ts +1 -4
- package/dist/remediation.d.ts.map +1 -1
- package/dist/remediation.js +6 -8
- package/dist/remediation.js.map +1 -1
- package/dist/request-metadata.d.ts +3 -0
- package/dist/request-metadata.d.ts.map +1 -1
- package/dist/request-metadata.js +9 -0
- package/dist/request-metadata.js.map +1 -1
- package/dist/result.d.ts +4 -0
- package/dist/result.d.ts.map +1 -1
- package/dist/result.js +1 -1
- package/dist/result.js.map +1 -1
- package/dist/retry-windows-rename.d.ts +8 -0
- package/dist/retry-windows-rename.d.ts.map +1 -0
- package/dist/retry-windows-rename.js +24 -0
- package/dist/retry-windows-rename.js.map +1 -0
- package/dist/runtime.d.ts +54 -6
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +1084 -256
- package/dist/runtime.js.map +1 -1
- package/dist/saved-scan-bootstrap.d.ts +7 -1
- package/dist/saved-scan-bootstrap.d.ts.map +1 -1
- package/dist/saved-scan-bootstrap.js +269 -114
- package/dist/saved-scan-bootstrap.js.map +1 -1
- package/dist/scan-activity.d.ts.map +1 -1
- package/dist/scan-activity.js +141 -56
- package/dist/scan-activity.js.map +1 -1
- package/dist/scan-archive-path.d.ts +2 -0
- package/dist/scan-archive-path.d.ts.map +1 -0
- package/dist/scan-archive-path.js +5 -0
- package/dist/scan-archive-path.js.map +1 -0
- package/dist/scan-comparison.d.ts +10 -5
- package/dist/scan-comparison.d.ts.map +1 -1
- package/dist/scan-comparison.js +66 -17
- package/dist/scan-comparison.js.map +1 -1
- package/dist/scan-dashboard.d.ts +7 -6
- package/dist/scan-dashboard.d.ts.map +1 -1
- package/dist/scan-dashboard.js +92 -43
- package/dist/scan-dashboard.js.map +1 -1
- package/dist/scan-executor.d.ts +10 -1
- package/dist/scan-executor.d.ts.map +1 -1
- package/dist/scan-executor.js +24 -2
- package/dist/scan-executor.js.map +1 -1
- package/dist/scan-history-renderer.d.ts +1 -0
- package/dist/scan-history-renderer.d.ts.map +1 -1
- package/dist/scan-history-renderer.js +34 -28
- package/dist/scan-history-renderer.js.map +1 -1
- package/dist/scan-logs.d.ts +12 -0
- package/dist/scan-logs.d.ts.map +1 -1
- package/dist/scan-logs.js +131 -78
- package/dist/scan-logs.js.map +1 -1
- package/dist/scan-measurement.d.ts +26 -0
- package/dist/scan-measurement.d.ts.map +1 -0
- package/dist/scan-measurement.js +77 -0
- package/dist/scan-measurement.js.map +1 -0
- package/dist/scan-progress.d.ts +1 -0
- package/dist/scan-progress.d.ts.map +1 -1
- package/dist/scan-progress.js +3 -0
- package/dist/scan-progress.js.map +1 -1
- package/dist/scan-sessions.d.ts.map +1 -1
- package/dist/scan-sessions.js +4 -1
- package/dist/scan-sessions.js.map +1 -1
- package/dist/scan-settings.d.ts +1 -1
- package/dist/scan-settings.d.ts.map +1 -1
- package/dist/scan-settings.js +1 -24
- package/dist/scan-settings.js.map +1 -1
- package/dist/scanner-import.d.ts +25 -13
- package/dist/scanner-import.d.ts.map +1 -1
- package/dist/scanner-import.js +216 -97
- package/dist/scanner-import.js.map +1 -1
- package/dist/scanner-repository-url.d.ts +4 -1
- package/dist/scanner-repository-url.d.ts.map +1 -1
- package/dist/scanner-repository-url.js +10 -6
- package/dist/scanner-repository-url.js.map +1 -1
- package/dist/security-policy.d.ts +1 -1
- package/dist/security-policy.d.ts.map +1 -1
- package/dist/security-policy.js +26 -6
- package/dist/security-policy.js.map +1 -1
- package/dist/semgrep-findings.d.ts +6 -3
- package/dist/semgrep-findings.d.ts.map +1 -1
- package/dist/semgrep-findings.js +72 -42
- package/dist/semgrep-findings.js.map +1 -1
- package/dist/semgrep-guardian-findings.d.ts +38 -0
- package/dist/semgrep-guardian-findings.d.ts.map +1 -0
- package/dist/semgrep-guardian-findings.js +165 -0
- package/dist/semgrep-guardian-findings.js.map +1 -0
- package/dist/semgrep-platform-collector.d.ts +26 -0
- package/dist/semgrep-platform-collector.d.ts.map +1 -0
- package/dist/semgrep-platform-collector.js +108 -0
- package/dist/semgrep-platform-collector.js.map +1 -0
- package/dist/semgrep-platform-findings.d.ts +157 -6
- package/dist/semgrep-platform-findings.d.ts.map +1 -1
- package/dist/semgrep-platform-findings.js +766 -103
- package/dist/semgrep-platform-findings.js.map +1 -1
- package/dist/server/api.d.ts +1 -1
- package/dist/server/api.d.ts.map +1 -1
- package/dist/server/api.js.map +1 -1
- package/dist/server/embedding-tokenizer.cdx.json +33 -0
- package/dist/server/embedding-tokenizer.d.ts +2 -0
- package/dist/server/embedding-tokenizer.d.ts.map +1 -0
- package/dist/server/embedding-tokenizer.js +322 -0
- package/dist/server/embedding-tokenizer.js.map +6 -0
- package/dist/server/embeddings.d.ts +16 -2
- package/dist/server/embeddings.d.ts.map +1 -1
- package/dist/server/embeddings.js +35 -5
- package/dist/server/embeddings.js.map +1 -1
- package/dist/session-lines.d.ts +5 -0
- package/dist/session-lines.d.ts.map +1 -0
- package/dist/session-lines.js +60 -0
- package/dist/session-lines.js.map +1 -0
- package/dist/severity-review.d.ts +3 -1
- package/dist/severity-review.d.ts.map +1 -1
- package/dist/severity-review.js +3 -2
- package/dist/severity-review.js.map +1 -1
- package/dist/skill-authentication.d.ts +1 -0
- package/dist/skill-authentication.d.ts.map +1 -1
- package/dist/skill-authentication.js +1 -0
- package/dist/skill-authentication.js.map +1 -1
- package/dist/snyk-findings.d.ts +9 -2
- package/dist/snyk-findings.d.ts.map +1 -1
- package/dist/snyk-findings.js +90 -70
- package/dist/snyk-findings.js.map +1 -1
- package/dist/snyk-rest-findings.d.ts +59 -0
- package/dist/snyk-rest-findings.d.ts.map +1 -0
- package/dist/snyk-rest-findings.js +879 -0
- package/dist/snyk-rest-findings.js.map +1 -0
- package/dist/snyk-token-origin.d.ts +4 -0
- package/dist/snyk-token-origin.d.ts.map +1 -0
- package/dist/snyk-token-origin.js +82 -0
- package/dist/snyk-token-origin.js.map +1 -0
- package/dist/sonar-collector.d.ts.map +1 -1
- package/dist/sonar-collector.js +0 -3
- package/dist/sonar-collector.js.map +1 -1
- package/dist/sonar-findings.d.ts +1 -1
- package/dist/sonar-findings.d.ts.map +1 -1
- package/dist/sonar-findings.js +2 -4
- package/dist/sonar-findings.js.map +1 -1
- package/dist/sonar-import.d.ts +3 -0
- package/dist/sonar-import.d.ts.map +1 -1
- package/dist/sonar-import.js +30 -34
- package/dist/sonar-import.js.map +1 -1
- package/dist/stored-finding-projection.d.ts +6 -0
- package/dist/stored-finding-projection.d.ts.map +1 -0
- package/dist/stored-finding-projection.js +104 -0
- package/dist/stored-finding-projection.js.map +1 -0
- package/dist/stored-findings-publication.d.ts +23 -0
- package/dist/stored-findings-publication.d.ts.map +1 -0
- package/dist/stored-findings-publication.js +169 -0
- package/dist/stored-findings-publication.js.map +1 -0
- package/dist/target-drift.d.ts +9 -0
- package/dist/target-drift.d.ts.map +1 -0
- package/dist/target-drift.js +27 -0
- package/dist/target-drift.js.map +1 -0
- package/dist/targets.d.ts +8 -1
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +131 -42
- package/dist/targets.js.map +1 -1
- package/dist/tenable-findings.d.ts +6 -0
- package/dist/tenable-findings.d.ts.map +1 -0
- package/dist/tenable-findings.js +122 -0
- package/dist/tenable-findings.js.map +1 -0
- package/dist/terminal-stream.d.ts +13 -0
- package/dist/terminal-stream.d.ts.map +1 -0
- package/dist/terminal-stream.js +35 -0
- package/dist/terminal-stream.js.map +1 -0
- package/dist/trivy-findings.d.ts +19 -0
- package/dist/trivy-findings.d.ts.map +1 -0
- package/dist/trivy-findings.js +424 -0
- package/dist/trivy-findings.js.map +1 -0
- package/dist/trivy-import.d.ts +19 -0
- package/dist/trivy-import.d.ts.map +1 -0
- package/dist/trivy-import.js +151 -0
- package/dist/trivy-import.js.map +1 -0
- package/dist/trusted-executable.d.ts +6 -0
- package/dist/trusted-executable.d.ts.map +1 -1
- package/dist/trusted-executable.js +140 -37
- package/dist/trusted-executable.js.map +1 -1
- package/dist/validation-records.js +1 -1
- package/dist/validation-records.js.map +1 -1
- package/dist/veracode-findings.d.ts +1 -1
- package/dist/veracode-findings.d.ts.map +1 -1
- package/dist/veracode-findings.js +19 -6
- package/dist/veracode-findings.js.map +1 -1
- package/dist/version.d.ts +3 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +184 -32
- package/dist/version.js.map +1 -1
- package/dist/vertex-pricing.d.ts +8 -0
- package/dist/vertex-pricing.d.ts.map +1 -0
- package/dist/vertex-pricing.js +20 -0
- package/dist/vertex-pricing.js.map +1 -0
- package/dist/windows-path.d.ts +1 -0
- package/dist/windows-path.d.ts.map +1 -1
- package/dist/windows-path.js +26 -1
- package/dist/windows-path.js.map +1 -1
- package/dist/wiz-findings.d.ts +6 -2
- package/dist/wiz-findings.d.ts.map +1 -1
- package/dist/wiz-findings.js +65 -89
- package/dist/wiz-findings.js.map +1 -1
- package/docs/classify-severity-records.md +27 -12
- package/docs/cli.md +853 -639
- package/docs/dedupe-records.md +44 -24
- package/docs/findings-service.md +84 -44
- package/docs/hosted-remediation.md +27 -11
- package/docs/hosted-scans.md +50 -42
- package/docs/sdk.md +903 -0
- package/docs/telemetry.md +236 -0
- package/docs/validate-records.md +78 -44
- package/package.json +23 -16
- package/schemas/external-findings.schema.json +4 -1
- 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/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/schemas/tools/deep-reducer.schema.json +0 -96
- package/dist/external-imports-feature.d.ts +0 -6
- package/dist/external-imports-feature.d.ts.map +0 -1
- package/dist/external-imports-feature.js +0 -51
- package/dist/external-imports-feature.js.map +0 -1
- package/dist/finding-normalization.d.ts +0 -5
- package/dist/finding-normalization.d.ts.map +0 -1
- package/dist/finding-normalization.js +0 -155
- package/dist/finding-normalization.js.map +0 -1
- package/dist/reader-selection.d.ts +0 -13
- package/dist/reader-selection.d.ts.map +0 -1
- package/dist/reader-selection.js +0 -81
- package/dist/reader-selection.js.map +0 -1
|
@@ -1,23 +1,50 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { isDeepStrictEqual } from "node:util";
|
|
3
|
+
import { semgrepPlatformFindingBinding, semgrepPlatformReportScope, semgrepPlatformRepositoryReference, isSemgrepPlatformEvidence, semgrepReferenceMatches, } from "./semgrep-platform-findings.js";
|
|
4
|
+
import { gitPathToHttpPath, gitServiceHostname, isPublicGitHost, gitTransportBytes, hostedRepositoryMatches, normalizeHostedGitRepositoryUrl, } from "./hosted-git-repository.js";
|
|
5
|
+
import { checkRetainedTrivyProvider, checkTrivyReportProvider, matchTrivyCheckout, } from "./trivy-import.js";
|
|
6
|
+
import { readGitRemoteNames, readHostedGitRemotes, } from "./hosted-git-remotes.js";
|
|
1
7
|
import { CodexSecurityError } from "./errors.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
8
|
+
import { externalImportDisposition, NoPublishableFindingsError, cloneImportPreview, reportForJson, snapshotImportOptions, snapshotNormalizedFindings, snapshotSourceRepositories, } from "./external-findings.js";
|
|
9
|
+
import { cloudRepositoryUrlKey, requireSafeJsonInteger, repositoryUrlKey, validateExternalEvidence, } from "./external-import-contract.js";
|
|
10
|
+
import { EXTERNAL_FINDINGS_PROVIDERS, EXTERNAL_FINDINGS_READERS, localFindingRepositories, semgrepSarifRepositories, } from "./external-findings-read.js";
|
|
11
|
+
import { tenableReportFormat, tenableSourceRepository, } from "./tenable-findings.js";
|
|
12
|
+
import { guardianFindingRepository, guardianSelectionFormat, } from "./semgrep-guardian-findings.js";
|
|
13
|
+
import { hasGitMetadata, localGitProtectionRoots, commandGitProtectionRoots, } from "./local-git-metadata.js";
|
|
7
14
|
import { blackDuckReportRepositories, projectedBlackDuckRepositoryUrl, } from "./blackduck-findings.js";
|
|
8
15
|
import { azureReposHttpsUrl, isGitHubCloudHost, isGitHubSshOverHttps, isGitSsh, parseGitRemote, } from "./git-remote.js";
|
|
16
|
+
import { checkmarxSelection } from "./checkmarx-repository.js";
|
|
9
17
|
import { continuumReportRepositories } from "./continuum-findings.js";
|
|
10
18
|
import { veracodeReportRepositories } from "./veracode-findings.js";
|
|
11
19
|
import { inspectorReportRepository } from "./inspector-findings.js";
|
|
12
20
|
import { declaredScannerRepositoryUrl } from "./scanner-repository-url.js";
|
|
21
|
+
import { armorCodeRepositoryUrl } from "./armorcode-findings.js";
|
|
13
22
|
import { sonarRepositoryUrls } from "./sonar-findings.js";
|
|
14
23
|
import { isRecord } from "./record.js";
|
|
15
24
|
import { dependabotRepository } from "./github-dependabot-findings.js";
|
|
16
|
-
import {
|
|
25
|
+
import { retainedGitHubRepository } from "./github-findings.js";
|
|
26
|
+
import { snykRestImportRepository, snykRestCheckoutMatches, } from "./snyk-rest-findings.js";
|
|
27
|
+
import { bundledPluginRoot, canonicalConfigPath, canonicalizeModelSafePath, resolveInputPath, resolveParentTraversal, requireOutputOutsideRepositories, runWorkbench, workbenchEnvironment, } from "./runtime.js";
|
|
17
28
|
import { abortable, enclosingGitWorktreeRoot, gitOutput, normalizeRepository, } from "./targets.js";
|
|
18
29
|
function requireIdentity(value, field) {
|
|
19
30
|
if (typeof value !== "string" || !value.trim() || value.includes("\0"))
|
|
20
31
|
throw new CodexSecurityError(`${field} must be nonempty and contain no NUL characters.`);
|
|
32
|
+
if (!value.isWellFormed())
|
|
33
|
+
throw new CodexSecurityError(`${field} must contain valid Unicode.`);
|
|
34
|
+
}
|
|
35
|
+
function validateFindingIds(current) {
|
|
36
|
+
const identities = new Set();
|
|
37
|
+
for (const finding of current.findings) {
|
|
38
|
+
requireIdentity(finding.source_finding_id, "Source finding id");
|
|
39
|
+
if (identities.has(finding.source_finding_id))
|
|
40
|
+
throw new CodexSecurityError(`Duplicate source finding id ${JSON.stringify(finding.source_finding_id)}.`);
|
|
41
|
+
identities.add(finding.source_finding_id);
|
|
42
|
+
if (!isRecord(finding.evidence))
|
|
43
|
+
throw new CodexSecurityError("Imported evidence must be an object.");
|
|
44
|
+
if (typeof finding.evidence.title !== "string" ||
|
|
45
|
+
typeof finding.evidence.severity !== "string")
|
|
46
|
+
throw new CodexSecurityError("Imported evidence requires a title and severity.");
|
|
47
|
+
}
|
|
21
48
|
}
|
|
22
49
|
function checkStoredNumber(value) {
|
|
23
50
|
if (!Number.isFinite(value))
|
|
@@ -34,14 +61,9 @@ const gitTransportPorts = {
|
|
|
34
61
|
"ftp:": "21",
|
|
35
62
|
"ftps:": "990",
|
|
36
63
|
};
|
|
37
|
-
function sonarHostedGit(hostname) {
|
|
38
|
-
return (isGitHubCloudHost(hostname) ||
|
|
39
|
-
hostname === "gitlab.com" ||
|
|
40
|
-
hostname === "bitbucket.org");
|
|
41
|
-
}
|
|
42
64
|
function sonarHostedHostname(hostname) {
|
|
43
|
-
const name = hostname.toLowerCase()
|
|
44
|
-
return
|
|
65
|
+
const name = gitServiceHostname(hostname.toLowerCase());
|
|
66
|
+
return isPublicGitHost(name) ||
|
|
45
67
|
["ssh.github.com", "ssh.dev.azure.com", "dev.azure.com"].includes(name)
|
|
46
68
|
? name
|
|
47
69
|
: undefined;
|
|
@@ -106,27 +128,19 @@ function remoteRepository(value, provider, bound, platform = provider, possibleS
|
|
|
106
128
|
};
|
|
107
129
|
}
|
|
108
130
|
// Git passes the original path (including dot segments, '?' and '#') to upload-pack.
|
|
109
|
-
const literal = (raw) => {
|
|
110
|
-
const bytes = Buffer.from(raw).toString("latin1");
|
|
111
|
-
return scpStyle
|
|
112
|
-
? bytes
|
|
113
|
-
: bytes.replace(/%(?!00)([\da-f]{2})/giu, (_, hex) => String.fromCharCode(parseInt(hex, 16)));
|
|
114
|
-
};
|
|
115
131
|
if (!scpStyle && !transport)
|
|
116
132
|
return { key: value };
|
|
117
|
-
const gitPath =
|
|
133
|
+
const gitPath = gitTransportBytes(transport?.[2] ?? path, scpStyle);
|
|
118
134
|
const login = scpStyle
|
|
119
135
|
? /^([^@/:\s?#]+)@/u.exec(value)?.[1]
|
|
120
136
|
: /^(.*)@/u.exec(authority ?? "")?.[1];
|
|
121
137
|
const homeRelative = /^\/?~(?:\/|$)/u.test(gitPath) || (scpStyle && !/^[~/]/u.test(gitPath));
|
|
122
138
|
const suffix = /[?#].*$/su.exec(gitPath);
|
|
123
139
|
// Express upload-pack bytes as a URL path for comparison with the HTTP source.
|
|
124
|
-
const name = gitPath
|
|
125
|
-
.slice(0, suffix?.index)
|
|
126
|
-
.replace(/^\//u, "")
|
|
127
|
-
.replace(/[%\x00-\x20\x7f-\xff]/gu, (byte) => "%" + byte.charCodeAt(0).toString(16).toUpperCase().padStart(2, "0"));
|
|
140
|
+
const name = gitPathToHttpPath(gitPath.slice(0, suffix?.index));
|
|
128
141
|
// Azure's generated SCP clone URL spells spaces as %20, even though Git sends SCP paths literally.
|
|
129
|
-
const azure = provider === "sonar"
|
|
142
|
+
const azure = (provider === "sonar" || provider === "checkmarx") &&
|
|
143
|
+
!(scpStyle && path.startsWith("/"))
|
|
130
144
|
? azureReposHttpsUrl(url, scpStyle ? name.replace(/%2520/gu, "%20") : name)
|
|
131
145
|
: undefined;
|
|
132
146
|
const repository = suffix
|
|
@@ -136,7 +150,7 @@ function remoteRepository(value, provider, bound, platform = provider, possibleS
|
|
|
136
150
|
: key(azure ?? origin + name);
|
|
137
151
|
return {
|
|
138
152
|
key: repository,
|
|
139
|
-
account: ssh && login ?
|
|
153
|
+
account: ssh && login ? gitTransportBytes(login, scpStyle) : undefined,
|
|
140
154
|
// GitHub serves the same repository path through its SCP and SSH URLs.
|
|
141
155
|
homeRelative: ssh && platform !== "github" && !isGitHubCloudHost(hostname.toLowerCase())
|
|
142
156
|
? homeRelative
|
|
@@ -153,6 +167,20 @@ function matchingRemote(left, right) {
|
|
|
153
167
|
right.account === undefined ||
|
|
154
168
|
left.account === right.account));
|
|
155
169
|
}
|
|
170
|
+
// Within one fetch key and home-relative mode, matchingRemote can use any
|
|
171
|
+
// account, the requested login, or an unspecified login.
|
|
172
|
+
function fetchAliasMatcher(rows) {
|
|
173
|
+
const homes = Map.groupBy(rows, ({ fetch }) => fetch.homeRelative);
|
|
174
|
+
const accounts = Array.from(homes.values(), (group) => new Map(group.map(({ fetch }) => [fetch.account, fetch])));
|
|
175
|
+
return (fetch) => accounts.some((group) => [
|
|
176
|
+
group.values().next().value,
|
|
177
|
+
group.get(fetch.account),
|
|
178
|
+
group.get(undefined),
|
|
179
|
+
].some((candidate) => candidate !== undefined && matchingRemote(fetch, candidate)));
|
|
180
|
+
}
|
|
181
|
+
function fetchAliasMatchers(rows, key) {
|
|
182
|
+
return new Map(Array.from(Map.groupBy(rows, key), ([name, group]) => [name, fetchAliasMatcher(group)]));
|
|
183
|
+
}
|
|
156
184
|
/** A credential-free Sonar repository binding from a supported Git fetch transport. */
|
|
157
185
|
export function sonarRepositoryForRemote(origin) {
|
|
158
186
|
try {
|
|
@@ -182,7 +210,7 @@ export function sonarRepositoryForRemote(origin) {
|
|
|
182
210
|
else if (isGitSsh(url.protocol) &&
|
|
183
211
|
url.username === "git" &&
|
|
184
212
|
(!url.port || url.port === "22") &&
|
|
185
|
-
|
|
213
|
+
isPublicGitHost(hostname)) {
|
|
186
214
|
candidate = `https://${hostname}/${path}`;
|
|
187
215
|
}
|
|
188
216
|
else {
|
|
@@ -259,27 +287,13 @@ export async function configuredFetchRemotes(repository, provider, protectedRoot
|
|
|
259
287
|
!(await boundSonarWorktree(repository, gitProtectedRoots, environment, signal)))
|
|
260
288
|
return [];
|
|
261
289
|
const readGit = (args) => abortable(() => gitOutput(repository, args, signal, { LC_ALL: "C" }, undefined, "utf8", gitProtectedRoots, environment), signal);
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
266
|
-
catch (error) {
|
|
267
|
-
signal?.throwIfAborted();
|
|
268
|
-
// A local source directory need not be a Git checkout.
|
|
269
|
-
if (error instanceof Error &&
|
|
270
|
-
"code" in error &&
|
|
271
|
-
error.code === 128 &&
|
|
272
|
-
"stderr" in error &&
|
|
273
|
-
typeof error.stderr === "string" &&
|
|
274
|
-
(error.stderr.trimEnd() ===
|
|
275
|
-
"fatal: not a git repository (or any of the parent directories): .git" ||
|
|
276
|
-
/^fatal: not a git repository \(or any parent up to mount point [^\r\n]+\)\r?\nStopping at filesystem boundary \(GIT_DISCOVERY_ACROSS_FILESYSTEM not set\)\.$/u.test(error.stderr.trimEnd())))
|
|
277
|
-
return [];
|
|
278
|
-
throw error;
|
|
279
|
-
}
|
|
290
|
+
const remoteNames = await readGitRemoteNames(readGit, signal);
|
|
291
|
+
if (remoteNames === undefined)
|
|
292
|
+
return [];
|
|
280
293
|
const remotes = [];
|
|
294
|
+
const firstUrlOnly = provider === "sonar" || provider === "checkmarx";
|
|
281
295
|
for (const name of remoteNames.split(/\r?\n/u).filter(Boolean)) {
|
|
282
|
-
if (
|
|
296
|
+
if (firstUrlOnly) {
|
|
283
297
|
// Git fetches from only the first URL, after insteadOf rewrites.
|
|
284
298
|
const url = await readGit(["remote", "get-url", "--", name]);
|
|
285
299
|
if (/[\r\n]/u.test(url))
|
|
@@ -294,17 +308,41 @@ export async function configuredFetchRemotes(repository, provider, protectedRoot
|
|
|
294
308
|
}
|
|
295
309
|
return remotes;
|
|
296
310
|
}
|
|
297
|
-
async function
|
|
298
|
-
if (
|
|
311
|
+
async function hostedCheckoutRemotes(repository, protectedRoots, environment, signal) {
|
|
312
|
+
if (!(await hasGitMetadata(repository, signal)))
|
|
313
|
+
return undefined;
|
|
314
|
+
return readHostedGitRemotes(repository, [...protectedRoots, await canonicalConfigPath(process.cwd())], environment, signal);
|
|
315
|
+
}
|
|
316
|
+
async function requireMatchingRepository(repository, provider, sources, strictSources, hostedSources, platformFor, snyk, protectedRoots, environment, signal, possibleSshHost, fetchRemotes, isCheckmarxSource) {
|
|
317
|
+
if (!snyk && sources.length === 0 && hostedSources.length === 0)
|
|
299
318
|
return false;
|
|
319
|
+
let allSourcesMatched = true;
|
|
320
|
+
if (snyk || hostedSources.length) {
|
|
321
|
+
const remotes = await hostedCheckoutRemotes(repository, protectedRoots, environment, signal);
|
|
322
|
+
if (snyk) {
|
|
323
|
+
if (remotes &&
|
|
324
|
+
!remotes.some((remote) => snykRestCheckoutMatches(snyk, remote)))
|
|
325
|
+
throw new CodexSecurityError(`Imported repository ${JSON.stringify(snyk.url)} does not match a configured remote of ${repository}. Select the matching local repository.`);
|
|
326
|
+
return remotes !== undefined;
|
|
327
|
+
}
|
|
328
|
+
allSourcesMatched = remotes !== undefined;
|
|
329
|
+
if (remotes) {
|
|
330
|
+
for (const source of hostedSources)
|
|
331
|
+
if (!remotes.some((remote) => hostedRepositoryMatches(source, remote)))
|
|
332
|
+
throw new CodexSecurityError(`Imported repository ${JSON.stringify(source.url)} does not match a configured remote of ${repository}. Select the matching local repository.`);
|
|
333
|
+
}
|
|
334
|
+
if (!sources.length)
|
|
335
|
+
return allSourcesMatched;
|
|
336
|
+
}
|
|
337
|
+
const remoteProvider = (checkmarx) => checkmarx && provider !== "sonar" ? "checkmarx" : provider;
|
|
300
338
|
const remotes = fetchRemotes ??
|
|
301
|
-
(await configuredFetchRemotes(repository,
|
|
339
|
+
(await configuredFetchRemotes(repository, remoteProvider(Boolean(isCheckmarxSource)), protectedRoots, environment, signal));
|
|
302
340
|
const boundProvider = provider === "sonar" ||
|
|
341
|
+
provider === "checkmarx" ||
|
|
303
342
|
provider === "continuum" ||
|
|
304
343
|
provider === "inspector" ||
|
|
305
344
|
provider === "blackduck" ||
|
|
306
345
|
provider === "veracode";
|
|
307
|
-
const loosePlatformFor = localRepositoryPlatform(provider, sources, false);
|
|
308
346
|
const comparable = [];
|
|
309
347
|
const unverified = [];
|
|
310
348
|
for (const { url: remote } of remotes) {
|
|
@@ -314,13 +352,11 @@ async function requireMatchingRepository(repository, provider, sources, strictSo
|
|
|
314
352
|
else if (!/[\s\\\p{Cc}?#]/u.test(remote))
|
|
315
353
|
unverified.push(remote);
|
|
316
354
|
}
|
|
317
|
-
let allSourcesMatched = true;
|
|
318
355
|
for (const source of sources) {
|
|
319
356
|
const bound = boundProvider || strictSources.has(source.url);
|
|
320
|
-
const platform = bound
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
const identity = (url) => remoteRepository(url, provider, bound, platform);
|
|
357
|
+
const platform = strictSources.get(source.url) ?? platformFor(source, bound);
|
|
358
|
+
const sourceProvider = remoteProvider(isCheckmarxSource?.(source.url));
|
|
359
|
+
const identity = (url, fallbackHost) => remoteRepository(url, sourceProvider, bound, platform, fallbackHost);
|
|
324
360
|
const targets = comparable.flatMap((remote) => identity(remote) ?? []);
|
|
325
361
|
const target = identity(source.url);
|
|
326
362
|
if (target && targets.some((remote) => matchingRemote(remote, target)))
|
|
@@ -328,8 +364,7 @@ async function requireMatchingRepository(repository, provider, sources, strictSo
|
|
|
328
364
|
allSourcesMatched = false;
|
|
329
365
|
// A custom SSH upstream can agree with a manual mapping even when a
|
|
330
366
|
// recognized HTTPS remote points at a fork. It cannot prove a Cloud binding.
|
|
331
|
-
const configured = unverified.flatMap((remote) =>
|
|
332
|
-
[]);
|
|
367
|
+
const configured = unverified.flatMap((remote) => identity(remote, possibleSshHost) ?? []);
|
|
333
368
|
if (target && configured.some((remote) => matchingRemote(remote, target)))
|
|
334
369
|
continue;
|
|
335
370
|
if (targets.length || configured.length)
|
|
@@ -338,27 +373,34 @@ async function requireMatchingRepository(repository, provider, sources, strictSo
|
|
|
338
373
|
return allSourcesMatched;
|
|
339
374
|
}
|
|
340
375
|
export function sonarCheckoutMatchesSource(repository, url, protectedRoots, environment, signal) {
|
|
341
|
-
return requireMatchingRepository(repository, "sonar", [{ url }], new Map(), () => "sonar", [...protectedRoots], environment, signal);
|
|
376
|
+
return requireMatchingRepository(repository, "sonar", [{ url }], new Map(), [], () => "sonar", undefined, [...protectedRoots], environment, signal);
|
|
342
377
|
}
|
|
378
|
+
/** @internal Resolve and protect the local checkout and workbench state directory. */
|
|
343
379
|
async function localContext(selectedRepository, dependencies, mode = "import") {
|
|
344
380
|
dependencies.signal?.throwIfAborted();
|
|
345
|
-
const
|
|
346
|
-
const
|
|
347
|
-
|
|
348
|
-
requireExternalImports(environment);
|
|
349
|
-
const path = expandHome(selectedRepository, environment);
|
|
381
|
+
const environment = workbenchEnvironment(dependencies.environment ?? process.env);
|
|
382
|
+
const requested = resolveInputPath(selectedRepository, process.cwd(), environment);
|
|
383
|
+
const path = await abortable(() => resolveParentTraversal(requested), dependencies.signal);
|
|
350
384
|
const repository = mode === "read"
|
|
351
385
|
? await abortable(() => canonicalConfigPath(path), dependencies.signal)
|
|
352
386
|
: await normalizeRepository(path, dependencies.signal);
|
|
387
|
+
const lexicalPath = resolve(requested);
|
|
388
|
+
const lexicalRepository = lexicalPath === resolve(path)
|
|
389
|
+
? repository
|
|
390
|
+
: await abortable(() => canonicalConfigPath(lexicalPath), dependencies.signal);
|
|
353
391
|
const protectedRoot = [
|
|
354
392
|
...new Set([
|
|
355
393
|
repository,
|
|
356
|
-
...(
|
|
394
|
+
...(mode === "read" ? [lexicalRepository] : []),
|
|
395
|
+
...(await abortable(() => commandGitProtectionRoots(path, environment, dependencies.signal, {
|
|
396
|
+
requestedPaths: [lexicalPath, lexicalRepository],
|
|
397
|
+
}), dependencies.signal)),
|
|
357
398
|
]),
|
|
358
399
|
];
|
|
359
400
|
requireOutputOutsideRepositories(protectedRoot, await abortable(() => canonicalizeModelSafePath(environment.CODEX_SECURITY_STATE_DIR), dependencies.signal), "runtime");
|
|
360
401
|
return {
|
|
361
402
|
repository,
|
|
403
|
+
selectedPath: path,
|
|
362
404
|
options: {
|
|
363
405
|
pluginRoot: await abortable(() => bundledPluginRoot(), dependencies.signal),
|
|
364
406
|
environment,
|
|
@@ -370,23 +412,95 @@ async function localContext(selectedRepository, dependencies, mode = "import") {
|
|
|
370
412
|
}
|
|
371
413
|
/** Prepare scanner evidence without writing state or performing a security assessment. */
|
|
372
414
|
export async function prepareNormalizedLocalImport(input, options, dependencies = {}) {
|
|
373
|
-
dependencies
|
|
374
|
-
|
|
375
|
-
|
|
415
|
+
const { signal } = dependencies;
|
|
416
|
+
signal?.throwIfAborted();
|
|
417
|
+
const settings = snapshotImportOptions(options);
|
|
418
|
+
const reader = EXTERNAL_FINDINGS_READERS.find((name) => name === settings.provider);
|
|
419
|
+
if (reader)
|
|
420
|
+
return prepareLocalImport(input, { ...settings, provider: EXTERNAL_FINDINGS_PROVIDERS[reader] }, dependencies);
|
|
421
|
+
const references = snapshotSourceRepositories(dependencies.sourceRepositories);
|
|
422
|
+
requireIdentity(settings.provider, "Provider");
|
|
423
|
+
requireIdentity(settings.sourceKey, "Source key");
|
|
424
|
+
const current = snapshotNormalizedFindings(input, checkStoredNumber);
|
|
425
|
+
validateFindingIds(current);
|
|
426
|
+
if (current.report !== undefined && !isRecord(current.report))
|
|
427
|
+
throw new CodexSecurityError("Report metadata must be an object.");
|
|
428
|
+
if (current.read !== current.findings.length + current.excluded.length)
|
|
429
|
+
throw new CodexSecurityError("Every source record must be accounted for by a finding or exclusion.");
|
|
430
|
+
const positions = new Set();
|
|
431
|
+
for (const { position, source_finding_id, reason } of current.excluded) {
|
|
432
|
+
if (!Number.isSafeInteger(position) ||
|
|
433
|
+
position < 1 ||
|
|
434
|
+
position > current.read ||
|
|
435
|
+
positions.has(position))
|
|
436
|
+
throw new CodexSecurityError("An excluded position must be unique and within the reported record count.");
|
|
437
|
+
positions.add(position);
|
|
438
|
+
requireIdentity(reason, "Exclusion reason");
|
|
439
|
+
if (source_finding_id !== null)
|
|
440
|
+
requireIdentity(source_finding_id, "Excluded source finding id");
|
|
441
|
+
}
|
|
442
|
+
const platform = references.find((ref) => ref.platform)?.platform;
|
|
443
|
+
const urls = new Set(references.map(({ url }) => url));
|
|
444
|
+
if (settings.sourceRepositoryUrl !== undefined)
|
|
445
|
+
urls.add(settings.sourceRepositoryUrl);
|
|
446
|
+
for (const finding of current.findings) {
|
|
447
|
+
finding.evidence = validateExternalEvidence(finding.evidence, "local");
|
|
448
|
+
const repository = finding.evidence.details?.repository;
|
|
449
|
+
if (repository)
|
|
450
|
+
urls.add(repository.url);
|
|
451
|
+
}
|
|
452
|
+
const sources = Array.from(urls, (url) => ({
|
|
453
|
+
url: declaredScannerRepositoryUrl(url, settings.provider, "local"),
|
|
454
|
+
platform,
|
|
455
|
+
}));
|
|
456
|
+
const [source] = sources;
|
|
457
|
+
const context = await localContext(settings.repository, dependencies);
|
|
458
|
+
let matched = false;
|
|
459
|
+
if (source) {
|
|
460
|
+
if (references.some((ref) => ref.platform && ref.platform !== platform) ||
|
|
461
|
+
sources.some(({ url }) => !hostedRepositoryMatches(source, url)))
|
|
462
|
+
throw new CodexSecurityError("The findings declare conflicting source repositories.");
|
|
463
|
+
const remotes = await hostedCheckoutRemotes(context.repository, context.options.protectedRoot, context.options.environment, signal);
|
|
464
|
+
matched =
|
|
465
|
+
remotes?.some((remote) => hostedRepositoryMatches(source, remote)) ??
|
|
466
|
+
false;
|
|
467
|
+
if (!matched &&
|
|
468
|
+
remotes?.some((remote) => /^https?:\/\//iu.test(normalizeHostedGitRepositoryUrl(remote, undefined, platform !== undefined))))
|
|
469
|
+
throw new CodexSecurityError(`Imported repository ${JSON.stringify(source.url)} does not match a configured fetch remote of ${context.repository}.`);
|
|
470
|
+
}
|
|
471
|
+
return preparedLocalStorage(current, settings, context, dependencies, matched, { sourceRepositories: sources });
|
|
472
|
+
}
|
|
473
|
+
// A scanner can repeat the same repository reference for every finding in a run.
|
|
474
|
+
export function distinctSourceRepositories(sources) {
|
|
475
|
+
const seen = new Map();
|
|
476
|
+
return sources.filter(({ url, platform }) => {
|
|
477
|
+
const urls = seen.get(platform) ?? new Set();
|
|
478
|
+
if (urls.has(url))
|
|
479
|
+
return false;
|
|
480
|
+
urls.add(url);
|
|
481
|
+
seen.set(platform, urls);
|
|
482
|
+
return true;
|
|
483
|
+
});
|
|
376
484
|
}
|
|
377
485
|
/** @internal Prepare evidence using settings captured by either local import entrypoint. */
|
|
378
|
-
export async function prepareLocalImport(input, options, dependencies, readerSources = snapshotSourceRepositories(dependencies.sourceRepositories),
|
|
486
|
+
export async function prepareLocalImport(input, options, dependencies, readerSources = distinctSourceRepositories(snapshotSourceRepositories(dependencies.sourceRepositories)), parsedInput, fetchRemotes) {
|
|
379
487
|
requireIdentity(options.sourceKey, "Source key");
|
|
380
|
-
const
|
|
488
|
+
const parsedSources = distinctSourceRepositories(parsedInput ?? []);
|
|
489
|
+
// File readers interpret their source option while parsing. For normalized
|
|
490
|
+
// input the caller declares one repository for the whole selection.
|
|
491
|
+
const normalizedSource = parsedInput === undefined && options.sourceRepositoryUrl !== undefined
|
|
492
|
+
? declaredScannerRepositoryUrl(options.sourceRepositoryUrl, options.provider, "local")
|
|
493
|
+
: undefined;
|
|
494
|
+
const current = snapshotNormalizedFindings(input, checkStoredNumber, "local", options.provider);
|
|
495
|
+
if (options.provider !== "tenable" &&
|
|
496
|
+
(current.report?.["format"] === tenableReportFormat ||
|
|
497
|
+
current.findings.some((row) => row.evidence?.source_data?.["format"] === tenableReportFormat)))
|
|
498
|
+
throw new CodexSecurityError("Retained Tenable evidence requires the tenable provider.");
|
|
499
|
+
checkTrivyReportProvider(options.provider, current.report);
|
|
381
500
|
let dependabotSource;
|
|
382
|
-
|
|
501
|
+
validateFindingIds(current);
|
|
383
502
|
for (const finding of current.findings) {
|
|
384
|
-
|
|
385
|
-
if (identities.has(finding.source_finding_id))
|
|
386
|
-
throw new CodexSecurityError(`Duplicate source finding id ${JSON.stringify(finding.source_finding_id)}.`);
|
|
387
|
-
identities.add(finding.source_finding_id);
|
|
388
|
-
if (!isRecord(finding.evidence))
|
|
389
|
-
throw new CodexSecurityError("Imported evidence must be an object.");
|
|
503
|
+
checkRetainedTrivyProvider(options.provider, finding, "local");
|
|
390
504
|
if (options.provider !== "github")
|
|
391
505
|
continue;
|
|
392
506
|
const native = dependabotRepository(finding);
|
|
@@ -400,15 +514,26 @@ export async function prepareLocalImport(input, options, dependencies, readerSou
|
|
|
400
514
|
throw new CodexSecurityError("Select Dependabot alerts from only one GitHub host and repository.");
|
|
401
515
|
dependabotSource = native;
|
|
402
516
|
}
|
|
403
|
-
const
|
|
517
|
+
const context = await localContext(options.repository, dependencies);
|
|
518
|
+
if (options.provider === "tenable") {
|
|
519
|
+
const source = tenableSourceRepository(current, options.sourceRepositoryUrl, [...readerSources, ...parsedSources]);
|
|
520
|
+
const remotes = await hostedCheckoutRemotes(context.repository, context.options.protectedRoot, context.options.environment, dependencies.signal);
|
|
521
|
+
if (!remotes?.some((remote) => hostedRepositoryMatches(source, remote)))
|
|
522
|
+
throw new CodexSecurityError("Tenable's source repository must match a configured Git fetch remote of the selected checkout.");
|
|
523
|
+
return preparedLocalStorage(current, options, context, dependencies, true, {
|
|
524
|
+
sourceRepositories: [source],
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
const { repository, options: workbenchOptions } = context;
|
|
404
528
|
const sources = new Map();
|
|
405
529
|
const references = [...readerSources, ...parsedSources];
|
|
406
530
|
const inspector = inspectorReportRepository(options.provider, current.findings, "local", options.inspectorProjectMap);
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
|
|
531
|
+
const checkmarx = checkmarxSelection(options.provider, current.findings, current.report, "local");
|
|
532
|
+
const projected = current.findings.filter((finding) => (options.provider !== "blackduck" &&
|
|
533
|
+
projectedBlackDuckRepositoryUrl(finding, "local")) ||
|
|
534
|
+
checkmarx.projections.has(finding));
|
|
410
535
|
const mixed = projected.length > 0 && readerSources.length > 0;
|
|
411
|
-
const nativeSources = new Map((mixed ? current.findings : projected)
|
|
536
|
+
const nativeSources = new Map((mixed || normalizedSource ? current.findings : projected)
|
|
412
537
|
.filter(({ evidence }) => options.provider !== "endor" ||
|
|
413
538
|
isRecord(evidence.source_data?.["runContext"]))
|
|
414
539
|
.map((finding) => [
|
|
@@ -430,6 +555,7 @@ export async function prepareLocalImport(input, options, dependencies, readerSou
|
|
|
430
555
|
const operatorPlatform = localRepositoryPlatform(options.provider, readerSources, true);
|
|
431
556
|
const sameRepositories = (urls) => sameScannerRepositories(Array.from(urls, identify));
|
|
432
557
|
const bound = blackDuckReportRepositories(options.provider, current.findings, "local", sameRepositories);
|
|
558
|
+
const checkmarxRepository = checkmarx.repositories(sameRepositories);
|
|
433
559
|
for (const repositories of [
|
|
434
560
|
veracodeReportRepositories,
|
|
435
561
|
continuumReportRepositories,
|
|
@@ -439,19 +565,107 @@ export async function prepareLocalImport(input, options, dependencies, readerSou
|
|
|
439
565
|
}
|
|
440
566
|
}
|
|
441
567
|
const strictSources = new Map();
|
|
568
|
+
const checkmarxKeys = new Set();
|
|
569
|
+
const hostedSources = new Map();
|
|
570
|
+
const semgrepReportScope = semgrepPlatformReportScope(current, options.provider, readerSources);
|
|
571
|
+
const semgrepPlatformRepositoryUrl = semgrepReportScope?.url;
|
|
572
|
+
function addSemgrepSource(url) {
|
|
573
|
+
if (options.provider !== "semgrep")
|
|
574
|
+
throw new CodexSecurityError("Use the semgrep provider for Semgrep Platform findings.");
|
|
575
|
+
const source = semgrepPlatformRepositoryReference(url, readerSources);
|
|
576
|
+
if (semgrepPlatformRepositoryUrl &&
|
|
577
|
+
semgrepPlatformRepositoryUrl !== url &&
|
|
578
|
+
!semgrepReferenceMatches(source, semgrepPlatformRepositoryUrl))
|
|
579
|
+
throw new CodexSecurityError("The Semgrep report repository does not match the native finding's project.");
|
|
580
|
+
hostedSources.set(source.url, source);
|
|
581
|
+
}
|
|
582
|
+
function addGuardianSource(value) {
|
|
583
|
+
if (options.provider !== "semgrep")
|
|
584
|
+
throw new CodexSecurityError("Use the semgrep provider for Guardian findings.");
|
|
585
|
+
const url = declaredScannerRepositoryUrl(value, "Guardian", "local");
|
|
586
|
+
const source = hostedSources.get(url) ??
|
|
587
|
+
semgrepPlatformRepositoryReference(url, readerSources);
|
|
588
|
+
hostedSources.set(url, source);
|
|
589
|
+
return source;
|
|
590
|
+
}
|
|
591
|
+
const guardianReport = current.report?.["format"] === guardianSelectionFormat
|
|
592
|
+
? addGuardianSource(current.report["repositoryUrl"])
|
|
593
|
+
: undefined;
|
|
594
|
+
if (semgrepPlatformRepositoryUrl)
|
|
595
|
+
addSemgrepSource(semgrepPlatformRepositoryUrl);
|
|
442
596
|
const known = new Set(parsedSources.map(({ url }) => url));
|
|
597
|
+
const hasPlatformEvidence = options.provider === "semgrep" &&
|
|
598
|
+
(semgrepReportScope !== undefined ||
|
|
599
|
+
current.findings.some((row) => isSemgrepPlatformEvidence(row, options.provider)));
|
|
600
|
+
let hasOrdinaryRows = false;
|
|
601
|
+
let ordinaryRowNeedsReferences = false;
|
|
443
602
|
for (const finding of current.findings) {
|
|
444
|
-
const
|
|
445
|
-
const url = evidence.details?.repository?.url;
|
|
446
|
-
if (url)
|
|
447
|
-
sources.set(url, { url });
|
|
448
|
-
const retained = bound.get(id);
|
|
603
|
+
const retained = bound.get(finding.source_finding_id) ?? checkmarxRepository(finding);
|
|
449
604
|
const native = nativeSources.get(finding) ?? [];
|
|
450
|
-
|
|
605
|
+
const sarif = hasPlatformEvidence ||
|
|
606
|
+
(normalizedSource && options.provider === "semgrep")
|
|
607
|
+
? semgrepSarifRepositories(finding)
|
|
608
|
+
: [];
|
|
609
|
+
if (normalizedSource)
|
|
610
|
+
for (const source of sarif)
|
|
611
|
+
known.add(source.url);
|
|
612
|
+
const semgrep = semgrepPlatformFindingBinding(finding, options.provider, readerSources, semgrepReportScope, [retained, ...native, ...sarif]);
|
|
613
|
+
if (semgrep) {
|
|
614
|
+
addSemgrepSource(semgrep.url);
|
|
615
|
+
if (semgrep.sourceData)
|
|
616
|
+
finding.evidence.source_data = semgrep.sourceData;
|
|
617
|
+
if (semgrep.migration)
|
|
618
|
+
Object.assign(finding.evidence, semgrep.migration);
|
|
619
|
+
}
|
|
620
|
+
const { evidence } = finding;
|
|
621
|
+
if (options.provider === "armorcode") {
|
|
622
|
+
const nativeUrl = armorCodeRepositoryUrl(evidence.source_data, "local");
|
|
623
|
+
if (nativeUrl)
|
|
624
|
+
sources.set(nativeUrl, { url: nativeUrl });
|
|
625
|
+
}
|
|
626
|
+
if (options.provider === "github") {
|
|
627
|
+
const source = retainedGitHubRepository(finding, (url) => identify(url).key);
|
|
628
|
+
if (source)
|
|
629
|
+
sources.set(source, { url: source, platform: "github" });
|
|
630
|
+
}
|
|
631
|
+
const guardian = guardianFindingRepository(finding, "local");
|
|
632
|
+
const url = evidence.details?.repository?.url;
|
|
633
|
+
if (guardian) {
|
|
634
|
+
const source = addGuardianSource(guardian);
|
|
635
|
+
if ((guardianReport &&
|
|
636
|
+
!semgrepReferenceMatches(guardianReport, source.url)) ||
|
|
637
|
+
(url &&
|
|
638
|
+
!semgrepReferenceMatches(source, declaredScannerRepositoryUrl(url, "Guardian", "local"))))
|
|
639
|
+
throw new CodexSecurityError("The Guardian finding repository does not match its recorded selection.");
|
|
640
|
+
}
|
|
641
|
+
else if (!semgrep) {
|
|
642
|
+
hasOrdinaryRows = true;
|
|
643
|
+
if (url)
|
|
644
|
+
sources.set(url, { url });
|
|
645
|
+
}
|
|
646
|
+
if (hasPlatformEvidence &&
|
|
647
|
+
!semgrep &&
|
|
648
|
+
!guardian &&
|
|
649
|
+
!retained &&
|
|
650
|
+
!native.length) {
|
|
651
|
+
for (const source of sarif)
|
|
652
|
+
sources.set(source.url, source);
|
|
653
|
+
if (!url && !sarif.length)
|
|
654
|
+
ordinaryRowNeedsReferences = true;
|
|
655
|
+
if (!url && references.length) {
|
|
656
|
+
for (const source of sarif) {
|
|
657
|
+
const claim = identify(source.url);
|
|
658
|
+
if (!references.some((ref) => matchingRemote(claim, identify(ref.url))))
|
|
659
|
+
throw new CodexSecurityError(`The reader must supply the projected Semgrep SARIF repository ${JSON.stringify(source.url)} for the configured remote.`);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
const projectedCheckmarx = checkmarx.projections.has(finding);
|
|
664
|
+
if (retained || (projectedCheckmarx && native.length)) {
|
|
665
|
+
const rowSources = retained ? [retained, ...native] : native;
|
|
451
666
|
const claims = [
|
|
452
|
-
|
|
667
|
+
...rowSources.map((ref) => ref.url),
|
|
453
668
|
...(url ? [url] : []),
|
|
454
|
-
...native.map((ref) => ref.url),
|
|
455
669
|
];
|
|
456
670
|
const rowPlatform = (claim) => options.provider !== "wiz"
|
|
457
671
|
? platformFor({ url: claim })
|
|
@@ -462,9 +676,11 @@ export async function prepareLocalImport(input, options, dependencies, readerSou
|
|
|
462
676
|
key: claim,
|
|
463
677
|
})))
|
|
464
678
|
throw new CodexSecurityError("The retained scanner repository does not match the original provider finding.");
|
|
465
|
-
for (const source of
|
|
679
|
+
for (const source of rowSources)
|
|
466
680
|
sources.set(source.url, source);
|
|
467
681
|
for (const claim of claims) {
|
|
682
|
+
if (projectedCheckmarx)
|
|
683
|
+
checkmarxKeys.add(identify(claim).key);
|
|
468
684
|
const platform = rowPlatform(claim);
|
|
469
685
|
if (!strictSources.has(claim) || platform !== "github")
|
|
470
686
|
strictSources.set(claim, platform);
|
|
@@ -473,12 +689,54 @@ export async function prepareLocalImport(input, options, dependencies, readerSou
|
|
|
473
689
|
for (const source of native)
|
|
474
690
|
known.add(source.url);
|
|
475
691
|
}
|
|
692
|
+
// Match references for native Platform rows using their hosted Git identity.
|
|
693
|
+
const hosted = Array.from(hostedSources.values());
|
|
694
|
+
const hostedReferences = new Set(references.filter((ref) => hosted.some((source) => semgrepReferenceMatches(source, ref.url))));
|
|
695
|
+
const sharedReferences = new Set();
|
|
696
|
+
const ordinaryReferences = new Set();
|
|
697
|
+
if (hostedReferences.size) {
|
|
698
|
+
const readerPlatform = localRepositoryPlatform(options.provider, [...sources.values(), ...references], false);
|
|
699
|
+
const ordinaryIdentity = (url) => remoteRepository(url, options.provider, false, readerPlatform({ url })) ?? { key: url };
|
|
700
|
+
const aliases = references.map((ref) => ({
|
|
701
|
+
ref,
|
|
702
|
+
fetch: identify(ref.url),
|
|
703
|
+
ordinary: ordinaryIdentity(ref.url).key,
|
|
704
|
+
}));
|
|
705
|
+
const claims = Map.groupBy(Array.from(sources.keys(), (url) => ({
|
|
706
|
+
fetch: identify(url),
|
|
707
|
+
ordinary: strictSources.has(url)
|
|
708
|
+
? undefined
|
|
709
|
+
: ordinaryIdentity(url).key,
|
|
710
|
+
})), (claim) => claim.fetch.key);
|
|
711
|
+
for (const [key, refs] of Map.groupBy(aliases, (alias) => alias.fetch.key)) {
|
|
712
|
+
const hosted = refs.filter(({ ref }) => hostedReferences.has(ref));
|
|
713
|
+
const group = claims.get(key);
|
|
714
|
+
if (!hosted.length || !group)
|
|
715
|
+
continue;
|
|
716
|
+
const shared = fetchAliasMatcher(group);
|
|
717
|
+
const readers = fetchAliasMatchers(refs, (alias) => alias.ordinary);
|
|
718
|
+
// Keep a sole fetch alias subject to checkout validation. A redundant
|
|
719
|
+
// Platform spelling can be dropped when another reference serves the reader.
|
|
720
|
+
const required = fetchAliasMatchers(group, ({ fetch, ordinary }) => ordinary !== undefined && readers.get(ordinary)?.(fetch)
|
|
721
|
+
? ordinary
|
|
722
|
+
: undefined);
|
|
723
|
+
for (const alias of hosted) {
|
|
724
|
+
if (!shared(alias.fetch))
|
|
725
|
+
continue;
|
|
726
|
+
sharedReferences.add(alias.ref);
|
|
727
|
+
if (required.get(undefined)?.(alias.fetch) ||
|
|
728
|
+
required.get(alias.ordinary)?.(alias.fetch))
|
|
729
|
+
ordinaryReferences.add(alias.ref);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
}
|
|
476
733
|
if (mixed) {
|
|
477
|
-
//
|
|
734
|
+
// Other caller references must identify an ordinary row or one of its Git aliases.
|
|
478
735
|
const rows = [...sources.keys(), ...known].map(identify);
|
|
479
736
|
const byKey = Map.groupBy(rows, (remote) => remote.key);
|
|
480
737
|
const represented = new Set(rows.map((remote) => JSON.stringify(remote)));
|
|
481
738
|
const aliases = readerSources
|
|
739
|
+
.filter((ref) => !hostedReferences.has(ref) || sharedReferences.has(ref))
|
|
482
740
|
.map(({ url }) => identify(url))
|
|
483
741
|
.filter((remote) => !represented.has(JSON.stringify(remote)));
|
|
484
742
|
for (const [key, group] of Map.groupBy(aliases, (remote) => remote.key)) {
|
|
@@ -490,11 +748,15 @@ export async function prepareLocalImport(input, options, dependencies, readerSou
|
|
|
490
748
|
if (strictSources.size && options.provider !== "blackduck") {
|
|
491
749
|
const keys = new Set(Array.from(strictSources.keys(), (url) => identify(url).key));
|
|
492
750
|
for (const source of references)
|
|
493
|
-
if (!strictSources.has(source.url) &&
|
|
751
|
+
if (!strictSources.has(source.url) &&
|
|
752
|
+
keys.has(identify(source.url).key)) {
|
|
494
753
|
strictSources.set(source.url, platformFor(source));
|
|
754
|
+
if (sharedReferences.has(source))
|
|
755
|
+
ordinaryReferences.add(source);
|
|
756
|
+
}
|
|
495
757
|
}
|
|
496
758
|
if (inspector) {
|
|
497
|
-
const platform = inspector.platform
|
|
759
|
+
const platform = inspector.platform === "github" ? "github" : options.provider;
|
|
498
760
|
const native = remoteRepository(inspector.url, options.provider, true, platform);
|
|
499
761
|
for (const url of sources.keys()) {
|
|
500
762
|
if (!native ||
|
|
@@ -503,11 +765,42 @@ export async function prepareLocalImport(input, options, dependencies, readerSou
|
|
|
503
765
|
throw new CodexSecurityError(`Imported repository ${JSON.stringify(url)} does not match the retained Inspector repository ${JSON.stringify(inspector.url)}.`);
|
|
504
766
|
}
|
|
505
767
|
}
|
|
768
|
+
if (readerSources.length &&
|
|
769
|
+
hosted.length &&
|
|
770
|
+
((!hasOrdinaryRows &&
|
|
771
|
+
!readerSources.every((ref) => hostedReferences.has(ref))) ||
|
|
772
|
+
hosted.some((source) => !readerSources.some((ref) => semgrepReferenceMatches(source, ref.url)))))
|
|
773
|
+
throw new CodexSecurityError("The reader's source repository does not match the selected Semgrep project.");
|
|
506
774
|
for (const source of [...(inspector ? [inspector] : []), ...references]) {
|
|
775
|
+
if (!ordinaryRowNeedsReferences &&
|
|
776
|
+
hostedReferences.has(source) &&
|
|
777
|
+
!ordinaryReferences.has(source))
|
|
778
|
+
continue;
|
|
507
779
|
// A reader's platform must not loosen an operator-supplied Inspector map.
|
|
508
780
|
if (sources.get(source.url)?.platform !== "github")
|
|
509
781
|
sources.set(source.url, options.inspectorProjectMap ? { url: source.url } : source);
|
|
510
782
|
}
|
|
783
|
+
const reportUrl = checkmarx.reportUrl;
|
|
784
|
+
if (reportUrl) {
|
|
785
|
+
const source = sources.get(reportUrl) ?? { url: reportUrl };
|
|
786
|
+
sources.set(reportUrl, source);
|
|
787
|
+
checkmarxKeys.add(identify(reportUrl).key);
|
|
788
|
+
if (!strictSources.has(reportUrl))
|
|
789
|
+
strictSources.set(reportUrl, platformFor(source));
|
|
790
|
+
}
|
|
791
|
+
if (((options.provider === "checkmarx" || reportUrl) &&
|
|
792
|
+
!sameRepositories(sources.keys())) ||
|
|
793
|
+
(reportUrl &&
|
|
794
|
+
hosted.some((source) => !semgrepReferenceMatches(source, reportUrl))))
|
|
795
|
+
throw new Error("The retained Checkmarx report repository does not match the finding repository.");
|
|
796
|
+
if (options.provider === "armorcode") {
|
|
797
|
+
if (options.sourceRepositoryUrl !== undefined) {
|
|
798
|
+
const url = declaredScannerRepositoryUrl(options.sourceRepositoryUrl, "ArmorCode", "local");
|
|
799
|
+
sources.set(url, { url });
|
|
800
|
+
}
|
|
801
|
+
if (!sameRepositories(sources.keys()))
|
|
802
|
+
throw new CodexSecurityError("ArmorCode findings must belong to a single source repository.");
|
|
803
|
+
}
|
|
511
804
|
const sonarSources = sonarRepositoryUrls(options.provider, current.findings, current.report, "local");
|
|
512
805
|
const manualSource = options.provider === "sonar" && options.sourceRepositoryUrl
|
|
513
806
|
? declaredScannerRepositoryUrl(options.sourceRepositoryUrl, "Sonar", "local")
|
|
@@ -531,18 +824,105 @@ export async function prepareLocalImport(input, options, dependencies, readerSou
|
|
|
531
824
|
url: dependabotSource,
|
|
532
825
|
platform: "github",
|
|
533
826
|
});
|
|
827
|
+
const snyk = snykRestImportRepository(current, options.provider, [
|
|
828
|
+
...sources.keys(),
|
|
829
|
+
...(options.sourceRepositoryUrl === undefined
|
|
830
|
+
? []
|
|
831
|
+
: [options.sourceRepositoryUrl]),
|
|
832
|
+
], readerSources, (finding, source) => {
|
|
833
|
+
finding.evidence.source_data = source;
|
|
834
|
+
});
|
|
835
|
+
if (snyk) {
|
|
836
|
+
// Preserve reader display fields while validating their complete native evidence.
|
|
837
|
+
for (const { evidence } of current.findings)
|
|
838
|
+
validateExternalEvidence(structuredClone(evidence), "local");
|
|
839
|
+
}
|
|
840
|
+
else if (options.provider === "snyk" && current.sourceRepositoryUrl) {
|
|
841
|
+
const declared = { url: current.sourceRepositoryUrl };
|
|
842
|
+
const native = current.findings.flatMap((finding) => localFindingRepositories("snyk", finding));
|
|
843
|
+
for (const source of [declared, ...native])
|
|
844
|
+
if (!sources.has(source.url))
|
|
845
|
+
sources.set(source.url, source);
|
|
846
|
+
if (!sameRepositories(sources.keys()))
|
|
847
|
+
throw new CodexSecurityError("The normalized repository does not match the Snyk reader's repository.");
|
|
848
|
+
}
|
|
849
|
+
if (normalizedSource && !snyk) {
|
|
850
|
+
if (!sameRepositories([normalizedSource, ...sources.keys(), ...known]) ||
|
|
851
|
+
hosted.some((source) => !semgrepReferenceMatches(source, normalizedSource)))
|
|
852
|
+
throw new CodexSecurityError("The declared repository does not match the normalized finding source.");
|
|
853
|
+
if (!hosted.length && !sources.size)
|
|
854
|
+
sources.set(normalizedSource, { url: normalizedSource });
|
|
855
|
+
}
|
|
856
|
+
const ordinarySources = [...sources.values()];
|
|
857
|
+
// A reader can identify the VCS for both a hosted project and an ordinary row.
|
|
858
|
+
const loosePlatformFor = localRepositoryPlatform(options.provider, [...ordinarySources, ...hostedReferences], false);
|
|
534
859
|
const selected = manualSource ? new URL(manualSource) : undefined;
|
|
535
|
-
const matchesRepositoryRemote =
|
|
860
|
+
const matchesRepositoryRemote = options.provider === "trivy"
|
|
861
|
+
? await matchTrivyCheckout(repository, current, references, workbenchOptions)
|
|
862
|
+
: await requireMatchingRepository(repository, options.provider, ordinarySources, strictSources, hosted, (source, bound) => bound ? platformFor(source) : loosePlatformFor(source), snyk, workbenchOptions.protectedRoot, workbenchOptions.environment, dependencies.signal, selected?.protocol === "https:" ? selected.hostname : undefined, fetchRemotes, checkmarx.projections.size
|
|
863
|
+
? (url) => checkmarxKeys.has(identify(url).key)
|
|
864
|
+
: undefined);
|
|
865
|
+
let storedSources = [...references, ...ordinarySources, ...hosted];
|
|
866
|
+
const [project] = hosted;
|
|
867
|
+
if (options.provider === "semgrep" &&
|
|
868
|
+
!hasOrdinaryRows &&
|
|
869
|
+
!ordinarySources.length &&
|
|
870
|
+
hosted.length === 1 &&
|
|
871
|
+
project &&
|
|
872
|
+
references.every(({ url }) => url === project.url)) {
|
|
873
|
+
// A typed hint and a bare URL can be two witnesses for the same native
|
|
874
|
+
// project. Keep the hint if any stored occurrence needs it to verify its scope.
|
|
875
|
+
storedSources = [project];
|
|
876
|
+
const native = semgrepPlatformRepositoryReference(project.url, []);
|
|
877
|
+
if (native.platform !== project.platform) {
|
|
878
|
+
try {
|
|
879
|
+
if (current.findings.every((finding) => {
|
|
880
|
+
const binding = semgrepPlatformFindingBinding(finding, "semgrep", [
|
|
881
|
+
native,
|
|
882
|
+
]);
|
|
883
|
+
return (binding?.url === native.url &&
|
|
884
|
+
!binding.migration &&
|
|
885
|
+
isDeepStrictEqual(binding.sourceData, finding.evidence.source_data));
|
|
886
|
+
}))
|
|
887
|
+
storedSources = [native];
|
|
888
|
+
}
|
|
889
|
+
catch {
|
|
890
|
+
// A private SCM alias or SSH mapping can require the reader's platform.
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
if (snyk)
|
|
895
|
+
storedSources.push({
|
|
896
|
+
url: snyk.url,
|
|
897
|
+
platform: snyk.platform === "github"
|
|
898
|
+
? "github"
|
|
899
|
+
: snyk.gitlab
|
|
900
|
+
? "gitlab"
|
|
901
|
+
: undefined,
|
|
902
|
+
});
|
|
903
|
+
return preparedLocalStorage(current, options, context, dependencies, matchesRepositoryRemote, {
|
|
904
|
+
sourceRepositories: distinctSourceRepositories(storedSources),
|
|
905
|
+
inspectorProjectMap: options.inspectorProjectMap
|
|
906
|
+
? [...options.inspectorProjectMap]
|
|
907
|
+
: undefined,
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
/** @internal Prepare the transactional write after validating the report and repository. */
|
|
911
|
+
function preparedLocalStorage(current, { provider, sourceKey }, { repository, options: workbenchOptions, }, dependencies, matchesRepositoryRemote, provenance) {
|
|
536
912
|
dependencies.signal?.throwIfAborted();
|
|
537
913
|
const preview = {
|
|
538
914
|
...cloneImportPreview(current),
|
|
539
915
|
repository,
|
|
540
|
-
source: { provider
|
|
916
|
+
source: { provider, source_key: sourceKey },
|
|
541
917
|
};
|
|
542
918
|
const payload = JSON.stringify({
|
|
543
919
|
repository,
|
|
544
|
-
provider
|
|
545
|
-
sourceKey
|
|
920
|
+
provider,
|
|
921
|
+
sourceKey,
|
|
922
|
+
read: current.read,
|
|
923
|
+
excluded: current.excluded,
|
|
924
|
+
report: reportForJson(current.report),
|
|
925
|
+
provenance,
|
|
546
926
|
findings: current.findings.map(({ source_finding_id, evidence }) => ({
|
|
547
927
|
source_finding_id,
|
|
548
928
|
evidence,
|
|
@@ -553,6 +933,25 @@ export async function prepareLocalImport(input, options, dependencies, readerSou
|
|
|
553
933
|
preview,
|
|
554
934
|
async import() {
|
|
555
935
|
dependencies.signal?.throwIfAborted();
|
|
936
|
+
const disposition = externalImportDisposition(current);
|
|
937
|
+
if (disposition === "failed")
|
|
938
|
+
throw new NoPublishableFindingsError(cloneImportPreview(current));
|
|
939
|
+
const summary = {
|
|
940
|
+
repository,
|
|
941
|
+
read: current.read,
|
|
942
|
+
...(current.report === undefined
|
|
943
|
+
? {}
|
|
944
|
+
: snapshotNormalizedFindings({ report: current.report })),
|
|
945
|
+
ready: current.findings.length,
|
|
946
|
+
excluded: structuredClone(current.excluded),
|
|
947
|
+
};
|
|
948
|
+
if (disposition !== "ready") {
|
|
949
|
+
return {
|
|
950
|
+
...summary,
|
|
951
|
+
findings: [],
|
|
952
|
+
counts: { created: 0, updated: 0, unchanged: 0 },
|
|
953
|
+
};
|
|
954
|
+
}
|
|
556
955
|
const protectedRoot = [
|
|
557
956
|
...new Set([
|
|
558
957
|
...workbenchOptions.protectedRoot,
|
|
@@ -565,13 +964,8 @@ export async function prepareLocalImport(input, options, dependencies, readerSou
|
|
|
565
964
|
return (dependencies.runWorkbench ?? runWorkbench)({ ...workbenchOptions, protectedRoot }, ["store-external-findings"], payload);
|
|
566
965
|
}, dependencies.signal);
|
|
567
966
|
return {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
...(current.report === undefined
|
|
571
|
-
? {}
|
|
572
|
-
: snapshotNormalizedFindings({ report: current.report })),
|
|
573
|
-
ready: current.findings.length,
|
|
574
|
-
excluded: structuredClone(current.excluded),
|
|
967
|
+
...summary,
|
|
968
|
+
importId: result["importId"],
|
|
575
969
|
findings: result["findings"],
|
|
576
970
|
counts: result["counts"],
|
|
577
971
|
};
|
|
@@ -580,15 +974,50 @@ export async function prepareLocalImport(input, options, dependencies, readerSou
|
|
|
580
974
|
}
|
|
581
975
|
/** Read imported source records, including evidence that has not been assessed by Codex. */
|
|
582
976
|
export async function listLocalExternalFindings(selection, dependencies = {}) {
|
|
977
|
+
return (await readLocalExternalFindings(selection, dependencies)).findings;
|
|
978
|
+
}
|
|
979
|
+
export async function readLocalExternalFindings(selection, dependencies) {
|
|
583
980
|
dependencies.signal?.throwIfAborted();
|
|
584
|
-
requireExternalImports(dependencies.environment);
|
|
585
981
|
if (selection.id !== undefined)
|
|
586
982
|
requireIdentity(selection.id, "Finding id");
|
|
587
|
-
const {
|
|
983
|
+
const { selectedPath, result } = await runLocalFindingWorkbench(selection.repository, "read-external-findings", { id: selection.id }, dependencies);
|
|
984
|
+
return {
|
|
985
|
+
repository: selectedPath,
|
|
986
|
+
findings: result["findings"],
|
|
987
|
+
};
|
|
988
|
+
}
|
|
989
|
+
/** Read the precise versions selected by the caller or captured by an earlier import. */
|
|
990
|
+
export async function selectLocalExternalFindings(selection, dependencies = {}) {
|
|
991
|
+
const { repository, importId, findings } = selection;
|
|
992
|
+
if ((importId === undefined) === (findings === undefined))
|
|
993
|
+
throw new CodexSecurityError("Select one import ID or a list of versioned findings.");
|
|
994
|
+
const { result } = await runLocalFindingWorkbench(repository, "read-external-findings", importId !== undefined
|
|
995
|
+
? { importId, ifCurrent: selection.ifCurrent }
|
|
996
|
+
: { findings: findings.map(({ id, version }) => ({ id, version })) }, dependencies);
|
|
997
|
+
return result;
|
|
998
|
+
}
|
|
999
|
+
/** List this checkout's nonempty imports, most recent first. */
|
|
1000
|
+
export async function listLocalExternalImports({ repository }, dependencies = {}) {
|
|
1001
|
+
const { result } = await runLocalFindingWorkbench(repository, "list-external-imports", {}, dependencies);
|
|
1002
|
+
return result["imports"];
|
|
1003
|
+
}
|
|
1004
|
+
/** @internal Attach Cloud acknowledgements to the versions that were submitted. */
|
|
1005
|
+
export async function recordExternalFindingPublications(input, dependencies = {}) {
|
|
1006
|
+
const { repository, ...receipt } = input;
|
|
1007
|
+
await runLocalFindingWorkbench(repository, "record-external-finding-publications", receipt, dependencies);
|
|
1008
|
+
}
|
|
1009
|
+
/** Read the destination and receipt for each acknowledged finding version. */
|
|
1010
|
+
export async function listLocalFindingPublications({ repository, id }, dependencies = {}) {
|
|
1011
|
+
const { result } = await runLocalFindingWorkbench(repository, "list-external-finding-publications", { id }, dependencies);
|
|
1012
|
+
return result["publications"];
|
|
1013
|
+
}
|
|
1014
|
+
/** @internal Run a command against the workbench for the selected checkout. */
|
|
1015
|
+
async function runLocalFindingWorkbench(path, command, selection, dependencies) {
|
|
1016
|
+
const { repository, selectedPath, options } = await localContext(path, dependencies, "read");
|
|
588
1017
|
const result = await abortable(() => {
|
|
589
1018
|
dependencies.signal?.throwIfAborted();
|
|
590
|
-
return (dependencies.runWorkbench ?? runWorkbench)(options, [
|
|
1019
|
+
return (dependencies.runWorkbench ?? runWorkbench)(options, [command], JSON.stringify({ repository, ...selection }));
|
|
591
1020
|
}, dependencies.signal);
|
|
592
|
-
return result
|
|
1021
|
+
return { selectedPath, result };
|
|
593
1022
|
}
|
|
594
1023
|
//# sourceMappingURL=external-findings-local.js.map
|