@openai/codex-security 0.8.2 → 0.9.1
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 +201 -178
- package/_bundled_plugin/.app.json +4 -0
- package/_bundled_plugin/.mcp.json +6 -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 +51 -14
- 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/core-scan.md +14 -5
- package/_bundled_plugin/references/default-severity-rubric.md +33 -0
- package/_bundled_plugin/references/final-report.md +5 -3
- package/_bundled_plugin/references/finding-detail-fields.md +19 -18
- 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/threat-model.md +1 -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 +188 -454
- package/_bundled_plugin/scripts/filesystem_identity.py +1 -0
- package/_bundled_plugin/scripts/finalize_scan_contract.py +317 -377
- package/_bundled_plugin/scripts/finding_preview.py +25 -29
- package/_bundled_plugin/scripts/launch_codex_security_mcp +1 -0
- package/_bundled_plugin/scripts/legacy_findings.py +148 -0
- package/_bundled_plugin/scripts/posix_scan_local_files.py +198 -0
- package/_bundled_plugin/scripts/read_codex_session.mjs +21 -0
- package/_bundled_plugin/scripts/report_projection.py +167 -178
- 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 +1 -0
- package/_bundled_plugin/scripts/threat_model_projection.py +22 -26
- package/_bundled_plugin/scripts/validate_scan_contract.py +9 -7
- package/_bundled_plugin/scripts/windows_scan_local_files.py +600 -72
- package/_bundled_plugin/scripts/workbench/__init__.py +1 -1
- package/_bundled_plugin/scripts/workbench/handoff.py +47 -0
- package/_bundled_plugin/scripts/workbench/retained_coverage.py +38 -75
- 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 +152 -248
- 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 +71 -7
- package/_bundled_plugin/scripts/workbench_cli.py +121 -14
- package/_bundled_plugin/scripts/workbench_constants.py +19 -0
- package/_bundled_plugin/scripts/workbench_coverage_receipts.py +3 -3
- package/_bundled_plugin/scripts/workbench_db.py +550 -492
- package/_bundled_plugin/scripts/workbench_feedback.py +8 -7
- package/_bundled_plugin/scripts/workbench_finding_index.py +1 -0
- package/_bundled_plugin/scripts/workbench_finding_workflows.py +90 -4
- package/_bundled_plugin/scripts/workbench_native_indexes.py +29 -33
- package/_bundled_plugin/scripts/workbench_progress.py +10 -1
- package/_bundled_plugin/scripts/workbench_publication.py +14 -10
- package/_bundled_plugin/scripts/workbench_remediation.py +508 -11
- package/_bundled_plugin/scripts/workbench_saved_results.py +132 -77
- package/_bundled_plugin/scripts/workbench_scan_history.py +139 -80
- package/_bundled_plugin/scripts/workbench_scan_start.py +84 -25
- package/_bundled_plugin/scripts/workbench_scan_usage.py +666 -117
- package/_bundled_plugin/scripts/workbench_schema.py +44 -55
- package/_bundled_plugin/scripts/workbench_setup.py +251 -0
- package/_bundled_plugin/scripts/workbench_source_excerpt.py +13 -0
- package/_bundled_plugin/scripts/workbench_source_scopes.py +33 -23
- package/_bundled_plugin/scripts/workbench_target.py +330 -66
- package/_bundled_plugin/scripts/workbench_target_state.py +3 -0
- package/_bundled_plugin/scripts/workbench_validation.py +44 -12
- package/_bundled_plugin/shared/workbench-history-repairs.json +19 -16
- package/_bundled_plugin/shared/workbench-migrations.json +53 -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 +6 -4
- package/_bundled_plugin/skills/deep-security-scan/SKILL.md +7 -50
- package/_bundled_plugin/skills/fix-finding/SKILL.md +19 -2
- package/_bundled_plugin/skills/publish-findings/SKILL.md +81 -45
- package/_bundled_plugin/skills/publish-findings/references/checkmarx-import.md +37 -0
- package/_bundled_plugin/skills/publish-findings/references/wiz-import.md +5 -24
- package/_bundled_plugin/skills/publish-findings/scripts/collect_checkmarx.py +464 -0
- package/_bundled_plugin/skills/threat-model-visualize/scripts/build_explorer.py +36 -9
- 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 +12 -6
- package/dist/api.d.ts +45 -5
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +1144 -411
- package/dist/api.js.map +1 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +10 -7
- package/dist/auth.js.map +1 -1
- 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 +8 -0
- package/dist/blackduck-findings.d.ts.map +1 -0
- package/dist/blackduck-findings.js +320 -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/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-severity-records.d.ts +6 -9
- package/dist/classify-severity-records.d.ts.map +1 -1
- package/dist/classify-severity-records.js +9 -21
- 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 +30 -13
- package/dist/classify-severity.js.map +1 -1
- package/dist/cli.d.ts +14 -5
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2112 -1266
- package/dist/cli.js.map +1 -1
- package/dist/cloud-publish.js +2 -2
- package/dist/cloud-publish.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 +16 -3
- package/dist/component-scan.d.ts.map +1 -1
- package/dist/component-scan.js +32 -6
- 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 +221 -65
- 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 +225 -0
- package/dist/continuum-findings.js.map +1 -0
- package/dist/contract-values.d.ts +30 -0
- package/dist/contract-values.d.ts.map +1 -0
- package/dist/contract-values.js +78 -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 +13 -1
- package/dist/cost-model.d.ts.map +1 -1
- package/dist/cost-model.js +66 -115
- package/dist/cost-model.js.map +1 -1
- package/dist/cost.d.ts +61 -4
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +2560 -100
- 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 +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 +4 -0
- 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 +11 -4
- 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 +2 -2
- package/dist/deduplication/local.d.ts.map +1 -1
- package/dist/deduplication/local.js +5 -10
- package/dist/deduplication/local.js.map +1 -1
- package/dist/deduplication/records.d.ts +8 -2
- package/dist/deduplication/records.d.ts.map +1 -1
- package/dist/deduplication/records.js +36 -8
- package/dist/deduplication/records.js.map +1 -1
- package/dist/deduplication/refusal.d.ts.map +1 -1
- package/dist/deduplication/refusal.js +25 -5
- package/dist/deduplication/refusal.js.map +1 -1
- package/dist/deduplication/scan.d.ts +3 -0
- package/dist/deduplication/scan.d.ts.map +1 -1
- package/dist/deduplication/scan.js +1 -1
- 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 +13 -0
- package/dist/deep-scan.d.ts.map +1 -1
- package/dist/deep-scan.js +262 -7
- 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 +3 -1
- package/dist/endor-findings.d.ts.map +1 -1
- package/dist/endor-findings.js +108 -80
- package/dist/endor-findings.js.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +9 -2
- package/dist/errors.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 +11 -16
- package/dist/external-findings-import.js.map +1 -1
- package/dist/external-findings-local.d.ts +15 -4
- package/dist/external-findings-local.d.ts.map +1 -1
- package/dist/external-findings-local.js +619 -225
- package/dist/external-findings-local.js.map +1 -1
- package/dist/external-findings-publish.d.ts +20 -6
- package/dist/external-findings-publish.d.ts.map +1 -1
- package/dist/external-findings-publish.js +2356 -308
- package/dist/external-findings-publish.js.map +1 -1
- package/dist/external-findings-read.d.ts +28 -2
- package/dist/external-findings-read.d.ts.map +1 -1
- package/dist/external-findings-read.js +174 -81
- package/dist/external-findings-read.js.map +1 -1
- package/dist/external-findings.d.ts +17 -3
- package/dist/external-findings.d.ts.map +1 -1
- package/dist/external-findings.js +153 -1
- package/dist/external-findings.js.map +1 -1
- package/dist/external-import-contract.d.ts +33 -1
- package/dist/external-import-contract.d.ts.map +1 -1
- package/dist/external-import-contract.js +335 -51
- 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/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/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/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 -31
- package/dist/github-advisories.js.map +1 -1
- package/dist/github-dependabot-findings.d.ts.map +1 -1
- package/dist/github-dependabot-findings.js +22 -20
- 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 +392 -79
- 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 +2 -2
- package/dist/host-protocol.d.ts.map +1 -1
- 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-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-scan-protocol.js +2 -2
- package/dist/hosted-scan-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 +71 -44
- 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/hosted-scanner-v1.d.ts +6 -0
- package/dist/hosted-scanner-v1.d.ts.map +1 -0
- package/dist/hosted-scanner-v1.js +60 -0
- package/dist/hosted-scanner-v1.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 +24 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/inspector-findings.d.ts.map +1 -1
- package/dist/inspector-findings.js +58 -81
- package/dist/inspector-findings.js.map +1 -1
- package/dist/knowledge-base.d.ts.map +1 -1
- package/dist/knowledge-base.js +86 -10
- 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 +130 -0
- package/dist/local-git-metadata.js.map +1 -0
- package/dist/multiscan.d.ts +6 -4
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +160 -77
- 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 +1 -0
- package/dist/opengrep-findings.d.ts.map +1 -1
- package/dist/opengrep-findings.js +49 -31
- 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/patch-tui.d.ts.map +1 -1
- package/dist/patch-tui.js +90 -35
- package/dist/patch-tui.js.map +1 -1
- 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 +341 -0
- package/dist/private-finding-import.d.ts.map +1 -0
- package/dist/private-finding-import.js +411 -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 +11 -3
- package/dist/provider-profile.d.ts.map +1 -1
- package/dist/provider-profile.js +80 -11
- 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.js +7 -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/reader-selection.d.ts +15 -0
- package/dist/reader-selection.d.ts.map +1 -0
- package/dist/reader-selection.js +89 -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 +3 -1
- package/dist/remediation.d.ts.map +1 -1
- package/dist/remediation.js +28 -2
- 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 +6 -0
- package/dist/result.d.ts.map +1 -1
- package/dist/result.js +3 -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 +22 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +408 -162
- package/dist/runtime.js.map +1 -1
- package/dist/saved-scan-bootstrap.d.ts +1 -0
- package/dist/saved-scan-bootstrap.d.ts.map +1 -1
- package/dist/saved-scan-bootstrap.js +18 -15
- package/dist/saved-scan-bootstrap.js.map +1 -1
- package/dist/scan-activity.d.ts.map +1 -1
- package/dist/scan-activity.js +172 -64
- package/dist/scan-activity.js.map +1 -1
- package/dist/scan-comparison.d.ts +10 -5
- package/dist/scan-comparison.d.ts.map +1 -1
- package/dist/scan-comparison.js +68 -25
- 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 +91 -79
- package/dist/scan-dashboard.js.map +1 -1
- package/dist/scan-executor.d.ts +12 -1
- package/dist/scan-executor.d.ts.map +1 -1
- package/dist/scan-executor.js +22 -2
- package/dist/scan-executor.js.map +1 -1
- package/dist/scan-history-renderer.d.ts.map +1 -1
- package/dist/scan-history-renderer.js +31 -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 +106 -77
- 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 +64 -6
- package/dist/scanner-import.d.ts.map +1 -1
- package/dist/scanner-import.js +406 -48
- package/dist/scanner-import.js.map +1 -1
- package/dist/scanner-repository-url.d.ts +17 -0
- package/dist/scanner-repository-url.d.ts.map +1 -0
- package/dist/scanner-repository-url.js +71 -0
- package/dist/scanner-repository-url.js.map +1 -0
- package/dist/security-policy.d.ts +1 -1
- package/dist/security-policy.d.ts.map +1 -1
- 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 +124 -88
- 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 +213 -0
- package/dist/semgrep-platform-findings.d.ts.map +1 -0
- package/dist/semgrep-platform-findings.js +1078 -0
- package/dist/semgrep-platform-findings.js.map +1 -0
- package/dist/semgrep-platform-v1.d.ts +6 -0
- package/dist/semgrep-platform-v1.d.ts.map +1 -0
- package/dist/semgrep-platform-v1.js +83 -0
- package/dist/semgrep-platform-v1.js.map +1 -0
- 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/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/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 +7 -2
- package/dist/snyk-findings.d.ts.map +1 -1
- package/dist/snyk-findings.js +108 -84
- package/dist/snyk-findings.js.map +1 -1
- package/dist/snyk-rest-findings.d.ts +76 -0
- package/dist/snyk-rest-findings.d.ts.map +1 -0
- package/dist/snyk-rest-findings.js +1051 -0
- package/dist/snyk-rest-findings.js.map +1 -0
- package/dist/snyk-rest-v1.d.ts +28 -0
- package/dist/snyk-rest-v1.d.ts.map +1 -0
- package/dist/snyk-rest-v1.js +132 -0
- package/dist/snyk-rest-v1.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 +16 -0
- package/dist/sonar-collector.d.ts.map +1 -0
- package/dist/sonar-collector.js +380 -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 +277 -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/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 +5 -0
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +73 -31
- package/dist/targets.js.map +1 -1
- package/dist/tenable-findings.d.ts +9 -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-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/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 +435 -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/validation-records.d.ts +0 -3
- package/dist/validation-records.d.ts.map +1 -1
- package/dist/validation-records.js +1 -17
- package/dist/validation-records.js.map +1 -1
- package/dist/veracode-findings.d.ts +9 -0
- package/dist/veracode-findings.d.ts.map +1 -0
- package/dist/veracode-findings.js +409 -0
- package/dist/veracode-findings.js.map +1 -0
- 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 +27 -1
- 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 +14 -2
- package/dist/wiz-findings.d.ts.map +1 -1
- package/dist/wiz-findings.js +143 -50
- package/dist/wiz-findings.js.map +1 -1
- package/docs/classify-severity-records.md +28 -13
- package/docs/cli.md +623 -843
- package/docs/dedupe-records.md +54 -24
- package/docs/findings-service.md +87 -47
- package/docs/hosted-remediation.md +14 -7
- package/docs/hosted-scans.md +64 -41
- package/docs/telemetry.md +236 -0
- package/docs/validate-records.md +78 -44
- package/package.json +19 -17
- package/schemas/external-findings.schema.json +14 -1
- package/schemas/hosted-scan-v2.fixture.json +16 -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/_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 -49
- package/dist/deduplication/records-protocol.js.map +0 -1
- 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 -120
- package/dist/finding-normalization.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-findings-local.js","sourceRoot":"","sources":["../src/external-findings-local.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,qBAAqB,GAGtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,+BAA+B,CAAC;AAKvC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;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,IAAI,SAAS,CAAC,EAAE,KAAK,SAAS;QAAE,eAAe,CAAC,SAAS,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC;IAC5E,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,MAAM,YAAY,CAChD,SAAS,CAAC,UAAU,EACpB,YAAY,EACZ,MAAM,CACP,CAAC;IACF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE;QAClC,YAAY,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;QACtC,OAAO,CAAC,YAAY,CAAC,YAAY,IAAI,YAAY,CAAC,CAChD,OAAO,EACP,CAAC,wBAAwB,CAAC,EAC1B,IAAI,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,CACjD,CAAC;IACJ,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC,UAAU,CAAuC,CAAC;AAClE,CAAC","sourcesContent":["import { lstat, readFile, realpath, stat } from \"node:fs/promises\";\nimport { dirname, isAbsolute, join, resolve, sep } from \"node:path\";\nimport { isNumberObject } from \"node:util/types\";\nimport { environmentEntry } from \"./auth.js\";\nimport { CodexSecurityError } from \"./errors.js\";\nimport {\n forwardExternalImportSetting,\n requireExternalImports,\n} from \"./external-imports-feature.js\";\nimport {\n snapshotImportOptions,\n type ExternalFindings,\n type ExternalSourceRepository,\n} from \"./external-findings.js\";\nimport {\n cloudRepositoryUrlKey,\n repositoryUrlKey,\n validateExternalReport,\n} from \"./external-import-contract.js\";\nimport type {\n ExternalFindingEvidence,\n Provider,\n} from \"./external-import-models.js\";\nimport { isGitHubCloudHost, parseGitRemote } from \"./git-remote.js\";\nimport { inspectorReportRepository } from \"./inspector-findings.js\";\nimport { isRecord } from \"./record.js\";\nimport { dependabotRepository } from \"./github-dependabot-findings.js\";\nimport {\n bundledPluginRoot,\n canonicalConfigPath,\n canonicalizeModelSafePath,\n expandHome,\n requireOutputOutsideRepositories,\n runWorkbench,\n workbenchEnvironment,\n type WorkbenchCommandOptions,\n} from \"./runtime.js\";\nimport {\n abortable,\n gitMarkerRoot,\n gitOutput,\n gitProtectionRoots,\n normalizeRepository,\n nullIfMissingPath,\n} from \"./targets.js\";\n\n/** A scanner source record, independent of a Codex assessment or completed scan. */\nexport interface StoredExternalFinding {\n id: string;\n repository: string;\n provider: Provider;\n sourceKey: string;\n sourceFindingId: string;\n evidence: ExternalFindingEvidence;\n assessment: { state: \"not_assessed\" };\n version: number;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface NormalizedLocalImportOptions {\n /** Local checkout or source directory to associate with these records. */\n repository: string;\n provider: Provider;\n /** Stable scanner organization/project/branch namespace across imports. */\n sourceKey: string;\n /** Full Inspector project ARNs mapped to independently verified repository URLs. */\n inspectorProjectMap?: ReadonlyMap<string, string>;\n}\n\nexport interface LocalExternalImportDependencies {\n environment?: NodeJS.ProcessEnv;\n signal?: AbortSignal;\n runWorkbench?: typeof runWorkbench;\n /** Repository references supplied by a reader outside its projected evidence. */\n sourceRepositories?: readonly ExternalSourceRepository[];\n}\n\nexport interface LocalExternalImportPreview extends ExternalFindings {\n repository: string;\n source: { provider: Provider; source_key: string };\n}\n\nexport interface LocalExternalImportResult {\n repository: string;\n read: number;\n report?: ExternalFindings[\"report\"];\n ready: number;\n excluded: ExternalFindings[\"excluded\"];\n findings: StoredExternalFinding[];\n counts: { created: number; updated: number; unchanged: number };\n}\n\nexport interface PreparedLocalExternalImport {\n preview: LocalExternalImportPreview;\n import(): Promise<LocalExternalImportResult>;\n}\n\nfunction requireIdentity(\n value: unknown,\n field: string,\n): asserts value is string {\n if (typeof value !== \"string\" || !value.trim() || value.includes(\"\\0\"))\n throw new CodexSecurityError(\n `${field} must be nonempty and contain no NUL characters.`,\n );\n}\n\nconst gitTransportPorts: Readonly<Record<string, string>> = {\n \"http:\": \"80\",\n \"https:\": \"443\",\n \"ssh:\": \"22\",\n \"git+ssh:\": \"22\",\n \"ssh+git:\": \"22\",\n \"git:\": \"9418\",\n \"ftp:\": \"21\",\n \"ftps:\": \"990\",\n};\n\n/** Compare transport forms without changing retained scanner evidence. */\nfunction remoteRepository(\n value: string,\n provider: Provider,\n bound: boolean,\n): { key: string; account?: string; homeRelative?: boolean } | undefined {\n if (/^[A-Za-z]:[\\\\/]/u.test(value)) return undefined;\n const transport = bound\n ? /^(?:ssh|git\\+ssh|ssh\\+git|git):\\/\\/([^/]*)(.*)$/isu.exec(value)\n : null;\n const authority = transport?.[1];\n const http = bound && /^https?:\\/\\//iu.test(value.trimStart());\n // Git decodes the authority before locating its path. An encoded delimiter\n // cannot prove a match to another spelling through WHATWG URL's hostname.\n if (\n authority &&\n (/%2f|[?#]/iu.test(authority) ||\n authority.slice(authority.lastIndexOf(\"@\") + 1).includes(\"%\"))\n )\n return { key: value };\n let remote;\n try {\n remote = parseGitRemote(value);\n } catch {\n return transport || http ? { key: \"\\0\" + value } : undefined;\n }\n if (!remote || !Object.hasOwn(gitTransportPorts, remote.url.protocol))\n return undefined;\n const { url, path, scpStyle } = remote;\n const ssh = url.protocol.includes(\"ssh\");\n const protocol = url.protocol === \"http:\" ? \"http:\" : \"https:\";\n const githubSshOverHttps =\n ssh &&\n url.hostname.toLowerCase() === \"ssh.github.com\" &&\n url.port === \"443\";\n const hostname = githubSshOverHttps ? \"github.com\" : url.hostname;\n const port =\n githubSshOverHttps || url.port === gitTransportPorts[url.protocol]\n ? \"\"\n : url.port;\n // A GitHub source identifies a case-insensitive repository on custom Enterprise\n // hosts too; other providers can refer to VCS hosts with case-sensitive paths.\n const key = provider === \"github\" ? cloudRepositoryUrlKey : repositoryUrlKey;\n const origin = `${protocol}//${hostname}${port ? `:${port}` : \"\"}/`;\n if (!bound) return { key: key(origin + path) };\n\n if (!ssh && url.protocol !== \"git:\") {\n if (url.protocol === \"http:\" || url.protocol === \"https:\") {\n // libcurl and WHATWG differ on backslashes and encoded dot segments.\n const raw = /^https?:\\/\\/[^/\\\\?#\\s]+(\\/[^\\\\?#]*)?(?:[?#].*)?$/iu.exec(\n value,\n );\n if (!raw || /\\/(?:%2e|\\.%2e|%2e\\.|%2e%2e)(?:\\/|$)/iu.test(raw[1] ?? \"\"))\n return { key: \"\\0\" + value };\n }\n const suffix = /[?#].*$/su.exec(value)?.[0] ?? \"\";\n // HTTP sends the query and omits fragment text from repository requests.\n if (suffix && ![\"http:\", \"https:\"].includes(url.protocol))\n return { key: key(origin + path) + \"\\0\" };\n return {\n key:\n key(origin + path) + suffix.replace(/#.*$/su, \"#\").replace(/\\/$/u, \"\"),\n };\n }\n\n // Git passes the original path (including dot segments, '?' and '#') to upload-pack.\n const literal = (raw: string) => {\n const bytes = Buffer.from(raw).toString(\"latin1\");\n return scpStyle\n ? bytes\n : bytes.replace(/%(?!00)([\\da-f]{2})/giu, (_, hex: string) =>\n String.fromCharCode(parseInt(hex, 16)),\n );\n };\n if (!scpStyle && !transport) return { key: value };\n const gitPath = literal(transport?.[2] ?? path);\n const login = scpStyle\n ? /^([^@/:\\s?#]+)@/u.exec(value)?.[1]\n : /^(.*)@/u.exec(authority ?? \"\")?.[1];\n const homeRelative =\n /^\\/?~(?:\\/|$)/u.test(gitPath) || (scpStyle && !/^[~/]/u.test(gitPath));\n const suffix = /[?#].*$/su.exec(gitPath);\n // Express upload-pack bytes as a URL path for comparison with the HTTP source.\n const name = gitPath\n .slice(0, suffix?.index)\n .replace(/^\\//u, \"\")\n .replace(\n /[%\\x00-\\x20\\x7f-\\xff]/gu,\n (byte) =>\n \"%\" + byte.charCodeAt(0).toString(16).toUpperCase().padStart(2, \"0\"),\n );\n const repository = suffix\n ? key(origin + name + \"?\") +\n \"\\0\" +\n suffix[0].replace(/\\/$/u, \"\").replace(/\\.git$/u, \"\")\n : key(origin + name);\n return {\n key: repository,\n account: ssh && login ? literal(login) : undefined,\n // GitHub serves the same repository path through its SCP and SSH URLs.\n homeRelative:\n ssh && provider !== \"github\" && !isGitHubCloudHost(hostname.toLowerCase())\n ? homeRelative\n : undefined,\n };\n}\n\nasync function bareMetadataRoots(\n repository: string,\n signal?: AbortSignal,\n): Promise<string[]> {\n const roots: string[] = [];\n let directory = repository;\n for (;;) {\n signal?.throwIfAborted();\n const present = async (name: string) =>\n (await abortable(\n () => lstat(join(directory, name)).catch(nullIfMissingPath),\n signal,\n )) !== null;\n // Git also discovers bare repositories and linked metadata without .git.\n const head = await abortable(\n () => lstat(join(directory, \"HEAD\")).catch(nullIfMissingPath),\n signal,\n );\n if (\n (head?.isFile() || head?.isSymbolicLink()) &&\n ((await present(\"commondir\")) ||\n ((await present(\"objects\")) && (await present(\"refs\"))))\n )\n roots.push(directory);\n const parent = dirname(directory);\n if (parent === directory) return roots;\n directory = parent;\n }\n}\n\nasync function metadataPointer(\n path: string,\n prefix: string,\n context: { directory: string; environment: NodeJS.ProcessEnv },\n signal?: AbortSignal,\n): Promise<string | undefined> {\n const metadata = await abortable(\n () => stat(path).catch(nullIfMissingPath),\n signal,\n );\n if (!metadata?.isFile()) return undefined;\n const text = await abortable(() => readFile(path, \"utf8\"), signal);\n if (!text.startsWith(prefix) || (prefix === \"\" && text.length === 0))\n return undefined;\n const payload = text.slice(prefix.length).replace(/[\\r\\n]+$/u, \"\");\n if (prefix !== \"\" && payload.length === 0) return undefined;\n // Git checks emptiness before consuming the path as a NUL-terminated string.\n const value = payload.split(\"\\0\", 1)[0]!;\n // Preserve filesystem traversal through links before '..'.\n let target = isAbsolute(value) ? value : `${dirname(path)}${sep}${value}`;\n if (process.platform === \"win32\") {\n const drive = /^[A-Za-z]:(?![\\\\/])/u.exec(value)?.[0].toUpperCase();\n if (drive !== undefined) {\n const directory =\n context.directory.slice(0, 2).toUpperCase() === drive\n ? context.directory\n : environmentEntry(context.environment, `=${drive}`) || `${drive}\\\\`;\n target = resolve(directory, value.slice(2));\n } else if (isAbsolute(value)) target = resolve(context.directory, value);\n }\n return (\n (await abortable(\n () => realpath(target).catch(nullIfMissingPath),\n signal,\n )) ?? undefined\n );\n}\n\nasync function associatedMetadataRoots(\n directory: string,\n context: { directory: string; environment: NodeJS.ProcessEnv },\n signal?: AbortSignal,\n configurationDirectory?: string,\n): Promise<string[]> {\n const head = await abortable(\n () => lstat(join(directory, \"HEAD\")).catch(nullIfMissingPath),\n signal,\n );\n if (!head || (!head.isFile() && !head.isSymbolicLink())) return [];\n const commonMarker = join(directory, \"commondir\");\n const hasCommon = await abortable(\n () => lstat(commonMarker).catch(nullIfMissingPath),\n signal,\n );\n const common = hasCommon\n ? await metadataPointer(commonMarker, \"\", context, signal)\n : undefined;\n if (hasCommon && common === undefined) return [];\n const storage = common ?? directory;\n for (const name of [\"objects\", \"refs\"]) {\n const metadata = await abortable(\n () => stat(join(storage, name)).catch(nullIfMissingPath),\n signal,\n );\n if (!metadata?.isDirectory()) return [];\n }\n const roots = common === undefined ? [directory] : [directory, common];\n if (\n process.platform === \"win32\" &&\n configurationDirectory !== undefined &&\n configurationDirectory !== context.directory\n ) {\n // Git rereads commondir after changing to the discovered repository root.\n roots.push(\n ...(await associatedMetadataRoots(\n directory,\n {\n ...context,\n directory: await abortable(\n () => canonicalConfigPath(configurationDirectory),\n signal,\n ),\n },\n signal,\n )),\n );\n }\n return roots;\n}\n\nasync function localGitProtectionRoots(\n repository: string,\n environment: NodeJS.ProcessEnv,\n signal?: AbortSignal,\n): Promise<string[]> {\n const roots = new Set(\n await abortable(() => gitProtectionRoots(repository, signal), signal),\n );\n const context = {\n directory: await abortable(() => canonicalConfigPath(repository), signal),\n environment,\n };\n const paths = new Set([resolve(repository), context.directory]);\n for (const path of paths) {\n for (const root of await bareMetadataRoots(path, signal)) {\n roots.add(root);\n for (const associated of await associatedMetadataRoots(\n root,\n context,\n signal,\n root,\n ))\n roots.add(associated);\n }\n let directory = path;\n for (;;) {\n signal?.throwIfAborted();\n const marker = join(directory, \".git\");\n const metadata = await abortable(\n () => stat(marker).catch(nullIfMissingPath),\n signal,\n );\n if (metadata !== null) {\n roots.add(directory);\n const gitDirectory = metadata.isDirectory()\n ? await abortable(() => realpath(marker), signal)\n : await metadataPointer(marker, \"gitdir: \", context, signal);\n if (gitDirectory !== undefined)\n for (const associated of await associatedMetadataRoots(\n gitDirectory,\n context,\n signal,\n directory,\n ))\n roots.add(associated);\n }\n const parent = dirname(directory);\n if (parent === directory) break;\n directory = parent;\n }\n }\n for (const root of [...roots])\n roots.add(await abortable(() => canonicalConfigPath(root), signal));\n return [...roots];\n}\n\nasync function hasGitMetadata(\n repository: string,\n signal?: AbortSignal,\n): Promise<boolean> {\n return (\n (await abortable(\n () => gitMarkerRoot(repository, signal, \"nearest\"),\n signal,\n )) !== null || (await bareMetadataRoots(repository, signal)).length !== 0\n );\n}\n\nasync function requireMatchingRepository(\n repository: string,\n provider: Provider,\n sources: readonly ExternalSourceRepository[],\n protectedRoots: WorkbenchCommandOptions[\"protectedRoot\"],\n environment: WorkbenchCommandOptions[\"environment\"],\n signal?: AbortSignal,\n): Promise<void> {\n if (sources.length === 0) return;\n if (!(await hasGitMetadata(repository, signal))) return;\n const gitProtectedRoots = [\n ...(typeof protectedRoots === \"string\"\n ? [protectedRoots]\n : (protectedRoots ?? [])),\n await abortable(() => canonicalConfigPath(process.cwd()), signal),\n ];\n const readGit = (args: readonly string[]) =>\n abortable(\n () =>\n gitOutput(\n repository,\n args,\n signal,\n { LC_ALL: \"C\" },\n undefined,\n \"utf8\",\n gitProtectedRoots,\n environment,\n ),\n signal,\n );\n let remoteNames: string;\n try {\n remoteNames = await readGit([\"remote\"]);\n } catch (error) {\n signal?.throwIfAborted();\n // A local source directory need not be a Git checkout.\n if (\n error instanceof Error &&\n \"code\" in error &&\n error.code === 128 &&\n \"stderr\" in error &&\n typeof error.stderr === \"string\" &&\n (error.stderr.trimEnd() ===\n \"fatal: not a git repository (or any of the parent directories): .git\" ||\n /^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(\n error.stderr.trimEnd(),\n ))\n )\n return;\n throw error;\n }\n const remotes: string[] = [];\n for (const name of remoteNames.split(/\\r?\\n/u).filter(Boolean)) {\n const urls = await readGit([\"remote\", \"get-url\", \"--all\", \"--\", name]);\n remotes.push(...urls.split(/\\r?\\n/u));\n }\n const identity = (value: string, platform: Provider) =>\n remoteRepository(value, platform, provider === \"inspector\");\n const githubRepositories = new Set(\n sources.flatMap((source) => {\n if (source.platform !== \"github\") return [];\n const key = identity(source.url, \"github\")?.key;\n return key === undefined ? [] : [key];\n }),\n );\n for (const source of sources) {\n const githubKey = identity(source.url, \"github\")?.key;\n const sourceProvider =\n source.platform === \"github\" ||\n (githubKey !== undefined && githubRepositories.has(githubKey))\n ? \"github\"\n : provider;\n const targets = remotes.flatMap(\n (remote) => identity(remote, sourceProvider) ?? [],\n );\n if (!targets.length) continue;\n const target = identity(source.url, sourceProvider);\n if (\n !target ||\n !targets.some(\n ({ key, account, homeRelative }) =>\n key === target.key &&\n (homeRelative === undefined ||\n target.homeRelative === undefined ||\n homeRelative === target.homeRelative) &&\n ((homeRelative === false && target.homeRelative === false) ||\n account === undefined ||\n target.account === undefined ||\n account === target.account),\n )\n )\n throw new CodexSecurityError(\n `Imported repository ${JSON.stringify(source.url)} does not match a configured remote of ${repository}. Select the matching local repository.`,\n );\n }\n}\n\nasync function localContext(\n selectedRepository: string,\n dependencies: LocalExternalImportDependencies,\n mode: \"import\" | \"read\" = \"import\",\n) {\n dependencies.signal?.throwIfAborted();\n const selected = dependencies.environment ?? process.env;\n const environment = workbenchEnvironment(selected);\n forwardExternalImportSetting(selected, environment);\n requireExternalImports(environment);\n const path = expandHome(selectedRepository, environment);\n const repository =\n mode === \"read\"\n ? await abortable(() => canonicalConfigPath(path), dependencies.signal)\n : await normalizeRepository(path, dependencies.signal);\n const protectedRoot = [\n ...new Set([\n repository,\n ...(await abortable(\n () => localGitProtectionRoots(path, environment, dependencies.signal),\n dependencies.signal,\n )),\n ...(await abortable(\n () =>\n localGitProtectionRoots(\n process.cwd(),\n environment,\n dependencies.signal,\n ),\n dependencies.signal,\n )),\n ]),\n ];\n requireOutputOutsideRepositories(\n protectedRoot,\n await abortable(\n () => canonicalizeModelSafePath(environment.CODEX_SECURITY_STATE_DIR),\n dependencies.signal,\n ),\n \"runtime\",\n );\n return {\n repository,\n options: {\n pluginRoot: await abortable(\n () => bundledPluginRoot(),\n dependencies.signal,\n ),\n environment,\n protectedRoot,\n signal: dependencies.signal,\n failureMessage: \"Could not access imported local findings\",\n },\n };\n}\n\n/** Prepare scanner evidence without writing state or performing a security assessment. */\nexport async function prepareNormalizedLocalImport(\n input: ExternalFindings,\n options: NormalizedLocalImportOptions,\n dependencies: LocalExternalImportDependencies = {},\n): Promise<PreparedLocalExternalImport> {\n dependencies.signal?.throwIfAborted();\n requireExternalImports(dependencies.environment);\n return prepareLocalImport(\n input,\n snapshotImportOptions(options),\n dependencies,\n );\n}\n\n/** @internal Prepare evidence using settings captured by either local import entrypoint. */\nexport async function prepareLocalImport(\n input: ExternalFindings,\n options: NormalizedLocalImportOptions,\n dependencies: LocalExternalImportDependencies,\n): Promise<PreparedLocalExternalImport> {\n requireIdentity(options.sourceKey, \"Source key\");\n const current = structuredClone(input);\n validateExternalReport(current.report);\n let dependabotSource: string | undefined;\n const identities = new Set<string>();\n for (const finding of current.findings) {\n requireIdentity(finding.source_finding_id, \"Source finding id\");\n if (identities.has(finding.source_finding_id))\n throw new CodexSecurityError(\n `Duplicate source finding id ${JSON.stringify(finding.source_finding_id)}.`,\n );\n identities.add(finding.source_finding_id);\n if (!isRecord(finding.evidence))\n throw new CodexSecurityError(\"Imported evidence must be an object.\");\n if (options.provider !== \"github\") continue;\n const native = dependabotRepository(finding);\n if (!native) continue;\n const claimed = finding.evidence.details?.repository?.url;\n if (\n claimed &&\n cloudRepositoryUrlKey(claimed) !== cloudRepositoryUrlKey(native)\n )\n throw new CodexSecurityError(\n \"The normalized repository does not match the original Dependabot alert.\",\n );\n if (dependabotSource && dependabotSource !== native)\n throw new CodexSecurityError(\n \"Select Dependabot alerts from only one GitHub host and repository.\",\n );\n dependabotSource = native;\n }\n const { repository, options: workbenchOptions } = await localContext(\n options.repository,\n dependencies,\n );\n const sources = new Map<string, ExternalSourceRepository>();\n for (const finding of current.findings) {\n const url = finding.evidence.details?.repository?.url;\n if (url) sources.set(url, { url });\n }\n const inspector = inspectorReportRepository(\n options.provider,\n current.findings,\n \"local\",\n options.inspectorProjectMap,\n );\n if (inspector) {\n const platform = inspector.platform ?? options.provider;\n const native = remoteRepository(inspector.url, platform, true);\n for (const url of sources.keys()) {\n if (!native || remoteRepository(url, platform, true)?.key !== native.key)\n throw new CodexSecurityError(\n `Imported repository ${JSON.stringify(url)} does not match the retained Inspector repository ${JSON.stringify(inspector.url)}.`,\n );\n }\n }\n for (const source of [\n ...(inspector ? [inspector] : []),\n ...(dependencies.sourceRepositories ?? []),\n ]) {\n // A reader's platform must not loosen an operator-supplied Inspector map.\n if (sources.get(source.url)?.platform !== \"github\")\n sources.set(\n source.url,\n options.inspectorProjectMap ? { url: source.url } : source,\n );\n }\n if (dependabotSource)\n sources.set(dependabotSource, {\n url: dependabotSource,\n platform: \"github\",\n });\n await requireMatchingRepository(\n repository,\n options.provider,\n [...sources.values()],\n workbenchOptions.protectedRoot,\n workbenchOptions.environment,\n dependencies.signal,\n );\n dependencies.signal?.throwIfAborted();\n const preview = {\n ...structuredClone(current),\n repository,\n source: { provider: options.provider, source_key: options.sourceKey },\n };\n const payload = JSON.stringify(\n {\n repository,\n provider: options.provider,\n sourceKey: options.sourceKey,\n findings: current.findings,\n },\n (_key, value: unknown) => {\n if (isNumberObject(value)) value = +value;\n if (typeof value === \"number\" && !Number.isFinite(value))\n throw new TypeError(\n \"Stored finding JSON cannot contain non-finite numbers.\",\n );\n return value;\n },\n );\n return {\n preview,\n async import() {\n dependencies.signal?.throwIfAborted();\n const protectedRoot = [\n ...new Set([\n ...workbenchOptions.protectedRoot,\n ...(await abortable(\n () =>\n localGitProtectionRoots(\n process.cwd(),\n workbenchOptions.environment,\n dependencies.signal,\n ),\n dependencies.signal,\n )),\n ]),\n ];\n requireOutputOutsideRepositories(\n protectedRoot,\n await abortable(\n () =>\n canonicalizeModelSafePath(\n workbenchOptions.environment.CODEX_SECURITY_STATE_DIR,\n ),\n dependencies.signal,\n ),\n \"runtime\",\n );\n const result = await abortable(() => {\n dependencies.signal?.throwIfAborted();\n return (dependencies.runWorkbench ?? runWorkbench)(\n { ...workbenchOptions, protectedRoot },\n [\"store-external-findings\"],\n payload,\n );\n }, dependencies.signal);\n return {\n repository,\n read: current.read,\n ...(current.report === undefined\n ? {}\n : { report: structuredClone(current.report) }),\n ready: current.findings.length,\n excluded: structuredClone(current.excluded),\n findings: result[\"findings\"] as unknown as StoredExternalFinding[],\n counts: result[\"counts\"] as LocalExternalImportResult[\"counts\"],\n };\n },\n };\n}\n\n/** Read imported source records, including evidence that has not been assessed by Codex. */\nexport async function listLocalExternalFindings(\n selection: { repository: string; id?: string },\n dependencies: LocalExternalImportDependencies = {},\n): Promise<StoredExternalFinding[]> {\n dependencies.signal?.throwIfAborted();\n requireExternalImports(dependencies.environment);\n if (selection.id !== undefined) requireIdentity(selection.id, \"Finding id\");\n const { repository, options } = await localContext(\n selection.repository,\n dependencies,\n \"read\",\n );\n const result = await abortable(() => {\n dependencies.signal?.throwIfAborted();\n return (dependencies.runWorkbench ?? runWorkbench)(\n options,\n [\"list-external-findings\"],\n JSON.stringify({ repository, id: selection.id }),\n );\n }, dependencies.signal);\n return result[\"findings\"] as unknown as StoredExternalFinding[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"external-findings-local.js","sourceRoot":"","sources":["../src/external-findings-local.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,6BAA6B,EAC7B,0BAA0B,EAC1B,kCAAkC,EAClC,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EACl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C,IAAI,SAAS,CAAC,EAAE,KAAK,SAAS;QAAE,eAAe,CAAC,SAAS,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC;IAC5E,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,MAAM,YAAY,CAChD,SAAS,CAAC,UAAU,EACpB,YAAY,EACZ,MAAM,CACP,CAAC;IACF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE;QAClC,YAAY,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;QACtC,OAAO,CAAC,YAAY,CAAC,YAAY,IAAI,YAAY,CAAC,CAChD,OAAO,EACP,CAAC,wBAAwB,CAAC,EAC1B,IAAI,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,CACjD,CAAC;IACJ,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC,UAAU,CAAuC,CAAC;AAClE,CAAC","sourcesContent":["import {\n semgrepLegacyRepositoryWitnesses,\n semgrepPlatformFindingBinding,\n semgrepPlatformReportScope,\n semgrepPlatformRepositoryReference,\n isSemgrepPlatformEvidence,\n semgrepReferenceMatches,\n} from \"./semgrep-platform-findings.js\";\nimport {\n gitPathToHttpPath,\n gitServiceHostname,\n isPublicGitHost,\n gitTransportBytes,\n hostedRepositoryMatches,\n} from \"./hosted-git-repository.js\";\nimport {\n checkRetainedTrivyProvider,\n checkTrivyReportProvider,\n matchTrivyCheckout,\n} from \"./trivy-import.js\";\nimport {\n readGitRemoteNames,\n readHostedGitRemotes,\n} from \"./hosted-git-remotes.js\";\nimport { CodexSecurityError } from \"./errors.js\";\nimport {\n externalImportDisposition,\n NoPublishableFindingsError,\n cloneImportPreview,\n snapshotImportOptions,\n snapshotNormalizedFindings,\n snapshotSourceRepositories,\n type ExternalFindings,\n type ExternalSourceRepository,\n} from \"./external-findings.js\";\nimport {\n cloudRepositoryUrlKey,\n requireSafeJsonInteger,\n repositoryUrlKey,\n validateExternalEvidence,\n} from \"./external-import-contract.js\";\nimport type {\n ExternalFindingEvidence,\n Provider,\n} from \"./external-import-models.js\";\nimport {\n localFindingRepositories,\n semgrepSarifRepositories,\n type LocalFindingProvider,\n} from \"./external-findings-read.js\";\nimport {\n tenableReportFormat,\n tenableSourceRepository,\n} from \"./tenable-findings.js\";\nimport {\n guardianFindingRepository,\n guardianSelectionFormat,\n} from \"./semgrep-guardian-findings.js\";\nimport {\n hasGitMetadata,\n localGitProtectionRoots,\n commandGitProtectionRoots,\n} from \"./local-git-metadata.js\";\nimport {\n blackDuckReportRepositories,\n projectedBlackDuckRepositoryUrl,\n} from \"./blackduck-findings.js\";\nimport {\n azureReposHttpsUrl,\n isGitHubCloudHost,\n isGitHubSshOverHttps,\n isGitSsh,\n parseGitRemote,\n} from \"./git-remote.js\";\nimport { checkmarxSelection } from \"./checkmarx-repository.js\";\nimport { continuumReportRepositories } from \"./continuum-findings.js\";\nimport { veracodeReportRepositories } from \"./veracode-findings.js\";\nimport { inspectorReportRepository } from \"./inspector-findings.js\";\nimport { declaredScannerRepositoryUrl } from \"./scanner-repository-url.js\";\nimport { sonarRepositoryUrls } from \"./sonar-findings.js\";\nimport { isRecord } from \"./record.js\";\nimport { dependabotRepository } from \"./github-dependabot-findings.js\";\nimport { retainedGitHubRepository } from \"./github-findings.js\";\nimport {\n type SnykIssuesFindings,\n snykRestImportRepository,\n snykRestCheckoutMatches,\n} from \"./snyk-rest-findings.js\";\nimport {\n bundledPluginRoot,\n canonicalConfigPath,\n canonicalizeModelSafePath,\n expandHome,\n requireOutputOutsideRepositories,\n runWorkbench,\n workbenchEnvironment,\n type WorkbenchCommandOptions,\n} from \"./runtime.js\";\nimport {\n abortable,\n enclosingGitWorktreeRoot,\n gitOutput,\n normalizeRepository,\n} from \"./targets.js\";\n\n/** A scanner source record, independent of a Codex assessment or completed scan. */\nexport interface StoredExternalFinding {\n id: string;\n repository: string;\n provider: LocalFindingProvider;\n sourceKey: string;\n sourceFindingId: string;\n evidence: ExternalFindingEvidence;\n assessment: { state: \"not_assessed\" };\n version: number;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface NormalizedLocalImportOptions {\n /** Local checkout or source directory to associate with these records. */\n repository: string;\n provider: LocalFindingProvider;\n /** Stable scanner organization/project/branch namespace across imports. */\n sourceKey: string;\n /** Verified Git repository URL for readers that bind a finding to a checkout. */\n sourceRepositoryUrl?: string;\n /** Full Inspector project ARNs mapped to independently verified repository URLs. */\n inspectorProjectMap?: ReadonlyMap<string, string>;\n}\n\nexport interface LocalExternalImportDependencies {\n environment?: NodeJS.ProcessEnv;\n signal?: AbortSignal;\n runWorkbench?: typeof runWorkbench;\n /** Repository references supplied by a reader outside its projected evidence. */\n sourceRepositories?: readonly ExternalSourceRepository[];\n}\n\nexport interface LocalExternalImportPreview extends ExternalFindings {\n repository: string;\n source: { provider: LocalFindingProvider; source_key: string };\n}\n\nexport interface LocalExternalImportResult {\n repository: string;\n read: number;\n report?: ExternalFindings[\"report\"];\n ready: number;\n excluded: ExternalFindings[\"excluded\"];\n findings: StoredExternalFinding[];\n counts: { created: number; updated: number; unchanged: number };\n}\n\nexport interface PreparedLocalExternalImport {\n /** Every declared source matched a configured Git remote of the checkout. */\n matchesRepositoryRemote: boolean;\n preview: LocalExternalImportPreview;\n import(): Promise<LocalExternalImportResult>;\n}\n\nfunction requireIdentity(\n value: unknown,\n field: string,\n): asserts value is string {\n if (typeof value !== \"string\" || !value.trim() || value.includes(\"\\0\"))\n throw new CodexSecurityError(\n `${field} must be nonempty and contain no NUL characters.`,\n );\n}\n\nfunction checkStoredNumber(value: number): void {\n if (!Number.isFinite(value))\n throw new TypeError(\n \"Stored finding JSON cannot contain non-finite numbers.\",\n );\n requireSafeJsonInteger(value, \"Stored finding JSON\");\n}\n\nconst gitTransportPorts: Readonly<Record<string, string>> = {\n \"http:\": \"80\",\n \"https:\": \"443\",\n \"ssh:\": \"22\",\n \"git+ssh:\": \"22\",\n \"ssh+git:\": \"22\",\n \"git:\": \"9418\",\n \"ftp:\": \"21\",\n \"ftps:\": \"990\",\n};\n\n/** Compare transport forms without changing retained scanner evidence. */\ninterface RemoteRepositoryIdentity {\n key: string;\n account?: string;\n homeRelative?: boolean;\n}\n\nfunction sonarHostedHostname(hostname: string) {\n const name = gitServiceHostname(hostname.toLowerCase());\n return isPublicGitHost(name) ||\n [\"ssh.github.com\", \"ssh.dev.azure.com\", \"dev.azure.com\"].includes(name)\n ? name\n : undefined;\n}\n\nfunction remoteRepository(\n value: string,\n provider: Provider,\n bound: boolean,\n platform: Provider = provider,\n possibleSshHost?: string,\n): RemoteRepositoryIdentity | undefined {\n if (/^[A-Za-z]:[\\\\/]/u.test(value)) return undefined;\n const transport = bound\n ? /^(?:ssh|git\\+ssh|ssh\\+git|git):\\/\\/([^/]*)(.*)$/isu.exec(value)\n : null;\n const authority = transport?.[1];\n const http = bound && /^https?:\\/\\//iu.test(value.trimStart());\n // Git decodes the authority before locating its path. An encoded delimiter\n // cannot prove a match to another spelling through WHATWG URL's hostname.\n if (\n authority &&\n (/%2f|[?#]/iu.test(authority) ||\n authority.slice(authority.lastIndexOf(\"@\") + 1).includes(\"%\"))\n )\n return { key: value };\n let remote;\n try {\n remote = parseGitRemote(value);\n } catch {\n return transport || http ? { key: \"\\0\" + value } : undefined;\n }\n if (!remote || !Object.hasOwn(gitTransportPorts, remote.url.protocol))\n return undefined;\n const { url, path, scpStyle } = remote;\n const ssh = isGitSsh(url.protocol);\n const protocol = url.protocol === \"http:\" ? \"http:\" : \"https:\";\n const hosted = sonarHostedHostname(url.hostname);\n if (provider === \"sonar\" && hosted) url.hostname = hosted;\n const githubSshOverHttps = isGitHubSshOverHttps(url);\n let hostname = githubSshOverHttps ? \"github.com\" : url.hostname;\n // An unresolved SSH name can be a local Host alias. Only substitute the\n // supplied hostname when checking the path of an unverified manual mapping.\n if (possibleSshHost && ssh && (!hosted || hosted === \"dev.azure.com\"))\n hostname = sonarHostedHostname(possibleSshHost) ?? possibleSshHost;\n const port =\n githubSshOverHttps || url.port === gitTransportPorts[url.protocol]\n ? \"\"\n : url.port;\n // A GitHub source identifies a case-insensitive repository on custom Enterprise\n // hosts too; other providers can refer to VCS hosts with case-sensitive paths.\n const key = platform === \"github\" ? cloudRepositoryUrlKey : repositoryUrlKey;\n const origin = `${protocol}//${hostname}${port ? `:${port}` : \"\"}/`;\n if (!bound) return { key: key(origin + path) };\n\n if (!ssh && url.protocol !== \"git:\") {\n if (url.protocol === \"http:\" || url.protocol === \"https:\") {\n // libcurl and WHATWG differ on backslashes and encoded dot segments.\n const raw = /^https?:\\/\\/[^/\\\\?#\\s]+(\\/[^\\\\?#]*)?(?:[?#].*)?$/iu.exec(\n value,\n );\n if (!raw || /\\/(?:%2e|\\.%2e|%2e\\.|%2e%2e)(?:\\/|$)/iu.test(raw[1] ?? \"\"))\n return { key: \"\\0\" + value };\n }\n const suffix = /[?#].*$/su.exec(value)?.[0] ?? \"\";\n // HTTP sends the query and omits fragment text from repository requests.\n if (suffix && ![\"http:\", \"https:\"].includes(url.protocol))\n return { key: key(origin + path) + \"\\0\" };\n return {\n key:\n key(origin + path) + suffix.replace(/#.*$/su, \"#\").replace(/\\/$/u, \"\"),\n };\n }\n\n // Git passes the original path (including dot segments, '?' and '#') to upload-pack.\n if (!scpStyle && !transport) return { key: value };\n const gitPath = gitTransportBytes(transport?.[2] ?? path, scpStyle);\n const login = scpStyle\n ? /^([^@/:\\s?#]+)@/u.exec(value)?.[1]\n : /^(.*)@/u.exec(authority ?? \"\")?.[1];\n const homeRelative =\n /^\\/?~(?:\\/|$)/u.test(gitPath) || (scpStyle && !/^[~/]/u.test(gitPath));\n const suffix = /[?#].*$/su.exec(gitPath);\n // Express upload-pack bytes as a URL path for comparison with the HTTP source.\n const name = gitPathToHttpPath(gitPath.slice(0, suffix?.index));\n // Azure's generated SCP clone URL spells spaces as %20, even though Git sends SCP paths literally.\n const azure =\n (provider === \"sonar\" || provider === \"checkmarx\") &&\n !(scpStyle && path.startsWith(\"/\"))\n ? azureReposHttpsUrl(\n url,\n scpStyle ? name.replace(/%2520/gu, \"%20\") : name,\n )\n : undefined;\n const repository = suffix\n ? key(origin + name + \"?\") +\n \"\\0\" +\n suffix[0].replace(/\\/$/u, \"\").replace(/\\.git$/u, \"\")\n : key(azure ?? origin + name);\n return {\n key: repository,\n account: ssh && login ? gitTransportBytes(login, scpStyle) : undefined,\n // GitHub serves the same repository path through its SCP and SSH URLs.\n homeRelative:\n ssh && platform !== \"github\" && !isGitHubCloudHost(hostname.toLowerCase())\n ? homeRelative\n : undefined,\n };\n}\n\nfunction matchingRemote(\n left: RemoteRepositoryIdentity,\n right: RemoteRepositoryIdentity,\n) {\n return (\n left.key === right.key &&\n (left.homeRelative === undefined ||\n right.homeRelative === undefined ||\n left.homeRelative === right.homeRelative) &&\n ((left.homeRelative === false && right.homeRelative === false) ||\n left.account === undefined ||\n right.account === undefined ||\n left.account === right.account)\n );\n}\n\n// Within one fetch key and home-relative mode, matchingRemote can use any\n// account, the requested login, or an unspecified login.\nfunction fetchAliasMatcher(\n rows: readonly { fetch: RemoteRepositoryIdentity }[],\n) {\n const homes = Map.groupBy(rows, ({ fetch }) => fetch.homeRelative);\n const accounts = Array.from(\n homes.values(),\n (group) => new Map(group.map(({ fetch }) => [fetch.account, fetch])),\n );\n return (fetch: RemoteRepositoryIdentity) =>\n accounts.some((group) =>\n [\n group.values().next().value,\n group.get(fetch.account),\n group.get(undefined),\n ].some(\n (candidate) =>\n candidate !== undefined && matchingRemote(fetch, candidate),\n ),\n );\n}\n\nfunction fetchAliasMatchers<\n Row extends { fetch: RemoteRepositoryIdentity },\n Key,\n>(rows: readonly Row[], key: (row: Row) => Key) {\n return new Map(\n Array.from(\n Map.groupBy(rows, key),\n ([name, group]) => [name, fetchAliasMatcher(group)] as const,\n ),\n );\n}\n\n/** A credential-free Sonar repository binding from a supported Git fetch transport. */\nexport function sonarRepositoryForRemote(origin: string): string | undefined {\n try {\n if (/[\\s\\\\\\p{Cc}?#]/u.test(origin)) return;\n const remote = parseGitRemote(origin);\n if (!remote) return;\n const { url } = remote;\n // Git dispatches remote helpers by the literal scheme, while URL lowercases it.\n if (!remote.scpStyle && !origin.startsWith(url.protocol + \"//\")) return;\n // Git passes literal SSH paths to upload-pack. URL.pathname collapses dot segments.\n const path = remote.scpStyle\n ? remote.path\n : /^[^:/]+:\\/\\/[^/]+\\/(.+)$/u.exec(origin)?.[1];\n if (!path) return;\n const hostname = url.hostname.toLowerCase();\n let candidate: string | undefined;\n if (url.protocol === \"http:\" || url.protocol === \"https:\") {\n candidate = `${url.origin}/${path}`;\n } else if (url.username === \"git\" && isGitHubSshOverHttps(url)) {\n candidate = `https://github.com/${path}`;\n } else if (\n isGitSsh(url.protocol) &&\n url.username === \"git\" &&\n (!url.port || url.port === \"22\") &&\n isPublicGitHost(hostname)\n ) {\n candidate = `https://${hostname}/${path}`;\n } else {\n candidate = azureReposHttpsUrl(url, path);\n }\n if (!candidate) return;\n const source = declaredScannerRepositoryUrl(\n candidate.replace(/\\.git$/iu, \"\"),\n \"Sonar\",\n \"local\",\n );\n const candidateRemote = remoteRepository(origin, \"sonar\", true);\n const target = remoteRepository(source, \"sonar\", true);\n if (isGitSsh(url.protocol) && candidateRemote?.account !== \"git\") return;\n return candidateRemote && target && matchingRemote(candidateRemote, target)\n ? source\n : undefined;\n } catch {\n return undefined;\n }\n}\n\n/** Use the same executable and configuration boundaries for every Git query proving a binding. */\nexport function boundSonarWorktree(\n repository: string,\n protectedRoots: string | readonly string[],\n environment: NodeJS.ProcessEnv | undefined,\n signal?: AbortSignal,\n) {\n return enclosingGitWorktreeRoot(repository, signal, {\n requireIfPresent: true,\n readGit: (directory, args) =>\n gitOutput(\n directory,\n args,\n signal,\n undefined,\n undefined,\n \"utf8\",\n protectedRoots,\n environment,\n ),\n });\n}\n\nfunction localRepositoryPlatform(\n provider: Provider,\n sources: readonly ExternalSourceRepository[],\n bound: boolean,\n) {\n const githubKey = (url: string) =>\n remoteRepository(url, provider, bound, \"github\")?.key;\n const githubRepositories = new Set(\n sources.flatMap((source) => {\n if (source.platform !== \"github\") return [];\n const key = githubKey(source.url);\n return key === undefined ? [] : [key];\n }),\n );\n return (source: ExternalSourceRepository): Provider => {\n if (source.platform === \"github\") return \"github\";\n if (githubRepositories.size === 0) return provider;\n const key = githubKey(source.url);\n return key !== undefined && githubRepositories.has(key)\n ? \"github\"\n : provider;\n };\n}\n\nfunction sameScannerRepositories(\n remotes: Iterable<RemoteRepositoryIdentity>,\n): boolean {\n let known: RemoteRepositoryIdentity | undefined;\n for (const remote of remotes) {\n if (known && !matchingRemote(known, remote)) return false;\n // HTTPS does not specify the login or path interpretation carried by SSH.\n known = {\n key: remote.key,\n account: remote.account ?? known?.account,\n homeRelative: remote.homeRelative ?? known?.homeRelative,\n };\n }\n return true;\n}\n\n/** @internal */\nexport interface ConfiguredFetchRemote {\n name: string;\n url: string;\n}\n\n/** @internal Effective fetch URLs from the selected, protected checkout. */\nexport async function configuredFetchRemotes(\n repository: string,\n provider: Provider,\n protectedRoots: WorkbenchCommandOptions[\"protectedRoot\"],\n environment: WorkbenchCommandOptions[\"environment\"],\n signal?: AbortSignal,\n): Promise<ConfiguredFetchRemote[]> {\n if (!(await hasGitMetadata(repository, signal))) return [];\n const gitProtectedRoots = [\n ...(typeof protectedRoots === \"string\"\n ? [protectedRoots]\n : (protectedRoots ?? [])),\n ];\n // The Sonar caller includes the discovered Git roots for both checkouts.\n if (provider !== \"sonar\")\n gitProtectedRoots.push(\n await abortable(() => canonicalConfigPath(process.cwd()), signal),\n );\n if (\n provider === \"sonar\" &&\n !(await boundSonarWorktree(\n repository,\n gitProtectedRoots,\n environment,\n signal,\n ))\n )\n return [];\n const readGit = (args: readonly string[]) =>\n abortable(\n () =>\n gitOutput(\n repository,\n args,\n signal,\n { LC_ALL: \"C\" },\n undefined,\n \"utf8\",\n gitProtectedRoots,\n environment,\n ),\n signal,\n );\n const remoteNames = await readGitRemoteNames(readGit, signal);\n if (remoteNames === undefined) return [];\n const remotes: ConfiguredFetchRemote[] = [];\n const firstUrlOnly = provider === \"sonar\" || provider === \"checkmarx\";\n for (const name of remoteNames.split(/\\r?\\n/u).filter(Boolean)) {\n if (firstUrlOnly) {\n // Git fetches from only the first URL, after insteadOf rewrites.\n const url = await readGit([\"remote\", \"get-url\", \"--\", name]);\n if (/[\\r\\n]/u.test(url))\n throw new CodexSecurityError(\n \"A configured Git remote URL contains a line break. Configure each fetch URL as a separate Git value.\",\n );\n remotes.push({ name, url });\n } else {\n const urls = await readGit([\"remote\", \"get-url\", \"--all\", \"--\", name]);\n for (const url of urls.split(/\\r?\\n/u)) remotes.push({ name, url });\n }\n }\n return remotes;\n}\n\nasync function requireMatchingRepository(\n repository: string,\n provider: Provider,\n sources: readonly ExternalSourceRepository[],\n strictSources: ReadonlyMap<string, Provider>,\n hostedSources: readonly ExternalSourceRepository[],\n platformFor: (source: ExternalSourceRepository, bound: boolean) => Provider,\n snyk: ReturnType<typeof snykRestImportRepository>,\n protectedRoots: string[],\n environment: WorkbenchCommandOptions[\"environment\"],\n signal?: AbortSignal,\n possibleSshHost?: string,\n fetchRemotes?: readonly ConfiguredFetchRemote[],\n isCheckmarxSource?: (url: string) => boolean,\n): Promise<boolean> {\n if (!snyk && sources.length === 0 && hostedSources.length === 0) return false;\n let allSourcesMatched = true;\n if (snyk || hostedSources.length) {\n if (!(await hasGitMetadata(repository, signal))) return false;\n const remotes = await readHostedGitRemotes(\n repository,\n [\n ...protectedRoots,\n await abortable(() => canonicalConfigPath(process.cwd()), signal),\n ],\n environment,\n signal,\n );\n if (snyk) {\n if (\n remotes &&\n !remotes.some((remote) => snykRestCheckoutMatches(snyk, remote))\n )\n throw new CodexSecurityError(\n `Imported repository ${JSON.stringify(snyk.url)} does not match a configured remote of ${repository}. Select the matching local repository.`,\n );\n return remotes !== undefined;\n }\n allSourcesMatched = remotes !== undefined;\n if (remotes) {\n for (const source of hostedSources)\n if (!remotes.some((remote) => hostedRepositoryMatches(source, remote)))\n throw new CodexSecurityError(\n `Imported repository ${JSON.stringify(source.url)} does not match a configured remote of ${repository}. Select the matching local repository.`,\n );\n }\n if (!sources.length) return allSourcesMatched;\n }\n const remoteProvider = (checkmarx?: boolean) =>\n checkmarx && provider !== \"sonar\" ? \"checkmarx\" : provider;\n const remotes =\n fetchRemotes ??\n (await configuredFetchRemotes(\n repository,\n remoteProvider(Boolean(isCheckmarxSource)),\n protectedRoots,\n environment,\n signal,\n ));\n const boundProvider =\n provider === \"sonar\" ||\n provider === \"checkmarx\" ||\n provider === \"continuum\" ||\n provider === \"inspector\" ||\n provider === \"blackduck\" ||\n provider === \"veracode\";\n const comparable: string[] = [];\n const unverified: string[] = [];\n for (const { url: remote } of remotes) {\n const verified =\n provider === \"sonar\" ? sonarRepositoryForRemote(remote) : remote;\n if (verified) comparable.push(verified);\n else if (!/[\\s\\\\\\p{Cc}?#]/u.test(remote)) unverified.push(remote);\n }\n for (const source of sources) {\n const bound = boundProvider || strictSources.has(source.url);\n const platform =\n strictSources.get(source.url) ?? platformFor(source, bound);\n const sourceProvider = remoteProvider(isCheckmarxSource?.(source.url));\n const identity = (url: string, fallbackHost?: string) =>\n remoteRepository(url, sourceProvider, bound, platform, fallbackHost);\n const targets = comparable.flatMap((remote) => identity(remote) ?? []);\n const target = identity(source.url);\n if (target && targets.some((remote) => matchingRemote(remote, target)))\n continue;\n allSourcesMatched = false;\n // A custom SSH upstream can agree with a manual mapping even when a\n // recognized HTTPS remote points at a fork. It cannot prove a Cloud binding.\n const configured = unverified.flatMap(\n (remote) => identity(remote, possibleSshHost) ?? [],\n );\n if (target && configured.some((remote) => matchingRemote(remote, target)))\n continue;\n if (targets.length || configured.length)\n throw new CodexSecurityError(\n `Imported repository ${JSON.stringify(source.url)} does not match a configured remote of ${repository}. Select the matching local repository.`,\n );\n }\n return allSourcesMatched;\n}\n\nexport function sonarCheckoutMatchesSource(\n repository: string,\n url: string,\n protectedRoots: readonly string[],\n environment: NodeJS.ProcessEnv,\n signal?: AbortSignal,\n) {\n return requireMatchingRepository(\n repository,\n \"sonar\",\n [{ url }],\n new Map(),\n [],\n () => \"sonar\",\n undefined,\n [...protectedRoots],\n environment,\n signal,\n );\n}\n\nasync function localContext(\n selectedRepository: string,\n dependencies: LocalExternalImportDependencies,\n mode: \"import\" | \"read\" = \"import\",\n) {\n dependencies.signal?.throwIfAborted();\n const environment = workbenchEnvironment(\n dependencies.environment ?? process.env,\n );\n const path = expandHome(selectedRepository, environment);\n const repository =\n mode === \"read\"\n ? await abortable(() => canonicalConfigPath(path), dependencies.signal)\n : await normalizeRepository(path, dependencies.signal);\n const protectedRoot = [\n ...new Set([\n repository,\n ...(await abortable(\n () => commandGitProtectionRoots(path, environment, dependencies.signal),\n dependencies.signal,\n )),\n ]),\n ];\n requireOutputOutsideRepositories(\n protectedRoot,\n await abortable(\n () => canonicalizeModelSafePath(environment.CODEX_SECURITY_STATE_DIR),\n dependencies.signal,\n ),\n \"runtime\",\n );\n return {\n repository,\n options: {\n pluginRoot: await abortable(\n () => bundledPluginRoot(),\n dependencies.signal,\n ),\n environment,\n protectedRoot,\n signal: dependencies.signal,\n failureMessage: \"Could not access imported local findings\",\n },\n };\n}\n\n/** Prepare scanner evidence without writing state or performing a security assessment. */\nexport async function prepareNormalizedLocalImport(\n input: ExternalFindings,\n options: NormalizedLocalImportOptions,\n dependencies: LocalExternalImportDependencies = {},\n): Promise<PreparedLocalExternalImport> {\n dependencies.signal?.throwIfAborted();\n return prepareLocalImport(\n input,\n snapshotImportOptions(options),\n dependencies,\n );\n}\n\n// A scanner can repeat the same repository reference for every finding in a run.\nexport function distinctSourceRepositories(\n sources: readonly ExternalSourceRepository[],\n) {\n const seen = new Map<ExternalSourceRepository[\"platform\"], Set<string>>();\n return sources.filter(({ url, platform }) => {\n const urls = seen.get(platform) ?? new Set<string>();\n if (urls.has(url)) return false;\n urls.add(url);\n seen.set(platform, urls);\n return true;\n });\n}\n\n/** @internal Prepare evidence using settings captured by either local import entrypoint. */\nexport async function prepareLocalImport(\n input: ExternalFindings & Partial<SnykIssuesFindings>,\n options: NormalizedLocalImportOptions &\n ({ provider: \"tenable\" } | { provider: Provider }),\n dependencies: LocalExternalImportDependencies,\n readerSources = distinctSourceRepositories(\n snapshotSourceRepositories(dependencies.sourceRepositories),\n ),\n parsedInput: readonly ExternalSourceRepository[] = [],\n fetchRemotes?: readonly ConfiguredFetchRemote[],\n): Promise<PreparedLocalExternalImport> {\n requireIdentity(options.sourceKey, \"Source key\");\n const parsedSources = distinctSourceRepositories(parsedInput);\n const current = snapshotNormalizedFindings(input, checkStoredNumber);\n if (\n options.provider !== \"tenable\" &&\n (current.report?.[\"format\"] === tenableReportFormat ||\n current.findings.some(\n (row) => row.evidence?.source_data?.[\"format\"] === tenableReportFormat,\n ))\n )\n throw new CodexSecurityError(\n \"Retained Tenable evidence requires the tenable provider.\",\n );\n checkTrivyReportProvider(options.provider, current.report);\n // The JSON snapshot omits inherited or non-enumerable SDK reader properties.\n if (!(\"snykRestContext\" in current) && \"snykRestContext\" in input)\n current.snykRestContext = structuredClone(input.snykRestContext);\n if (options.provider === \"snyk\" || current.snykRestContext !== undefined) {\n for (const key of [\n \"sourceRepositoryUrl\",\n \"sourceRepositoryPlatform\",\n ] as const)\n if (key in input && !(key in current))\n Object.assign(current, { [key]: structuredClone(input[key]) });\n }\n let dependabotSource: string | undefined;\n const identities = new Set<string>();\n for (const finding of current.findings) {\n requireIdentity(finding.source_finding_id, \"Source finding id\");\n if (identities.has(finding.source_finding_id))\n throw new CodexSecurityError(\n `Duplicate source finding id ${JSON.stringify(finding.source_finding_id)}.`,\n );\n identities.add(finding.source_finding_id);\n if (!isRecord(finding.evidence))\n throw new CodexSecurityError(\"Imported evidence must be an object.\");\n checkRetainedTrivyProvider(options.provider, finding, \"local\");\n if (options.provider !== \"github\") continue;\n const native = dependabotRepository(finding);\n if (!native) continue;\n const claimed = finding.evidence.details?.repository?.url;\n if (\n claimed &&\n cloudRepositoryUrlKey(claimed) !== cloudRepositoryUrlKey(native)\n )\n throw new CodexSecurityError(\n \"The normalized repository does not match the original Dependabot alert.\",\n );\n if (dependabotSource && dependabotSource !== native)\n throw new CodexSecurityError(\n \"Select Dependabot alerts from only one GitHub host and repository.\",\n );\n dependabotSource = native;\n }\n const context = await localContext(options.repository, dependencies);\n if (options.provider === \"tenable\") {\n const source = tenableSourceRepository(\n current,\n options.sourceRepositoryUrl,\n [...readerSources, ...parsedSources],\n );\n const remotes = await readHostedGitRemotes(\n context.repository,\n [\n ...context.options.protectedRoot,\n await abortable(\n () => canonicalConfigPath(process.cwd()),\n dependencies.signal,\n ),\n ],\n context.options.environment,\n dependencies.signal,\n );\n if (!remotes?.some((remote) => hostedRepositoryMatches(source, remote)))\n throw new CodexSecurityError(\n \"Tenable's source repository must match a configured Git fetch remote of the selected checkout.\",\n );\n return preparedLocalStorage(current, options, context, dependencies, true);\n }\n const { repository, options: workbenchOptions } = context;\n const sources = new Map<string, ExternalSourceRepository>();\n const references = [...readerSources, ...parsedSources];\n const inspector = inspectorReportRepository(\n options.provider,\n current.findings,\n \"local\",\n options.inspectorProjectMap,\n );\n const checkmarx = checkmarxSelection(\n options.provider,\n current.findings,\n current.report,\n \"local\",\n );\n const projected = current.findings.filter(\n (finding) =>\n (options.provider !== \"blackduck\" &&\n projectedBlackDuckRepositoryUrl(finding, \"local\")) ||\n checkmarx.projections.has(finding),\n );\n const mixed = projected.length > 0 && readerSources.length > 0;\n const nativeSources = new Map(\n (mixed ? current.findings : projected)\n .filter(\n ({ evidence }) =>\n options.provider !== \"endor\" ||\n isRecord(evidence.source_data?.[\"runContext\"]),\n )\n .map(\n (finding) =>\n [\n finding,\n localFindingRepositories(options.provider, finding),\n ] as const,\n ),\n );\n const platformFor = localRepositoryPlatform(\n options.provider,\n options.inspectorProjectMap\n ? []\n : [\n ...references,\n ...Array.from(nativeSources.values()).flat(),\n ...(inspector ? [inspector] : []),\n ],\n true,\n );\n const identify = (url: string) =>\n remoteRepository(url, options.provider, true, platformFor({ url })) ?? {\n key: url,\n };\n // A hint from an independent reader applies across projected rows. A native\n // GitHub asset in one row only identifies the platform of that row's claims.\n const operatorPlatform = localRepositoryPlatform(\n options.provider,\n readerSources,\n true,\n );\n const sameRepositories = (urls: Iterable<string>) =>\n sameScannerRepositories(Array.from(urls, identify));\n const bound = blackDuckReportRepositories(\n options.provider,\n current.findings,\n \"local\",\n sameRepositories,\n );\n const checkmarxRepository = checkmarx.repositories(sameRepositories);\n for (const repositories of [\n veracodeReportRepositories,\n continuumReportRepositories,\n ]) {\n for (const source of repositories(\n options.provider,\n current.findings,\n \"local\",\n sameRepositories,\n ).values()) {\n sources.set(source.url, source);\n }\n }\n const strictSources = new Map<string, Provider>();\n const checkmarxKeys = new Set<string>();\n const hostedSources = new Map<string, ExternalSourceRepository>();\n const semgrepReportScope = semgrepPlatformReportScope(\n current,\n options.provider,\n readerSources,\n );\n const semgrepPlatformRepositoryUrl = semgrepReportScope?.url;\n function addSemgrepSource(url: string) {\n if (options.provider !== \"semgrep\")\n throw new CodexSecurityError(\n \"Use the semgrep provider for Semgrep Platform findings.\",\n );\n const source = semgrepPlatformRepositoryReference(url, readerSources);\n if (\n semgrepPlatformRepositoryUrl &&\n semgrepPlatformRepositoryUrl !== url &&\n !semgrepReferenceMatches(source, semgrepPlatformRepositoryUrl)\n )\n throw new CodexSecurityError(\n \"The Semgrep report repository does not match the native finding's project.\",\n );\n hostedSources.set(source.url, source);\n }\n function addGuardianSource(value: unknown) {\n if (options.provider !== \"semgrep\")\n throw new CodexSecurityError(\n \"Use the semgrep provider for Guardian findings.\",\n );\n const url = declaredScannerRepositoryUrl(value, \"Guardian\", \"local\");\n const source =\n hostedSources.get(url) ??\n semgrepPlatformRepositoryReference(url, readerSources);\n hostedSources.set(url, source);\n return source;\n }\n const guardianReport =\n current.report?.[\"format\"] === guardianSelectionFormat\n ? addGuardianSource(current.report[\"repositoryUrl\"])\n : undefined;\n if (semgrepPlatformRepositoryUrl)\n addSemgrepSource(semgrepPlatformRepositoryUrl);\n const known = new Set<string>(parsedSources.map(({ url }) => url));\n const legacyWitnesses = semgrepLegacyRepositoryWitnesses(\n current.findings,\n options.provider,\n readerSources,\n );\n const hasPlatformEvidence =\n options.provider === \"semgrep\" &&\n (semgrepReportScope !== undefined ||\n current.findings.some((row) =>\n isSemgrepPlatformEvidence(row, options.provider),\n ));\n let hasOrdinaryRows = false;\n let ordinaryRowNeedsReferences = false;\n for (const finding of current.findings) {\n const retained =\n bound.get(finding.source_finding_id) ?? checkmarxRepository(finding);\n const native = nativeSources.get(finding) ?? [];\n const sarif = hasPlatformEvidence ? semgrepSarifRepositories(finding) : [];\n const semgrep = semgrepPlatformFindingBinding(\n finding,\n options.provider,\n readerSources,\n legacyWitnesses,\n semgrepReportScope,\n [retained, ...native, ...sarif],\n );\n if (semgrep) {\n addSemgrepSource(semgrep.url);\n if (semgrep.sourceData) finding.evidence.source_data = semgrep.sourceData;\n if (semgrep.migration) Object.assign(finding.evidence, semgrep.migration);\n }\n const { evidence } = finding;\n if (options.provider === \"github\") {\n const source = retainedGitHubRepository(\n finding,\n (url) => identify(url).key,\n );\n if (source) sources.set(source, { url: source, platform: \"github\" });\n }\n const guardian = guardianFindingRepository(finding, \"local\");\n const url = evidence.details?.repository?.url;\n if (guardian) {\n const source = addGuardianSource(guardian);\n if (\n (guardianReport &&\n !semgrepReferenceMatches(guardianReport, source.url)) ||\n (url &&\n !semgrepReferenceMatches(\n source,\n declaredScannerRepositoryUrl(url, \"Guardian\", \"local\"),\n ))\n )\n throw new CodexSecurityError(\n \"The Guardian finding repository does not match its recorded selection.\",\n );\n } else if (!semgrep) {\n hasOrdinaryRows = true;\n if (url) sources.set(url, { url });\n }\n if (\n hasPlatformEvidence &&\n !semgrep &&\n !guardian &&\n !retained &&\n !native.length\n ) {\n for (const source of sarif) sources.set(source.url, source);\n if (!url && !sarif.length) ordinaryRowNeedsReferences = true;\n if (!url && references.length) {\n for (const source of sarif) {\n const claim = identify(source.url);\n if (\n !references.some((ref) => matchingRemote(claim, identify(ref.url)))\n )\n throw new CodexSecurityError(\n `The reader must supply the projected Semgrep SARIF repository ${JSON.stringify(source.url)} for the configured remote.`,\n );\n }\n }\n }\n const projectedCheckmarx = checkmarx.projections.has(finding);\n if (retained || (projectedCheckmarx && native.length)) {\n const rowSources = retained ? [retained, ...native] : native;\n const claims = [\n ...rowSources.map((ref) => ref.url),\n ...(url ? [url] : []),\n ];\n const rowPlatform = (claim: string) =>\n options.provider !== \"wiz\"\n ? platformFor({ url: claim })\n : native.some((source) => source.platform === \"github\")\n ? \"github\"\n : operatorPlatform({ url: claim });\n if (\n !sameScannerRepositories(\n claims.map(\n (claim) =>\n remoteRepository(\n claim,\n options.provider,\n true,\n rowPlatform(claim),\n ) ?? {\n key: claim,\n },\n ),\n )\n )\n throw new CodexSecurityError(\n \"The retained scanner repository does not match the original provider finding.\",\n );\n for (const source of rowSources) sources.set(source.url, source);\n for (const claim of claims) {\n if (projectedCheckmarx) checkmarxKeys.add(identify(claim).key);\n const platform = rowPlatform(claim);\n if (!strictSources.has(claim) || platform !== \"github\")\n strictSources.set(claim, platform);\n }\n }\n for (const source of native) known.add(source.url);\n }\n // Match references for native Platform rows using their hosted Git identity.\n const hosted = Array.from(hostedSources.values());\n const hostedReferences = new Set(\n references.filter((ref) =>\n hosted.some((source) => semgrepReferenceMatches(source, ref.url)),\n ),\n );\n const sharedReferences = new Set<ExternalSourceRepository>();\n const ordinaryReferences = new Set<ExternalSourceRepository>();\n if (hostedReferences.size) {\n const readerPlatform = localRepositoryPlatform(\n options.provider,\n [...sources.values(), ...references],\n false,\n );\n const ordinaryIdentity = (url: string) =>\n remoteRepository(\n url,\n options.provider,\n false,\n readerPlatform({ url }),\n ) ?? { key: url };\n const aliases = references.map((ref) => ({\n ref,\n fetch: identify(ref.url),\n ordinary: ordinaryIdentity(ref.url).key,\n }));\n const claims = Map.groupBy(\n Array.from(sources.keys(), (url) => ({\n fetch: identify(url),\n ordinary: strictSources.has(url)\n ? undefined\n : ordinaryIdentity(url).key,\n })),\n (claim) => claim.fetch.key,\n );\n for (const [key, refs] of Map.groupBy(\n aliases,\n (alias) => alias.fetch.key,\n )) {\n const hosted = refs.filter(({ ref }) => hostedReferences.has(ref));\n const group = claims.get(key);\n if (!hosted.length || !group) continue;\n const shared = fetchAliasMatcher(group);\n const readers = fetchAliasMatchers(refs, (alias) => alias.ordinary);\n // Keep a sole fetch alias subject to checkout validation. A redundant\n // Platform spelling can be dropped when another reference serves the reader.\n const required = fetchAliasMatchers(group, ({ fetch, ordinary }) =>\n ordinary !== undefined && readers.get(ordinary)?.(fetch)\n ? ordinary\n : undefined,\n );\n for (const alias of hosted) {\n if (!shared(alias.fetch)) continue;\n sharedReferences.add(alias.ref);\n if (\n required.get(undefined)?.(alias.fetch) ||\n required.get(alias.ordinary)?.(alias.fetch)\n )\n ordinaryReferences.add(alias.ref);\n }\n }\n }\n if (mixed) {\n // Other caller references must identify an ordinary row or one of its Git aliases.\n const rows = [...sources.keys(), ...known].map(identify);\n const byKey = Map.groupBy(rows, (remote) => remote.key);\n const represented = new Set(rows.map((remote) => JSON.stringify(remote)));\n const aliases = readerSources\n .filter((ref) => !hostedReferences.has(ref) || sharedReferences.has(ref))\n .map(({ url }) => identify(url))\n .filter((remote) => !represented.has(JSON.stringify(remote)));\n for (const [key, group] of Map.groupBy(aliases, (remote) => remote.key)) {\n const candidates = byKey.get(key);\n if (!candidates || !sameScannerRepositories([...candidates, ...group]))\n throw new CodexSecurityError(\n \"Reader repository does not match a source in the normalized findings.\",\n );\n }\n }\n if (strictSources.size && options.provider !== \"blackduck\") {\n const keys = new Set(\n Array.from(strictSources.keys(), (url) => identify(url).key),\n );\n for (const source of references)\n if (\n !strictSources.has(source.url) &&\n keys.has(identify(source.url).key)\n ) {\n strictSources.set(source.url, platformFor(source));\n if (sharedReferences.has(source)) ordinaryReferences.add(source);\n }\n }\n if (inspector) {\n const platform =\n inspector.platform === \"github\" ? \"github\" : options.provider;\n const native = remoteRepository(\n inspector.url,\n options.provider,\n true,\n platform,\n );\n for (const url of sources.keys()) {\n if (\n !native ||\n remoteRepository(url, options.provider, true, platform)?.key !==\n native.key\n )\n throw new CodexSecurityError(\n `Imported repository ${JSON.stringify(url)} does not match the retained Inspector repository ${JSON.stringify(inspector.url)}.`,\n );\n }\n }\n if (\n readerSources.length &&\n hosted.length &&\n ((!hasOrdinaryRows &&\n !readerSources.every((ref) => hostedReferences.has(ref))) ||\n hosted.some(\n (source) =>\n !readerSources.some((ref) =>\n semgrepReferenceMatches(source, ref.url),\n ),\n ))\n )\n throw new CodexSecurityError(\n \"The reader's source repository does not match the selected Semgrep project.\",\n );\n for (const source of [...(inspector ? [inspector] : []), ...references]) {\n if (\n !ordinaryRowNeedsReferences &&\n hostedReferences.has(source) &&\n !ordinaryReferences.has(source)\n )\n continue;\n // A reader's platform must not loosen an operator-supplied Inspector map.\n if (sources.get(source.url)?.platform !== \"github\")\n sources.set(\n source.url,\n options.inspectorProjectMap ? { url: source.url } : source,\n );\n }\n const reportUrl = checkmarx.reportUrl;\n if (reportUrl) {\n const source = sources.get(reportUrl) ?? { url: reportUrl };\n sources.set(reportUrl, source);\n checkmarxKeys.add(identify(reportUrl).key);\n if (!strictSources.has(reportUrl))\n strictSources.set(reportUrl, platformFor(source));\n }\n if (\n ((options.provider === \"checkmarx\" || reportUrl) &&\n !sameRepositories(sources.keys())) ||\n (reportUrl &&\n hosted.some((source) => !semgrepReferenceMatches(source, reportUrl)))\n )\n throw new Error(\n \"The retained Checkmarx report repository does not match the finding repository.\",\n );\n const sonarSources = sonarRepositoryUrls(\n options.provider,\n current.findings,\n current.report,\n \"local\",\n );\n const manualSource =\n options.provider === \"sonar\" && options.sourceRepositoryUrl\n ? declaredScannerRepositoryUrl(\n options.sourceRepositoryUrl,\n \"Sonar\",\n \"local\",\n )\n : undefined;\n if (manualSource) sonarSources.add(manualSource);\n for (const url of sonarSources)\n if (!sources.has(url)) sources.set(url, { url });\n if (sonarSources.size && !sameRepositories(sources.keys()))\n throw new CodexSecurityError(\n manualSource\n ? \"The Sonar evidence does not match the declared source repository.\"\n : \"The retained Sonar repository does not match the other source repository claims.\",\n );\n if (\n options.provider === \"blackduck\" &&\n current.findings.length &&\n sources.size > 1 &&\n !sameScannerRepositories(Array.from(sources.keys(), identify))\n )\n throw new CodexSecurityError(\n \"Black Duck occurrences must belong to the same project version and source repository.\",\n );\n if (dependabotSource)\n sources.set(dependabotSource, {\n url: dependabotSource,\n platform: \"github\",\n });\n const snyk = snykRestImportRepository(\n current,\n options.provider,\n [\n ...sources.keys(),\n ...(options.sourceRepositoryUrl === undefined\n ? []\n : [options.sourceRepositoryUrl]),\n ],\n readerSources,\n (finding, source) => {\n finding.evidence.source_data = source;\n },\n );\n if (snyk) {\n // Preserve reader display fields while validating their complete native evidence.\n for (const { evidence } of current.findings)\n validateExternalEvidence(structuredClone(evidence), \"local\");\n } else if (options.provider === \"snyk\" && current.sourceRepositoryUrl) {\n const declared = { url: current.sourceRepositoryUrl };\n const native = current.findings.flatMap((finding) =>\n localFindingRepositories(\"snyk\", finding),\n );\n for (const source of [declared, ...native])\n if (!sources.has(source.url)) sources.set(source.url, source);\n if (!sameRepositories(sources.keys()))\n throw new CodexSecurityError(\n \"The normalized repository does not match the Snyk reader's repository.\",\n );\n }\n const ordinarySources = [...sources.values()];\n // A reader can identify the VCS for both a hosted project and an ordinary row.\n const loosePlatformFor = localRepositoryPlatform(\n options.provider,\n [...ordinarySources, ...hostedReferences],\n false,\n );\n const selected = manualSource ? new URL(manualSource) : undefined;\n const matchesRepositoryRemote =\n options.provider === \"trivy\"\n ? await matchTrivyCheckout(\n repository,\n current,\n references,\n workbenchOptions,\n )\n : await requireMatchingRepository(\n repository,\n options.provider,\n ordinarySources,\n strictSources,\n hosted,\n (source, bound) =>\n bound ? platformFor(source) : loosePlatformFor(source),\n snyk,\n workbenchOptions.protectedRoot,\n workbenchOptions.environment,\n dependencies.signal,\n selected?.protocol === \"https:\" ? selected.hostname : undefined,\n fetchRemotes,\n checkmarx.projections.size\n ? (url) => checkmarxKeys.has(identify(url).key)\n : undefined,\n );\n return preparedLocalStorage(\n current,\n options,\n context,\n dependencies,\n matchesRepositoryRemote,\n );\n}\n\nfunction preparedLocalStorage(\n current: ExternalFindings,\n options: NormalizedLocalImportOptions,\n {\n repository,\n options: workbenchOptions,\n }: Awaited<ReturnType<typeof localContext>>,\n dependencies: LocalExternalImportDependencies,\n matchesRepositoryRemote: boolean,\n): PreparedLocalExternalImport {\n dependencies.signal?.throwIfAborted();\n const preview = {\n ...cloneImportPreview(current),\n repository,\n source: { provider: options.provider, source_key: options.sourceKey },\n };\n const payload = JSON.stringify({\n repository,\n provider: options.provider,\n sourceKey: options.sourceKey,\n findings: current.findings.map(({ source_finding_id, evidence }) => ({\n source_finding_id,\n evidence,\n })),\n });\n return {\n matchesRepositoryRemote,\n preview,\n async import() {\n dependencies.signal?.throwIfAborted();\n const disposition = externalImportDisposition(current);\n if (disposition === \"failed\")\n throw new NoPublishableFindingsError(cloneImportPreview(current));\n const summary = {\n repository,\n read: current.read,\n ...(current.report === undefined\n ? {}\n : snapshotNormalizedFindings({ report: current.report })),\n ready: current.findings.length,\n excluded: structuredClone(current.excluded),\n };\n if (disposition !== \"ready\") {\n return {\n ...summary,\n findings: [],\n counts: { created: 0, updated: 0, unchanged: 0 },\n };\n }\n const protectedRoot = [\n ...new Set([\n ...workbenchOptions.protectedRoot,\n ...(await abortable(\n () =>\n localGitProtectionRoots(\n process.cwd(),\n workbenchOptions.environment,\n dependencies.signal,\n ),\n dependencies.signal,\n )),\n ]),\n ];\n requireOutputOutsideRepositories(\n protectedRoot,\n await abortable(\n () =>\n canonicalizeModelSafePath(\n workbenchOptions.environment.CODEX_SECURITY_STATE_DIR,\n ),\n dependencies.signal,\n ),\n \"runtime\",\n );\n const result = await abortable(() => {\n dependencies.signal?.throwIfAborted();\n return (dependencies.runWorkbench ?? runWorkbench)(\n { ...workbenchOptions, protectedRoot },\n [\"store-external-findings\"],\n payload,\n );\n }, dependencies.signal);\n return {\n ...summary,\n findings: result[\"findings\"] as unknown as StoredExternalFinding[],\n counts: result[\"counts\"] as LocalExternalImportResult[\"counts\"],\n };\n },\n };\n}\n\n/** Read imported source records, including evidence that has not been assessed by Codex. */\nexport async function listLocalExternalFindings(\n selection: { repository: string; id?: string },\n dependencies: LocalExternalImportDependencies = {},\n): Promise<StoredExternalFinding[]> {\n dependencies.signal?.throwIfAborted();\n if (selection.id !== undefined) requireIdentity(selection.id, \"Finding id\");\n const { repository, options } = await localContext(\n selection.repository,\n dependencies,\n \"read\",\n );\n const result = await abortable(() => {\n dependencies.signal?.throwIfAborted();\n return (dependencies.runWorkbench ?? runWorkbench)(\n options,\n [\"list-external-findings\"],\n JSON.stringify({ repository, id: selection.id }),\n );\n }, dependencies.signal);\n return result[\"findings\"] as unknown as StoredExternalFinding[];\n}\n"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { type PrivateImportFormat, type PrivateImportJob } from "./private-finding-import.js";
|
|
2
|
+
import type { LocalExternalImportOptions } from "./external-findings-import.js";
|
|
1
3
|
import { CodexSecurityError } from "./errors.js";
|
|
2
|
-
import { type
|
|
3
|
-
import { type ExternalFindings } from "./external-findings.js";
|
|
4
|
+
import { type CloudFindingsReader } from "./external-findings-read.js";
|
|
5
|
+
import { type ExternalSourceRepository, type ExternalFindings } from "./external-findings.js";
|
|
4
6
|
import type { FindingImportRequest, FindingImportReceipt, ImportRepository } from "./external-import-models.js";
|
|
5
7
|
/** Source and destination for evidence already normalized to the Cloud contract. */
|
|
6
8
|
export interface NormalizedExternalPublicationOptions {
|
|
@@ -10,13 +12,14 @@ export interface NormalizedExternalPublicationOptions {
|
|
|
10
12
|
/** Full Inspector project ARNs mapped to independently verified repository URLs. */
|
|
11
13
|
inspectorProjectMap?: ReadonlyMap<string, string>;
|
|
12
14
|
}
|
|
13
|
-
/** File readers
|
|
14
|
-
export interface ExternalPublicationOptions extends
|
|
15
|
-
provider:
|
|
16
|
-
sourceRepositoryUrl?: string;
|
|
15
|
+
/** File readers accepted by the Cloud publisher. */
|
|
16
|
+
export interface ExternalPublicationOptions extends LocalExternalImportOptions {
|
|
17
|
+
provider: CloudFindingsReader;
|
|
17
18
|
}
|
|
18
19
|
/** Optional transport, account, cancellation, and progress hooks. */
|
|
19
20
|
export interface ExternalPublicationDependencies {
|
|
21
|
+
/** Independently verified source repositories for hosted Semgrep or Snyk evidence. */
|
|
22
|
+
sourceRepositories?: readonly ExternalSourceRepository[];
|
|
20
23
|
environment?: NodeJS.ProcessEnv;
|
|
21
24
|
fetch?: (url: string, options: RequestInit) => Promise<Response>;
|
|
22
25
|
credentials?: () => Promise<{
|
|
@@ -51,6 +54,8 @@ export interface ExternalPublicationResult {
|
|
|
51
54
|
verified: number;
|
|
52
55
|
error?: string;
|
|
53
56
|
savedSubmission?: string;
|
|
57
|
+
/** Private jobs expose aggregate outcomes before assessment or publication. */
|
|
58
|
+
privateJob?: PrivateImportJob;
|
|
54
59
|
}
|
|
55
60
|
/** Preserve accepted work in CLI JSON output when publication cannot finish. */
|
|
56
61
|
export declare class ExternalPublicationError extends CodexSecurityError {
|
|
@@ -65,11 +70,20 @@ export interface ExternalPublicationPreview extends ExternalFindings {
|
|
|
65
70
|
source: FindingImportRequest["source"];
|
|
66
71
|
resumed: boolean;
|
|
67
72
|
requests: FindingImportRequest[];
|
|
73
|
+
privateImport?: {
|
|
74
|
+
format: PrivateImportFormat;
|
|
75
|
+
contextVersion: string;
|
|
76
|
+
sha256: string;
|
|
77
|
+
bytes: number;
|
|
78
|
+
retryOfJobId?: string;
|
|
79
|
+
};
|
|
68
80
|
}
|
|
69
81
|
export interface PreparedExternalPublication {
|
|
70
82
|
preview: ExternalPublicationPreview;
|
|
71
83
|
publish(): Promise<ExternalPublicationResult>;
|
|
72
84
|
}
|
|
85
|
+
export declare function externalPublicationStateDirectory(environment: NodeJS.ProcessEnv): string;
|
|
86
|
+
export declare function writeAtomicJson(path: string, value: unknown): Promise<void>;
|
|
73
87
|
export declare function prepareExternalPublication(path: string, options: ExternalPublicationOptions, dependencies?: ExternalPublicationDependencies): Promise<PreparedExternalPublication>;
|
|
74
88
|
/** Prepare normalized provider evidence without reading a vendor export. */
|
|
75
89
|
export declare function prepareNormalizedExternalPublication(input: ExternalFindings, options: NormalizedExternalPublicationOptions, dependencies?: ExternalPublicationDependencies): Promise<PreparedExternalPublication>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-findings-publish.d.ts","sourceRoot":"","sources":["../src/external-findings-publish.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"external-findings-publish.d.ts","sourceRoot":"","sources":["../src/external-findings-publish.ts"],"names":[],"mappings":"AAoBA,OAAO,EAIL,KAAK,mBAAmB,EAKxB,KAAK,gBAAgB,EACtB,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAahF,OAAO,EAAE,kBAAkB,EAAgB,MAAM,aAAa,CAAC;AAQ/D,OAAO,EAML,KAAK,mBAAmB,EACzB,MAAM,6BAA6B,CAAC;AA0ErC,OAAO,EAIL,KAAK,wBAAwB,EAM7B,KAAK,gBAAgB,EAEtB,MAAM,wBAAwB,CAAC;AAchC,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAGjB,MAAM,6BAA6B,CAAC;AAIrC,oFAAoF;AACpF,MAAM,WAAW,oCAAoC;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,CAAC;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,oFAAoF;IACpF,mBAAmB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnD;AAED,oDAAoD;AACpD,MAAM,WAAW,0BAA2B,SAAQ,0BAA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