@openai/codex-security 0.8.3 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -746
- package/_bundled_plugin/.codex-plugin/plugin.json +2 -0
- package/_bundled_plugin/.mcp.json +7 -1
- package/_bundled_plugin/examples/completed-scan/findings.json +16 -4
- package/_bundled_plugin/examples/completed-scan/report.md +11 -8
- package/_bundled_plugin/examples/completed-scan/scan-manifest.json +4 -2
- package/_bundled_plugin/mcp/fzstd-LICENSE.txt +21 -0
- package/_bundled_plugin/mcp/helpers.mjs +2 -11
- package/_bundled_plugin/mcp/helpers.mjs.br +0 -0
- package/_bundled_plugin/mcp/native/THIRD_PARTY_NOTICES.txt +3 -210
- package/_bundled_plugin/mcp/native/darwin-arm64/unix.node +0 -0
- package/_bundled_plugin/mcp/native/darwin-x64/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-arm64-gnu/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-arm64-musl/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-x64-gnu/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-x64-musl/unix.node +0 -0
- package/_bundled_plugin/mcp/native/win32-arm64/windows.node +0 -0
- package/_bundled_plugin/mcp/native/win32-x64/windows.node +0 -0
- package/_bundled_plugin/mcp/package.json +1 -0
- package/_bundled_plugin/mcp/permission-profile-preflight.mjs +5 -2
- package/_bundled_plugin/mcp/server.mjs +2 -11
- package/_bundled_plugin/mcp/server.mjs.br +0 -0
- package/_bundled_plugin/mcp/session-decompression.mjs +712 -0
- package/_bundled_plugin/references/artifact-storage.md +1 -1
- package/_bundled_plugin/references/baseline-auditor.md +18 -0
- package/_bundled_plugin/references/core-scan.md +5 -42
- package/_bundled_plugin/references/default-severity-rubric.md +9 -4
- package/_bundled_plugin/references/final-report.md +5 -3
- package/_bundled_plugin/references/finding-detail-fields.md +18 -18
- package/_bundled_plugin/references/focused-investigator.md +13 -0
- package/_bundled_plugin/references/sarif-adapter.md +8 -2
- package/_bundled_plugin/references/scan-artifacts.md +21 -12
- package/_bundled_plugin/references/scan-contract.md +27 -33
- package/_bundled_plugin/references/scan-prologue.md +2 -2
- package/_bundled_plugin/references/scan-runtime.md +4 -2
- package/_bundled_plugin/references/security-guidance.md +14 -1
- package/_bundled_plugin/references/validate-scan-findings.md +3 -0
- package/_bundled_plugin/schemas/tools/scan-draft.schema.json +2 -2
- package/_bundled_plugin/scripts/check_deep_scan_target.py +97 -0
- package/_bundled_plugin/scripts/codex_profile.mjs +7 -1
- package/_bundled_plugin/scripts/deep_scan_config.py +20 -1
- package/_bundled_plugin/scripts/deep_scan_workbench.py +192 -352
- package/_bundled_plugin/scripts/dispatch_inventory_tool +7 -0
- package/_bundled_plugin/scripts/filesystem_identity.py +1 -0
- package/_bundled_plugin/scripts/finalize_scan_contract.py +182 -230
- package/_bundled_plugin/scripts/finding_preview.py +20 -0
- package/_bundled_plugin/scripts/launch_codex_security_mcp +55 -16
- package/_bundled_plugin/scripts/legacy_findings.py +148 -0
- package/_bundled_plugin/scripts/posix_scan_local_files.py +37 -1
- package/_bundled_plugin/scripts/read_codex_session.mjs +21 -0
- package/_bundled_plugin/scripts/report_projection.py +81 -43
- package/_bundled_plugin/scripts/review_state.py +8 -2
- package/_bundled_plugin/scripts/servicenow_avit.py +20 -0
- package/_bundled_plugin/scripts/snapshot_sqlite.py +9 -2
- package/_bundled_plugin/scripts/threat_model_projection.py +22 -26
- package/_bundled_plugin/scripts/validate_scan_contract.py +7 -1
- package/_bundled_plugin/scripts/windows_scan_local_files.py +582 -20
- package/_bundled_plugin/scripts/workbench/__init__.py +1 -1
- package/_bundled_plugin/scripts/workbench/handoff.py +100 -23
- package/_bundled_plugin/scripts/workbench/retained_coverage.py +30 -51
- package/_bundled_plugin/scripts/workbench/retained_records.py +18 -30
- package/_bundled_plugin/scripts/workbench/runtime_toml.py +4 -1
- package/_bundled_plugin/scripts/workbench/saved_coverage.py +9 -17
- package/_bundled_plugin/scripts/workbench/saved_outputs.py +9 -0
- package/_bundled_plugin/scripts/workbench/saved_sources.py +47 -40
- package/_bundled_plugin/scripts/workbench/storage.py +91 -7
- package/_bundled_plugin/scripts/workbench_cli.py +54 -14
- package/_bundled_plugin/scripts/workbench_constants.py +12 -0
- package/_bundled_plugin/scripts/workbench_coverage_receipts.py +3 -3
- package/_bundled_plugin/scripts/workbench_db.py +562 -303
- package/_bundled_plugin/scripts/workbench_feedback.py +57 -11
- package/_bundled_plugin/scripts/workbench_finding_index.py +1 -0
- package/_bundled_plugin/scripts/workbench_finding_workflows.py +4 -0
- package/_bundled_plugin/scripts/workbench_native_indexes.py +238 -41
- package/_bundled_plugin/scripts/workbench_progress.py +169 -4
- package/_bundled_plugin/scripts/workbench_publication.py +16 -13
- package/_bundled_plugin/scripts/workbench_remediation.py +155 -2
- package/_bundled_plugin/scripts/workbench_saved_results.py +176 -81
- package/_bundled_plugin/scripts/workbench_scan_history.py +398 -174
- package/_bundled_plugin/scripts/workbench_scan_start.py +224 -31
- package/_bundled_plugin/scripts/workbench_scan_usage.py +675 -73
- package/_bundled_plugin/scripts/workbench_schema.py +258 -63
- package/_bundled_plugin/scripts/workbench_setup.py +14 -2
- package/_bundled_plugin/scripts/workbench_source_excerpt.py +13 -0
- package/_bundled_plugin/scripts/workbench_source_scopes.py +18 -0
- package/_bundled_plugin/scripts/workbench_target.py +594 -136
- package/_bundled_plugin/scripts/workbench_target_state.py +1110 -21
- package/_bundled_plugin/scripts/workbench_validation.py +43 -3
- package/_bundled_plugin/shared/workbench-history-repairs.json +77 -35
- package/_bundled_plugin/shared/workbench-migrations.json +100 -0
- package/_bundled_plugin/skills/cloud-findings/SKILL.md +5 -5
- package/_bundled_plugin/skills/deep-security-scan/SKILL.md +7 -50
- package/_bundled_plugin/skills/fix-finding/SKILL.md +2 -1
- package/_bundled_plugin/skills/publish-findings/SKILL.md +24 -153
- package/_bundled_plugin/skills/publish-findings/agents/openai.yaml +2 -2
- package/_bundled_plugin/skills/publish-findings/references/checkmarx-import.md +37 -0
- package/_bundled_plugin/skills/publish-findings/references/wiz-import.md +3 -3
- package/_bundled_plugin/skills/publish-findings/scripts/collect_checkmarx.py +409 -0
- package/_bundled_plugin/skills/publish-findings/scripts/collect_continuum.py +224 -0
- package/_bundled_plugin/skills/publish-findings/scripts/collector_paths.py +63 -0
- package/_bundled_plugin/skills/security-scan/SKILL.md +9 -46
- package/_bundled_plugin/skills/security-scan/agents/openai.yaml +2 -2
- package/_bundled_plugin/skills/security-scan/references/desktop-scan.md +3 -21
- package/_bundled_plugin/skills/security-scan/references/managed-scan.md +11 -0
- package/_bundled_plugin/skills/security-scan/references/scan-results.md +15 -0
- package/_bundled_plugin/skills/security-scan/references/scoped-paths.md +23 -0
- package/_bundled_plugin/skills/security-scan/references/sdk-files.md +24 -0
- package/_bundled_plugin/skills/threat-model-visualize/scripts/build_explorer.py +22 -1
- package/_bundled_plugin/skills/triage-finding/references/ticket-intake.md +6 -2
- package/bin/codex-security.mjs +2 -2
- package/dist/api.d.ts +45 -5
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +1192 -427
- package/dist/api.js.map +1 -1
- package/dist/armorcode-findings.d.ts +9 -0
- package/dist/armorcode-findings.d.ts.map +1 -0
- package/dist/armorcode-findings.js +145 -0
- package/dist/armorcode-findings.js.map +1 -0
- package/dist/artifact-export.d.ts +2 -0
- package/dist/artifact-export.d.ts.map +1 -1
- package/dist/artifact-export.js +29 -13
- package/dist/artifact-export.js.map +1 -1
- package/dist/auth.d.ts +6 -2
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +37 -18
- package/dist/auth.js.map +1 -1
- package/dist/batch-cost.d.ts +18 -0
- package/dist/batch-cost.d.ts.map +1 -0
- package/dist/batch-cost.js +41 -0
- package/dist/batch-cost.js.map +1 -0
- package/dist/bedrock-oss-pricing.d.ts +6 -0
- package/dist/bedrock-oss-pricing.d.ts.map +1 -0
- package/dist/bedrock-oss-pricing.js +58 -0
- package/dist/bedrock-oss-pricing.js.map +1 -0
- package/dist/bedrock-pricing.d.ts +15 -0
- package/dist/bedrock-pricing.d.ts.map +1 -0
- package/dist/bedrock-pricing.js +117 -0
- package/dist/bedrock-pricing.js.map +1 -0
- package/dist/blackduck-findings.d.ts +1 -1
- package/dist/blackduck-findings.d.ts.map +1 -1
- package/dist/blackduck-findings.js +24 -22
- package/dist/blackduck-findings.js.map +1 -1
- package/dist/bulk-scan-discovery.d.ts.map +1 -1
- package/dist/bulk-scan-discovery.js +4 -4
- package/dist/bulk-scan-discovery.js.map +1 -1
- package/dist/bundled-plugin.d.ts +4 -0
- package/dist/bundled-plugin.d.ts.map +1 -0
- package/dist/bundled-plugin.js +23 -0
- package/dist/bundled-plugin.js.map +1 -0
- package/dist/checkmarx-evidence.d.ts +19 -0
- package/dist/checkmarx-evidence.d.ts.map +1 -0
- package/dist/checkmarx-evidence.js +36 -0
- package/dist/checkmarx-evidence.js.map +1 -0
- package/dist/checkmarx-findings.d.ts +4 -0
- package/dist/checkmarx-findings.d.ts.map +1 -0
- package/dist/checkmarx-findings.js +27 -0
- package/dist/checkmarx-findings.js.map +1 -0
- package/dist/checkmarx-one.d.ts +4 -0
- package/dist/checkmarx-one.d.ts.map +1 -0
- package/dist/checkmarx-one.js +53 -0
- package/dist/checkmarx-one.js.map +1 -0
- package/dist/checkmarx-repository.d.ts +12 -0
- package/dist/checkmarx-repository.d.ts.map +1 -0
- package/dist/checkmarx-repository.js +181 -0
- package/dist/checkmarx-repository.js.map +1 -0
- package/dist/checkmarx-xml.d.ts +12 -0
- package/dist/checkmarx-xml.d.ts.map +1 -0
- package/dist/checkmarx-xml.js +196 -0
- package/dist/checkmarx-xml.js.map +1 -0
- package/dist/classify-scan-severity.d.ts +1 -1
- package/dist/classify-scan-severity.d.ts.map +1 -1
- package/dist/classify-scan-severity.js +11 -3
- package/dist/classify-scan-severity.js.map +1 -1
- package/dist/classify-severity-records.d.ts +1 -9
- package/dist/classify-severity-records.d.ts.map +1 -1
- package/dist/classify-severity-records.js +3 -13
- package/dist/classify-severity-records.js.map +1 -1
- package/dist/classify-severity.d.ts.map +1 -1
- package/dist/classify-severity.js +11 -10
- package/dist/classify-severity.js.map +1 -1
- package/dist/cli-argument.d.ts +4 -0
- package/dist/cli-argument.d.ts.map +1 -0
- package/dist/cli-argument.js +17 -0
- package/dist/cli-argument.js.map +1 -0
- package/dist/cli-help.d.ts +1 -1
- package/dist/cli-help.d.ts.map +1 -1
- package/dist/cli-help.js +71 -29
- package/dist/cli-help.js.map +1 -1
- package/dist/cli-hook.d.ts +3 -0
- package/dist/cli-hook.d.ts.map +1 -0
- package/dist/cli-hook.js +87 -0
- package/dist/cli-hook.js.map +1 -0
- package/dist/cli-integrations.d.ts +13 -0
- package/dist/cli-integrations.d.ts.map +1 -0
- package/dist/cli-integrations.js +333 -0
- package/dist/cli-integrations.js.map +1 -0
- package/dist/cli-mcp.d.ts +15 -0
- package/dist/cli-mcp.d.ts.map +1 -0
- package/dist/cli-mcp.js +178 -0
- package/dist/cli-mcp.js.map +1 -0
- package/dist/cli-token-view.d.ts +10 -0
- package/dist/cli-token-view.d.ts.map +1 -0
- package/dist/cli-token-view.js +41 -0
- package/dist/cli-token-view.js.map +1 -0
- package/dist/cli.d.ts +16 -8
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +3382 -2017
- package/dist/cli.js.map +1 -1
- package/dist/cloud-publish.d.ts.map +1 -1
- package/dist/cloud-publish.js +35 -33
- package/dist/cloud-publish.js.map +1 -1
- package/dist/codex-sdk-environment.d.ts +6 -0
- package/dist/codex-sdk-environment.d.ts.map +1 -1
- package/dist/codex-sdk-environment.js +19 -0
- package/dist/codex-sdk-environment.js.map +1 -1
- package/dist/command-words.d.ts +3 -0
- package/dist/command-words.d.ts.map +1 -0
- package/dist/command-words.js +46 -0
- package/dist/command-words.js.map +1 -0
- package/dist/component-scan.d.ts +19 -4
- package/dist/component-scan.d.ts.map +1 -1
- package/dist/component-scan.js +67 -9
- package/dist/component-scan.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +130 -67
- package/dist/config.js.map +1 -1
- package/dist/continuum-findings.d.ts +1 -1
- package/dist/continuum-findings.d.ts.map +1 -1
- package/dist/continuum-findings.js +149 -19
- package/dist/continuum-findings.js.map +1 -1
- package/dist/contract-values.d.ts +2 -0
- package/dist/contract-values.d.ts.map +1 -1
- package/dist/contract-values.js +12 -9
- package/dist/contract-values.js.map +1 -1
- package/dist/cost-model.d.ts +13 -1
- package/dist/cost-model.d.ts.map +1 -1
- package/dist/cost-model.js +66 -112
- package/dist/cost-model.js.map +1 -1
- package/dist/cost.d.ts +42 -3
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +484 -149
- package/dist/cost.js.map +1 -1
- package/dist/custom-publish.d.ts +4 -0
- package/dist/custom-publish.d.ts.map +1 -1
- package/dist/custom-publish.js +40 -3
- package/dist/custom-publish.js.map +1 -1
- package/dist/custom-validation-prompt.d.ts +1 -1
- package/dist/custom-validation-prompt.d.ts.map +1 -1
- package/dist/custom-validation-prompt.js +29 -19
- package/dist/custom-validation-prompt.js.map +1 -1
- package/dist/deduplication/local.d.ts +4 -2
- package/dist/deduplication/local.d.ts.map +1 -1
- package/dist/deduplication/local.js +9 -2
- package/dist/deduplication/local.js.map +1 -1
- package/dist/deduplication/refusal.d.ts.map +1 -1
- package/dist/deduplication/refusal.js +26 -5
- package/dist/deduplication/refusal.js.map +1 -1
- package/dist/deduplication/scan.d.ts +5 -0
- package/dist/deduplication/scan.d.ts.map +1 -1
- package/dist/deduplication/scan.js +24 -7
- package/dist/deduplication/scan.js.map +1 -1
- package/dist/deep-config.d.ts +0 -1
- package/dist/deep-config.d.ts.map +1 -1
- package/dist/deep-config.js +22 -33
- package/dist/deep-config.js.map +1 -1
- package/dist/deep-scan-defaults.d.ts +2 -0
- package/dist/deep-scan-defaults.d.ts.map +1 -1
- package/dist/deep-scan-defaults.js +28 -1
- package/dist/deep-scan-defaults.js.map +1 -1
- package/dist/deep-scan.d.ts +2 -0
- package/dist/deep-scan.d.ts.map +1 -1
- package/dist/deep-scan.js +44 -19
- package/dist/deep-scan.js.map +1 -1
- package/dist/default-severity-rubric.d.ts +1 -1
- package/dist/default-severity-rubric.d.ts.map +1 -1
- package/dist/default-severity-rubric.js +1 -1
- package/dist/default-severity-rubric.js.map +1 -1
- package/dist/endor-findings.d.ts +3 -1
- package/dist/endor-findings.d.ts.map +1 -1
- package/dist/endor-findings.js +86 -45
- package/dist/endor-findings.js.map +1 -1
- package/dist/errors.d.ts +4 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +15 -4
- package/dist/errors.js.map +1 -1
- package/dist/executable-path.d.ts +3 -0
- package/dist/executable-path.d.ts.map +1 -1
- package/dist/executable-path.js +26 -0
- package/dist/executable-path.js.map +1 -1
- package/dist/external-findings-import.d.ts +5 -3
- package/dist/external-findings-import.d.ts.map +1 -1
- package/dist/external-findings-import.js +19 -7
- package/dist/external-findings-import.js.map +1 -1
- package/dist/external-findings-local.d.ts +69 -5
- package/dist/external-findings-local.d.ts.map +1 -1
- package/dist/external-findings-local.js +537 -108
- package/dist/external-findings-local.js.map +1 -1
- package/dist/external-findings-publish.d.ts +13 -6
- package/dist/external-findings-publish.d.ts.map +1 -1
- package/dist/external-findings-publish.js +895 -1142
- package/dist/external-findings-publish.js.map +1 -1
- package/dist/external-findings-read.d.ts +21 -2
- package/dist/external-findings-read.d.ts.map +1 -1
- package/dist/external-findings-read.js +130 -68
- package/dist/external-findings-read.js.map +1 -1
- package/dist/external-findings.d.ts +15 -3
- package/dist/external-findings.d.ts.map +1 -1
- package/dist/external-findings.js +54 -2
- package/dist/external-findings.js.map +1 -1
- package/dist/external-import-contract.d.ts +8 -12
- package/dist/external-import-contract.d.ts.map +1 -1
- package/dist/external-import-contract.js +51 -184
- package/dist/external-import-contract.js.map +1 -1
- package/dist/external-import-models.d.ts +1 -1
- package/dist/external-import-models.d.ts.map +1 -1
- package/dist/external-import-models.js.map +1 -1
- package/dist/feedback.d.ts.map +1 -1
- package/dist/feedback.js +5 -4
- package/dist/feedback.js.map +1 -1
- package/dist/finding-prompt.d.ts +5 -0
- package/dist/finding-prompt.d.ts.map +1 -0
- package/dist/finding-prompt.js +32 -0
- package/dist/finding-prompt.js.map +1 -0
- package/dist/findings-client.d.ts +1 -0
- package/dist/findings-client.d.ts.map +1 -1
- package/dist/findings-client.js +27 -3
- package/dist/findings-client.js.map +1 -1
- package/dist/github-advisories.d.ts.map +1 -1
- package/dist/github-advisories.js +0 -2
- package/dist/github-advisories.js.map +1 -1
- package/dist/github-dependabot-findings.d.ts.map +1 -1
- package/dist/github-dependabot-findings.js +18 -8
- package/dist/github-dependabot-findings.js.map +1 -1
- package/dist/github-findings.d.ts +4 -1
- package/dist/github-findings.d.ts.map +1 -1
- package/dist/github-findings.js +73 -316
- package/dist/github-findings.js.map +1 -1
- package/dist/hosted-git-remotes.d.ts +5 -0
- package/dist/hosted-git-remotes.d.ts.map +1 -0
- package/dist/hosted-git-remotes.js +285 -0
- package/dist/hosted-git-remotes.js.map +1 -0
- package/dist/hosted-git-repository.d.ts +28 -0
- package/dist/hosted-git-repository.d.ts.map +1 -0
- package/dist/hosted-git-repository.js +222 -0
- package/dist/hosted-git-repository.js.map +1 -0
- package/dist/hosted-remediation.d.ts +1 -0
- package/dist/hosted-remediation.d.ts.map +1 -1
- package/dist/hosted-remediation.js +23 -3
- package/dist/hosted-remediation.js.map +1 -1
- package/dist/hosted-scan-protocol.js +2 -2
- package/dist/hosted-scan-protocol.js.map +1 -1
- package/dist/hosted-scan.d.ts.map +1 -1
- package/dist/hosted-scan.js +16 -11
- package/dist/hosted-scan.js.map +1 -1
- package/dist/hosted-scanner-http.d.ts +21 -0
- package/dist/hosted-scanner-http.d.ts.map +1 -0
- package/dist/hosted-scanner-http.js +204 -0
- package/dist/hosted-scanner-http.js.map +1 -0
- package/dist/import-scan.d.ts.map +1 -1
- package/dist/import-scan.js +3 -0
- package/dist/import-scan.js.map +1 -1
- package/dist/index.d.ts +21 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/inspector-findings.d.ts.map +1 -1
- package/dist/inspector-findings.js +52 -86
- package/dist/inspector-findings.js.map +1 -1
- package/dist/knowledge-base.d.ts +1 -1
- package/dist/knowledge-base.d.ts.map +1 -1
- package/dist/knowledge-base.js +102 -32
- package/dist/knowledge-base.js.map +1 -1
- package/dist/linear.d.ts +11 -0
- package/dist/linear.d.ts.map +1 -1
- package/dist/linear.js.map +1 -1
- package/dist/local-git-metadata.d.ts +5 -2
- package/dist/local-git-metadata.d.ts.map +1 -1
- package/dist/local-git-metadata.js +8 -5
- package/dist/local-git-metadata.js.map +1 -1
- package/dist/multiscan.d.ts +10 -4
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +217 -102
- package/dist/multiscan.js.map +1 -1
- package/dist/native-json-findings.d.ts +2 -1
- package/dist/native-json-findings.d.ts.map +1 -1
- package/dist/native-json-findings.js +12 -2
- package/dist/native-json-findings.js.map +1 -1
- package/dist/opengrep-findings.d.ts +5 -2
- package/dist/opengrep-findings.d.ts.map +1 -1
- package/dist/opengrep-findings.js +54 -33
- package/dist/opengrep-findings.js.map +1 -1
- package/dist/operation-telemetry.d.ts +104 -0
- package/dist/operation-telemetry.d.ts.map +1 -0
- package/dist/operation-telemetry.js +293 -0
- package/dist/operation-telemetry.js.map +1 -0
- package/dist/plugin-python-probe.d.ts +4 -0
- package/dist/plugin-python-probe.d.ts.map +1 -0
- package/dist/plugin-python-probe.js +10 -0
- package/dist/plugin-python-probe.js.map +1 -0
- package/dist/private-finding-import.d.ts +99 -9
- package/dist/private-finding-import.d.ts.map +1 -1
- package/dist/private-finding-import.js +116 -152
- package/dist/private-finding-import.js.map +1 -1
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +53 -13
- package/dist/project-config.js.map +1 -1
- package/dist/prompt-files.d.ts +7 -2
- package/dist/prompt-files.d.ts.map +1 -1
- package/dist/prompt-files.js +42 -20
- package/dist/prompt-files.js.map +1 -1
- package/dist/provider-profile.d.ts +1 -1
- package/dist/provider-profile.d.ts.map +1 -1
- package/dist/provider-profile.js +12 -10
- package/dist/provider-profile.js.map +1 -1
- package/dist/publication-telemetry.d.ts +45 -0
- package/dist/publication-telemetry.d.ts.map +1 -0
- package/dist/publication-telemetry.js +50 -0
- package/dist/publication-telemetry.js.map +1 -0
- package/dist/publication.d.ts +1 -1
- package/dist/publication.d.ts.map +1 -1
- package/dist/publication.js.map +1 -1
- package/dist/publish.d.ts +4 -0
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +42 -2
- package/dist/publish.js.map +1 -1
- package/dist/record.d.ts +1 -5
- package/dist/record.d.ts.map +1 -1
- package/dist/record.js +3 -51
- package/dist/record.js.map +1 -1
- package/dist/remediation.d.ts +1 -4
- package/dist/remediation.d.ts.map +1 -1
- package/dist/remediation.js +6 -8
- package/dist/remediation.js.map +1 -1
- package/dist/request-metadata.d.ts +3 -0
- package/dist/request-metadata.d.ts.map +1 -1
- package/dist/request-metadata.js +9 -0
- package/dist/request-metadata.js.map +1 -1
- package/dist/result.d.ts +4 -0
- package/dist/result.d.ts.map +1 -1
- package/dist/result.js +1 -1
- package/dist/result.js.map +1 -1
- package/dist/retry-windows-rename.d.ts +8 -0
- package/dist/retry-windows-rename.d.ts.map +1 -0
- package/dist/retry-windows-rename.js +24 -0
- package/dist/retry-windows-rename.js.map +1 -0
- package/dist/runtime.d.ts +54 -6
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +1084 -256
- package/dist/runtime.js.map +1 -1
- package/dist/saved-scan-bootstrap.d.ts +7 -1
- package/dist/saved-scan-bootstrap.d.ts.map +1 -1
- package/dist/saved-scan-bootstrap.js +269 -114
- package/dist/saved-scan-bootstrap.js.map +1 -1
- package/dist/scan-activity.d.ts.map +1 -1
- package/dist/scan-activity.js +141 -56
- package/dist/scan-activity.js.map +1 -1
- package/dist/scan-archive-path.d.ts +2 -0
- package/dist/scan-archive-path.d.ts.map +1 -0
- package/dist/scan-archive-path.js +5 -0
- package/dist/scan-archive-path.js.map +1 -0
- package/dist/scan-comparison.d.ts +10 -5
- package/dist/scan-comparison.d.ts.map +1 -1
- package/dist/scan-comparison.js +66 -17
- package/dist/scan-comparison.js.map +1 -1
- package/dist/scan-dashboard.d.ts +7 -6
- package/dist/scan-dashboard.d.ts.map +1 -1
- package/dist/scan-dashboard.js +92 -43
- package/dist/scan-dashboard.js.map +1 -1
- package/dist/scan-executor.d.ts +10 -1
- package/dist/scan-executor.d.ts.map +1 -1
- package/dist/scan-executor.js +24 -2
- package/dist/scan-executor.js.map +1 -1
- package/dist/scan-history-renderer.d.ts +1 -0
- package/dist/scan-history-renderer.d.ts.map +1 -1
- package/dist/scan-history-renderer.js +34 -28
- package/dist/scan-history-renderer.js.map +1 -1
- package/dist/scan-logs.d.ts +12 -0
- package/dist/scan-logs.d.ts.map +1 -1
- package/dist/scan-logs.js +131 -78
- package/dist/scan-logs.js.map +1 -1
- package/dist/scan-measurement.d.ts +26 -0
- package/dist/scan-measurement.d.ts.map +1 -0
- package/dist/scan-measurement.js +77 -0
- package/dist/scan-measurement.js.map +1 -0
- package/dist/scan-progress.d.ts +1 -0
- package/dist/scan-progress.d.ts.map +1 -1
- package/dist/scan-progress.js +3 -0
- package/dist/scan-progress.js.map +1 -1
- package/dist/scan-sessions.d.ts.map +1 -1
- package/dist/scan-sessions.js +4 -1
- package/dist/scan-sessions.js.map +1 -1
- package/dist/scan-settings.d.ts +1 -1
- package/dist/scan-settings.d.ts.map +1 -1
- package/dist/scan-settings.js +1 -24
- package/dist/scan-settings.js.map +1 -1
- package/dist/scanner-import.d.ts +25 -13
- package/dist/scanner-import.d.ts.map +1 -1
- package/dist/scanner-import.js +216 -97
- package/dist/scanner-import.js.map +1 -1
- package/dist/scanner-repository-url.d.ts +4 -1
- package/dist/scanner-repository-url.d.ts.map +1 -1
- package/dist/scanner-repository-url.js +10 -6
- package/dist/scanner-repository-url.js.map +1 -1
- package/dist/security-policy.d.ts +1 -1
- package/dist/security-policy.d.ts.map +1 -1
- package/dist/security-policy.js +26 -6
- package/dist/security-policy.js.map +1 -1
- package/dist/semgrep-findings.d.ts +6 -3
- package/dist/semgrep-findings.d.ts.map +1 -1
- package/dist/semgrep-findings.js +72 -42
- package/dist/semgrep-findings.js.map +1 -1
- package/dist/semgrep-guardian-findings.d.ts +38 -0
- package/dist/semgrep-guardian-findings.d.ts.map +1 -0
- package/dist/semgrep-guardian-findings.js +165 -0
- package/dist/semgrep-guardian-findings.js.map +1 -0
- package/dist/semgrep-platform-collector.d.ts +26 -0
- package/dist/semgrep-platform-collector.d.ts.map +1 -0
- package/dist/semgrep-platform-collector.js +108 -0
- package/dist/semgrep-platform-collector.js.map +1 -0
- package/dist/semgrep-platform-findings.d.ts +157 -6
- package/dist/semgrep-platform-findings.d.ts.map +1 -1
- package/dist/semgrep-platform-findings.js +766 -103
- package/dist/semgrep-platform-findings.js.map +1 -1
- package/dist/server/api.d.ts +1 -1
- package/dist/server/api.d.ts.map +1 -1
- package/dist/server/api.js.map +1 -1
- package/dist/server/embedding-tokenizer.cdx.json +33 -0
- package/dist/server/embedding-tokenizer.d.ts +2 -0
- package/dist/server/embedding-tokenizer.d.ts.map +1 -0
- package/dist/server/embedding-tokenizer.js +322 -0
- package/dist/server/embedding-tokenizer.js.map +6 -0
- package/dist/server/embeddings.d.ts +16 -2
- package/dist/server/embeddings.d.ts.map +1 -1
- package/dist/server/embeddings.js +35 -5
- package/dist/server/embeddings.js.map +1 -1
- package/dist/session-lines.d.ts +5 -0
- package/dist/session-lines.d.ts.map +1 -0
- package/dist/session-lines.js +60 -0
- package/dist/session-lines.js.map +1 -0
- package/dist/severity-review.d.ts +3 -1
- package/dist/severity-review.d.ts.map +1 -1
- package/dist/severity-review.js +3 -2
- package/dist/severity-review.js.map +1 -1
- package/dist/skill-authentication.d.ts +1 -0
- package/dist/skill-authentication.d.ts.map +1 -1
- package/dist/skill-authentication.js +1 -0
- package/dist/skill-authentication.js.map +1 -1
- package/dist/snyk-findings.d.ts +9 -2
- package/dist/snyk-findings.d.ts.map +1 -1
- package/dist/snyk-findings.js +90 -70
- package/dist/snyk-findings.js.map +1 -1
- package/dist/snyk-rest-findings.d.ts +59 -0
- package/dist/snyk-rest-findings.d.ts.map +1 -0
- package/dist/snyk-rest-findings.js +879 -0
- package/dist/snyk-rest-findings.js.map +1 -0
- package/dist/snyk-token-origin.d.ts +4 -0
- package/dist/snyk-token-origin.d.ts.map +1 -0
- package/dist/snyk-token-origin.js +82 -0
- package/dist/snyk-token-origin.js.map +1 -0
- package/dist/sonar-collector.d.ts.map +1 -1
- package/dist/sonar-collector.js +0 -3
- package/dist/sonar-collector.js.map +1 -1
- package/dist/sonar-findings.d.ts +1 -1
- package/dist/sonar-findings.d.ts.map +1 -1
- package/dist/sonar-findings.js +2 -4
- package/dist/sonar-findings.js.map +1 -1
- package/dist/sonar-import.d.ts +3 -0
- package/dist/sonar-import.d.ts.map +1 -1
- package/dist/sonar-import.js +30 -34
- package/dist/sonar-import.js.map +1 -1
- package/dist/stored-finding-projection.d.ts +6 -0
- package/dist/stored-finding-projection.d.ts.map +1 -0
- package/dist/stored-finding-projection.js +104 -0
- package/dist/stored-finding-projection.js.map +1 -0
- package/dist/stored-findings-publication.d.ts +23 -0
- package/dist/stored-findings-publication.d.ts.map +1 -0
- package/dist/stored-findings-publication.js +169 -0
- package/dist/stored-findings-publication.js.map +1 -0
- package/dist/target-drift.d.ts +9 -0
- package/dist/target-drift.d.ts.map +1 -0
- package/dist/target-drift.js +27 -0
- package/dist/target-drift.js.map +1 -0
- package/dist/targets.d.ts +8 -1
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +131 -42
- package/dist/targets.js.map +1 -1
- package/dist/tenable-findings.d.ts +6 -0
- package/dist/tenable-findings.d.ts.map +1 -0
- package/dist/tenable-findings.js +122 -0
- package/dist/tenable-findings.js.map +1 -0
- package/dist/terminal-stream.d.ts +13 -0
- package/dist/terminal-stream.d.ts.map +1 -0
- package/dist/terminal-stream.js +35 -0
- package/dist/terminal-stream.js.map +1 -0
- package/dist/trivy-findings.d.ts +19 -0
- package/dist/trivy-findings.d.ts.map +1 -0
- package/dist/trivy-findings.js +424 -0
- package/dist/trivy-findings.js.map +1 -0
- package/dist/trivy-import.d.ts +19 -0
- package/dist/trivy-import.d.ts.map +1 -0
- package/dist/trivy-import.js +151 -0
- package/dist/trivy-import.js.map +1 -0
- package/dist/trusted-executable.d.ts +6 -0
- package/dist/trusted-executable.d.ts.map +1 -1
- package/dist/trusted-executable.js +140 -37
- package/dist/trusted-executable.js.map +1 -1
- package/dist/validation-records.js +1 -1
- package/dist/validation-records.js.map +1 -1
- package/dist/veracode-findings.d.ts +1 -1
- package/dist/veracode-findings.d.ts.map +1 -1
- package/dist/veracode-findings.js +19 -6
- package/dist/veracode-findings.js.map +1 -1
- package/dist/version.d.ts +3 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +184 -32
- package/dist/version.js.map +1 -1
- package/dist/vertex-pricing.d.ts +8 -0
- package/dist/vertex-pricing.d.ts.map +1 -0
- package/dist/vertex-pricing.js +20 -0
- package/dist/vertex-pricing.js.map +1 -0
- package/dist/windows-path.d.ts +1 -0
- package/dist/windows-path.d.ts.map +1 -1
- package/dist/windows-path.js +26 -1
- package/dist/windows-path.js.map +1 -1
- package/dist/wiz-findings.d.ts +6 -2
- package/dist/wiz-findings.d.ts.map +1 -1
- package/dist/wiz-findings.js +65 -89
- package/dist/wiz-findings.js.map +1 -1
- package/docs/classify-severity-records.md +27 -12
- package/docs/cli.md +853 -639
- package/docs/dedupe-records.md +44 -24
- package/docs/findings-service.md +84 -44
- package/docs/hosted-remediation.md +27 -11
- package/docs/hosted-scans.md +50 -42
- package/docs/sdk.md +903 -0
- package/docs/telemetry.md +236 -0
- package/docs/validate-records.md +78 -44
- package/package.json +23 -16
- package/schemas/external-findings.schema.json +4 -1
- package/_bundled_plugin/mcp/helpers.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/helpers.mjs.br.part-001 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-001 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-002 +0 -0
- package/_bundled_plugin/schemas/tools/deep-reducer.schema.json +0 -96
- package/dist/external-imports-feature.d.ts +0 -6
- package/dist/external-imports-feature.d.ts.map +0 -1
- package/dist/external-imports-feature.js +0 -51
- package/dist/external-imports-feature.js.map +0 -1
- package/dist/finding-normalization.d.ts +0 -5
- package/dist/finding-normalization.d.ts.map +0 -1
- package/dist/finding-normalization.js +0 -155
- package/dist/finding-normalization.js.map +0 -1
- package/dist/reader-selection.d.ts +0 -13
- package/dist/reader-selection.d.ts.map +0 -1
- package/dist/reader-selection.js +0 -81
- package/dist/reader-selection.js.map +0 -1
|
@@ -1,8 +1,57 @@
|
|
|
1
|
-
import { canonicalNumber, validateExternalEvidence, } from "./external-import-contract.js";
|
|
2
|
-
import {
|
|
1
|
+
import { DEFAULT_CLOUD_STRING_BYTES, canonicalNumber, validateExternalEvidence, } from "./external-import-contract.js";
|
|
2
|
+
import { hostedRepositoryMatches, normalizeHostedGitRepositoryUrl, hostedRepositoryUrlKey, isPublicGitHost as publicGitHost, gitServiceHostname, } from "./hosted-git-repository.js";
|
|
3
|
+
import { isGitHubCloudHost } from "./git-remote.js";
|
|
3
4
|
import { position, weaknessIds } from "./native-json-findings.js";
|
|
4
|
-
import { array, normalizeRecords, record, relativePath, repositoryFilePath, requiredText, stableId, text, } from "./scanner-import.js";
|
|
5
|
-
import {
|
|
5
|
+
import { array, normalizeRecords, record, relativePath, repositoryFilePath, scannerSeverity, strings, requiredText, stableId, text, } from "./scanner-import.js";
|
|
6
|
+
import { hostedNumberToken, hostedNativeRepositoryUrl, hostedRepositoryUrl, } from "./hosted-scanner-http.js";
|
|
7
|
+
import { isRecord } from "./record.js";
|
|
8
|
+
import { declaredScannerRepositoryUrl, validScannerRepositoryUrl, } from "./scanner-repository-url.js";
|
|
9
|
+
export const semgrepPlatformFormat = "semgrep-platform-findings/v2";
|
|
10
|
+
export const SEMGREP_PLATFORM_PRODUCTS = ["sast", "sca", "ai_sast"];
|
|
11
|
+
export const semgrepSelectionFormat = "semgrep-platform-selection/v1";
|
|
12
|
+
export function isSemgrepPlatformFormat(format) {
|
|
13
|
+
return format === semgrepSelectionFormat || format === semgrepPlatformFormat;
|
|
14
|
+
}
|
|
15
|
+
function selectedProjectUrl(value, label) {
|
|
16
|
+
return declaredScannerRepositoryUrl(value, label, "local");
|
|
17
|
+
}
|
|
18
|
+
/** Recover the native collection scope, including when every row was excluded. */
|
|
19
|
+
export function semgrepPlatformReportScope(input, provider, references = []) {
|
|
20
|
+
const format = "sourceFormat" in input ? input.sourceFormat : undefined;
|
|
21
|
+
if ("semgrepPlatformScope" in input &&
|
|
22
|
+
input.semgrepPlatformScope !== undefined &&
|
|
23
|
+
!isSemgrepPlatformFormat(format))
|
|
24
|
+
throw new Error("A normalized Semgrep Platform report scope requires its source format.");
|
|
25
|
+
if (!isSemgrepPlatformFormat(format)) {
|
|
26
|
+
if (provider === "semgrep" &&
|
|
27
|
+
typeof format === "string" &&
|
|
28
|
+
format.startsWith("semgrep-platform-"))
|
|
29
|
+
throw new Error("Unsupported Semgrep Platform format. Recollect the findings.");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const scope = record("semgrepPlatformScope" in input ? input.semgrepPlatformScope : undefined, "Normalized Semgrep report scope");
|
|
33
|
+
const readUrl = format === semgrepSelectionFormat
|
|
34
|
+
? selectedProjectUrl
|
|
35
|
+
: hostedRepositoryUrl;
|
|
36
|
+
const url = readUrl("sourceRepositoryUrl" in input ? input.sourceRepositoryUrl : undefined, "Semgrep Platform");
|
|
37
|
+
if (format !== semgrepSelectionFormat && references.length)
|
|
38
|
+
selectionRepository(url, references);
|
|
39
|
+
return {
|
|
40
|
+
format,
|
|
41
|
+
deployment: requiredText(scope["deployment"], "Semgrep deployment"),
|
|
42
|
+
projectId: savedPlatformId(requiredText(scope["projectId"], "Semgrep project ID")),
|
|
43
|
+
ref: requiredText(scope["ref"], "Semgrep ref"),
|
|
44
|
+
product: scopeProduct(scope["product"], format !== semgrepSelectionFormat),
|
|
45
|
+
url,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function semgrepPlatformReportRepository(input) {
|
|
49
|
+
return semgrepPlatformReportScope(input)?.url;
|
|
50
|
+
}
|
|
51
|
+
// Raw JSON numbers are represented as JavaScript objects during lossless parsing.
|
|
52
|
+
export function responseRecord(value, label) {
|
|
53
|
+
return record(hostedNumberToken(value) === undefined ? value : undefined, label);
|
|
54
|
+
}
|
|
6
55
|
// These v1 Findings API response fields belong only to AI detections or Supply Chain.
|
|
7
56
|
const nonSastFields = [
|
|
8
57
|
"ai_impact",
|
|
@@ -24,23 +73,19 @@ function identifiesNonSastProduct(value) {
|
|
|
24
73
|
}
|
|
25
74
|
// Node 22 supports JSON source text and raw values. The SDK targets the ES2022 type library.
|
|
26
75
|
const wireJson = JSON;
|
|
27
|
-
|
|
28
|
-
function responseRecord(value, label) {
|
|
29
|
-
return record(wireJson.isRawJSON(value) ? undefined : value, label);
|
|
30
|
-
}
|
|
31
|
-
function sourceLine(value) {
|
|
76
|
+
function sourceLine(value, coerceStrings) {
|
|
32
77
|
if (value == null)
|
|
33
78
|
return null;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
79
|
+
const token = hostedNumberToken(value);
|
|
80
|
+
// A long fraction can round to an integer if it is converted before checking its decimal value.
|
|
81
|
+
if (token !== undefined)
|
|
82
|
+
return position(Number(semgrepPlatformIdOrUndefined(wireJson.rawJSON(token))), "Semgrep source line");
|
|
83
|
+
return position(coerceStrings ? Number(semgrepPlatformId(value)) : value, "Semgrep source line");
|
|
38
84
|
}
|
|
39
|
-
|
|
40
|
-
function parseSemgrepResponse(json) {
|
|
85
|
+
export function parseSemgrepResponse(json) {
|
|
41
86
|
return responseRecord(JSON.parse(json.replace(/^\uFEFF/u, ""), (_key, value, context) => typeof value === "number" ? wireJson.rawJSON(context.source) : value), "Semgrep API response");
|
|
42
87
|
}
|
|
43
|
-
function
|
|
88
|
+
export function semgrepPlatformIdOrUndefined(value) {
|
|
44
89
|
let token;
|
|
45
90
|
if (wireJson.isRawJSON(value))
|
|
46
91
|
token = value.rawJSON;
|
|
@@ -57,71 +102,278 @@ function platformId(value) {
|
|
|
57
102
|
? id
|
|
58
103
|
: undefined;
|
|
59
104
|
}
|
|
60
|
-
function
|
|
61
|
-
const id =
|
|
62
|
-
if (
|
|
105
|
+
export function semgrepPlatformId(value) {
|
|
106
|
+
const id = semgrepPlatformIdOrUndefined(value);
|
|
107
|
+
if (id === undefined)
|
|
63
108
|
throw new Error("Expected an exact, positive Semgrep Platform ID.");
|
|
64
109
|
return id;
|
|
65
110
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
111
|
+
function savedPlatformId(value) {
|
|
112
|
+
if (typeof value !== "string")
|
|
113
|
+
return semgrepPlatformId(value);
|
|
114
|
+
const canonical = semgrepPlatformId(wireJson.rawJSON(value));
|
|
115
|
+
if (canonical !== value && !/^[1-9][0-9]*$/u.test(value))
|
|
116
|
+
throw new Error("Invalid saved Semgrep project ID.");
|
|
117
|
+
return value;
|
|
118
|
+
}
|
|
119
|
+
function scopeOf(deployment, project, ref, readId = semgrepPlatformId, readUrl = hostedRepositoryUrl) {
|
|
120
|
+
const row = responseRecord(project, "Semgrep project");
|
|
121
|
+
const id = readId(row["id"]);
|
|
122
|
+
return {
|
|
123
|
+
deployment: requiredText(deployment, "Semgrep deployment"),
|
|
71
124
|
project: {
|
|
72
|
-
id:
|
|
73
|
-
name: requiredText(
|
|
74
|
-
url:
|
|
125
|
+
id: text(row["id"]) ?? id,
|
|
126
|
+
name: requiredText(row["name"], "Semgrep project name"),
|
|
127
|
+
url: readUrl(row["url"], "Semgrep Platform"),
|
|
75
128
|
},
|
|
76
|
-
ref: requiredText(
|
|
129
|
+
ref: requiredText(ref, "Semgrep ref"),
|
|
77
130
|
product: "sast",
|
|
78
131
|
};
|
|
132
|
+
}
|
|
133
|
+
export function projectAliases(name, url, references = []) {
|
|
134
|
+
const { hostname, pathname } = new URL(url);
|
|
135
|
+
const path = pathname.slice(1).replace(/\/$/u, "");
|
|
136
|
+
const decodePath = (decode) => path
|
|
137
|
+
.split("/")
|
|
138
|
+
.map((segment) => {
|
|
139
|
+
try {
|
|
140
|
+
// Keep encoded separators within their original segment.
|
|
141
|
+
const label = decode(segment);
|
|
142
|
+
return /[/\\]/u.test(label) ? segment : label;
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return segment;
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
.join("/");
|
|
149
|
+
const { name: key, source } = repositoryContext(url, references);
|
|
150
|
+
const paths = [path, decodePath(decodeURIComponent)];
|
|
151
|
+
const publicHost = publicGitHost(gitServiceHostname(hostname));
|
|
152
|
+
const knownGitSuffix = source.platform === "github" || source.platform === "gitlab" || publicHost;
|
|
153
|
+
if (knownGitSuffix)
|
|
154
|
+
paths.push(...paths.map((path) => path.replace(/\.git$/u, "")));
|
|
155
|
+
const pathKeys = new Set(paths.flatMap((path) => [
|
|
156
|
+
key(path),
|
|
157
|
+
key(path.slice(path.lastIndexOf("/") + 1)),
|
|
158
|
+
]));
|
|
159
|
+
const shortName = name.slice(name.lastIndexOf("/") + 1);
|
|
160
|
+
return {
|
|
161
|
+
has: (label) => label === name || label === shortName || pathKeys.has(key(label)),
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/** A real HTTP URL can elide its default port. Git transport serializations retain explicit ports. */
|
|
165
|
+
function nativeHttp(url) {
|
|
166
|
+
return URL.parse(url)?.href ?? url;
|
|
167
|
+
}
|
|
168
|
+
/** Readers may pass the SCM web link from the project response or its equivalent Git transport. */
|
|
169
|
+
export function semgrepReferenceMatches(source, url) {
|
|
170
|
+
// A standard explicit Git HTTP(S) helper carries the same fetch URL.
|
|
171
|
+
const helper = /^(?:https?|ftps?)::(?=([a-zA-Z]+):\/\/)/u.exec(url);
|
|
172
|
+
if (helper)
|
|
173
|
+
return (/^https?$/iu.test(helper[1]) &&
|
|
174
|
+
hostedRepositoryMatches(source, url.slice(helper[0].length)));
|
|
175
|
+
if (hostedRepositoryMatches(source, url))
|
|
176
|
+
return true;
|
|
177
|
+
try {
|
|
178
|
+
// Serialize only a valid repository link. Git checkout URLs retain their original bytes.
|
|
179
|
+
const link = hostedRepositoryUrl(url, "Semgrep");
|
|
180
|
+
return hostedRepositoryMatches(source, new URL(link).href);
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
export function semgrepPlatformRepositoryReference(url, references) {
|
|
187
|
+
const projectUrl = nativeHttp(url);
|
|
188
|
+
const source = { url: projectUrl };
|
|
189
|
+
const nativeHost = gitServiceHostname(URL.parse(url)?.hostname ?? "");
|
|
190
|
+
const ownPlatformMatches = ({ url, platform }) => platform !== undefined &&
|
|
191
|
+
semgrepReferenceMatches({ url: projectUrl, platform }, url);
|
|
192
|
+
const platform = isGitHubCloudHost(nativeHost)
|
|
193
|
+
? "github"
|
|
194
|
+
: references.find(ownPlatformMatches)?.platform;
|
|
195
|
+
if (platform) {
|
|
196
|
+
source.platform = platform;
|
|
197
|
+
if (references.some((ref) => ref.platform &&
|
|
198
|
+
ref.platform !== platform &&
|
|
199
|
+
(ownPlatformMatches(ref) || semgrepReferenceMatches(source, ref.url))))
|
|
200
|
+
throw new Error("Conflicting SCM platforms for the selected Semgrep repository.");
|
|
201
|
+
}
|
|
202
|
+
return source;
|
|
203
|
+
}
|
|
204
|
+
/** Keep provider transport spelling independently of its resolved HTTP repository. */
|
|
205
|
+
export function semgrepProjectUrlEvidence(raw, resolved, mapping) {
|
|
206
|
+
if (resolved === undefined)
|
|
207
|
+
return { sourceRepositoryUrl: mapping };
|
|
208
|
+
if (typeof raw === "string" && raw !== resolved)
|
|
209
|
+
return {
|
|
210
|
+
nativeProjectUrl: raw,
|
|
211
|
+
...(mapping && { sourceRepositoryUrl: mapping }),
|
|
212
|
+
};
|
|
213
|
+
return {};
|
|
214
|
+
}
|
|
215
|
+
/** Interpret a project's native SSH spelling only when its Git host is known. */
|
|
216
|
+
export function semgrepNativeProjectUrl(value, references) {
|
|
217
|
+
if (value == null || value === "")
|
|
218
|
+
return;
|
|
219
|
+
const label = "Semgrep project repository";
|
|
220
|
+
if (typeof value === "string" &&
|
|
221
|
+
value.trim() === value &&
|
|
222
|
+
typeof references !== "function" &&
|
|
223
|
+
references.length) {
|
|
224
|
+
// Derive only a candidate from the native SSH spelling. The reader's Git fetch address must match.
|
|
225
|
+
const candidate = normalizeHostedGitRepositoryUrl(value, undefined, true);
|
|
226
|
+
if (candidate !== value &&
|
|
227
|
+
references.some(({ platform, url }) => (platform === "github" || platform === "gitlab") &&
|
|
228
|
+
semgrepReferenceMatches({ url: candidate, platform }, url)))
|
|
229
|
+
return hostedRepositoryUrl(candidate, label);
|
|
230
|
+
}
|
|
231
|
+
return hostedNativeRepositoryUrl(value, label);
|
|
232
|
+
}
|
|
233
|
+
function repositoryContext(projectUrl, references = [], target = "local") {
|
|
234
|
+
const source = semgrepPlatformRepositoryReference(projectUrl, typeof references === "function" ? [] : references);
|
|
235
|
+
const github = source.platform === "github";
|
|
236
|
+
return {
|
|
237
|
+
source,
|
|
238
|
+
selectableProject: validScannerRepositoryUrl(projectUrl, "local"),
|
|
239
|
+
key: (url) => typeof references === "function"
|
|
240
|
+
? references(nativeHttp(url))
|
|
241
|
+
: hostedRepositoryUrlKey(target === "cloud" ? url : nativeHttp(url), github, source.platform === "gitlab", target),
|
|
242
|
+
name: (name) => (github ? name.toLowerCase() : name),
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
export function selectionRepository(projectUrl, references = [], target = "local") {
|
|
246
|
+
const repository = repositoryContext(projectUrl, references, target);
|
|
247
|
+
if (!references.every(({ url }) => {
|
|
248
|
+
if (target === "local")
|
|
249
|
+
return semgrepReferenceMatches(repository.source, url);
|
|
250
|
+
const mapped = normalizeHostedGitRepositoryUrl(url, projectUrl, repository.source.platform !== undefined);
|
|
251
|
+
return repository.key(mapped) === repository.key(projectUrl);
|
|
252
|
+
}))
|
|
253
|
+
throw new Error("The reader's source repository does not match the selected Semgrep project.");
|
|
254
|
+
return repository;
|
|
255
|
+
}
|
|
256
|
+
function repositoryWithOnlyAlias(finding, names) {
|
|
257
|
+
const repo = record(finding["repository"] ?? {}, "Semgrep finding repository");
|
|
258
|
+
const label = text(repo["name"]);
|
|
259
|
+
return label && !names.has(label) && repo["id"] == null && !text(repo["url"])
|
|
260
|
+
? label
|
|
261
|
+
: undefined;
|
|
262
|
+
}
|
|
263
|
+
function hasSemgrepScaEvidence(finding) {
|
|
264
|
+
return (finding["found_dependency"] != null ||
|
|
265
|
+
finding["vulnerability_identifier"] != null);
|
|
266
|
+
}
|
|
267
|
+
/** Complete reports record the repository labels returned by the project-ID-scoped request. */
|
|
268
|
+
export function checkSemgrepPlatformRow(finding, scope, aliases, repository = repositoryContext(scope.project.url), readId = semgrepPlatformId, repositoryUrl = hostedNativeRepositoryUrl, capture = false) {
|
|
269
|
+
const repo = responseRecord(finding["repository"] ?? (aliases ? {} : undefined), "Semgrep finding repository");
|
|
270
|
+
const repositoryId = repo["id"] == null ? undefined : readId(repo["id"]);
|
|
271
|
+
const hasUrl = repo["url"] != null && (!aliases || repo["url"] !== "");
|
|
272
|
+
const name = repo["name"];
|
|
273
|
+
const encodedPath = new URL(scope.project.url).pathname.replace(/^\/|\/$/gu, "");
|
|
274
|
+
const decodedPath = decodeURIComponent(encodedPath);
|
|
275
|
+
// Archived captures may retain the encoded path spelling as their repository name.
|
|
276
|
+
const matchesQualifiedName = (normalize) => {
|
|
277
|
+
const label = typeof name === "string" ? normalize(name) : null;
|
|
278
|
+
return (!!label?.includes("/") &&
|
|
279
|
+
(label === normalize(decodedPath) ||
|
|
280
|
+
(!capture && label === normalize(encodedPath))));
|
|
281
|
+
};
|
|
282
|
+
const selectionRepositoryMatches = hasUrl ||
|
|
283
|
+
(repo["url"] == null &&
|
|
284
|
+
repositoryId !== undefined &&
|
|
285
|
+
matchesQualifiedName(repository.name));
|
|
286
|
+
if (!aliases) {
|
|
287
|
+
readId(finding["id"]);
|
|
288
|
+
if (!selectionRepositoryMatches)
|
|
289
|
+
throw new Error("Semgrep finding repository does not match the selected project and ref.");
|
|
290
|
+
}
|
|
291
|
+
if (repositoryId !== undefined &&
|
|
292
|
+
repositoryId !== semgrepPlatformId(wireJson.rawJSON(scope.project.id)))
|
|
293
|
+
throw new Error("Semgrep finding repository does not match the selected project and ref.");
|
|
294
|
+
const declaredProduct = scope.product === "sast" ? ["sast", "code"] : [scope.product];
|
|
295
|
+
for (const product of [finding["issue_type"], finding["product"]]) {
|
|
296
|
+
if (product != null &&
|
|
297
|
+
(typeof product !== "string" ||
|
|
298
|
+
!declaredProduct.includes(product.toLowerCase())))
|
|
299
|
+
throw new Error(scope.product === "sast"
|
|
300
|
+
? "Select Semgrep Code (SAST) findings."
|
|
301
|
+
: "Semgrep finding does not match the selected product.");
|
|
302
|
+
}
|
|
303
|
+
if ((!aliases || finding["ref"] !== undefined) &&
|
|
304
|
+
finding["ref"] !== scope.ref)
|
|
305
|
+
throw new Error("Semgrep finding does not belong to the selected project and ref.");
|
|
306
|
+
if (hasUrl) {
|
|
307
|
+
const url = repositoryUrl(repo["url"], "Semgrep finding repository", repository.source.platform === "github" ||
|
|
308
|
+
repository.source.platform === "gitlab"
|
|
309
|
+
? new URL(repository.source.url).hostname
|
|
310
|
+
: undefined);
|
|
311
|
+
if (repository.key(url) !== repository.key(scope.project.url))
|
|
312
|
+
throw new Error("Semgrep finding repository does not match the selected project and ref.");
|
|
313
|
+
}
|
|
314
|
+
// A verified ID or URL can identify a bulk row whose optional display name is blank.
|
|
315
|
+
const alias = typeof name === "string" && (repositoryId !== undefined || hasUrl)
|
|
316
|
+
? text(name)
|
|
317
|
+
: name;
|
|
318
|
+
if (aliases &&
|
|
319
|
+
alias != null &&
|
|
320
|
+
!aliases.has(requiredText(alias, "Semgrep repository name")))
|
|
321
|
+
throw new Error("Semgrep finding repository does not match the selected project and ref.");
|
|
322
|
+
if ((scope.product === "sast" &&
|
|
323
|
+
!capture &&
|
|
324
|
+
identifiesNonSastProduct(finding)) ||
|
|
325
|
+
(scope.product === "ai_sast" && hasSemgrepScaEvidence(finding)))
|
|
326
|
+
throw new Error("Select Semgrep Code (SAST) findings.");
|
|
327
|
+
return (scope.product === "sast" &&
|
|
328
|
+
repository.selectableProject &&
|
|
329
|
+
// A replayable selection requires a repository on the native project response.
|
|
330
|
+
(scope.sourceRepositoryUrl === undefined ||
|
|
331
|
+
scope.nativeProjectUrl !== undefined) &&
|
|
332
|
+
finding["ref"] === scope.ref &&
|
|
333
|
+
selectionRepositoryMatches &&
|
|
334
|
+
[finding["id"], repo["id"]].every((id) => id == null || semgrepPlatformIdOrUndefined(id) !== undefined) &&
|
|
335
|
+
// Before a reader hint promotes a backlog row, check its complete selected projection.
|
|
336
|
+
(!aliases ||
|
|
337
|
+
hasUrl ||
|
|
338
|
+
matchesQualifiedName(repositoryContext(scope.project.url).name) ||
|
|
339
|
+
normalizePlatformRows([{ finding, selectable: true }], scope, "local")
|
|
340
|
+
.excluded.length === 0));
|
|
341
|
+
}
|
|
342
|
+
export function requireSemgrepFullRef(ref) {
|
|
79
343
|
// git-check-ref-format distinguishes literal branch/tag names from revision expressions.
|
|
80
|
-
const refParts =
|
|
344
|
+
const refParts = ref.split("/");
|
|
81
345
|
if (refParts[0] !== "refs" ||
|
|
82
346
|
refParts.length < 2 ||
|
|
83
347
|
refParts.some((part) => !part || part.startsWith(".") || part.endsWith(".lock")) ||
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
/[\u0000-\u0020\u007f~^:?*\[\\]/u.test(
|
|
348
|
+
ref.endsWith(".") ||
|
|
349
|
+
ref.includes("..") ||
|
|
350
|
+
ref.includes("@{") ||
|
|
351
|
+
/[\u0000-\u0020\u007f~^:?*\[\\]/u.test(ref))
|
|
88
352
|
throw new Error("Use a fully qualified Semgrep ref such as refs/heads/topic.");
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const
|
|
353
|
+
}
|
|
354
|
+
function selectedRows(options, repositoryFor, repositoryUrl = hostedNativeRepositoryUrl) {
|
|
355
|
+
const scope = scopeOf(options.deployment, parseSemgrepResponse(options.projectResponse)["project"], options.ref, semgrepPlatformId, selectedProjectUrl);
|
|
356
|
+
requireSemgrepFullRef(scope.ref);
|
|
357
|
+
const repository = repositoryFor(scope);
|
|
358
|
+
const wanted = new Set(options.findingIds.map((id) => semgrepPlatformId(requiredText(id, "Selected Semgrep finding ID"))));
|
|
92
359
|
if (!wanted.size)
|
|
93
360
|
throw new Error("Select at least one Semgrep finding ID.");
|
|
94
361
|
const selected = new Map();
|
|
95
362
|
const pages = typeof options.findingsResponses === "string"
|
|
96
363
|
? [options.findingsResponses]
|
|
97
364
|
: options.findingsResponses;
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
const findings = array(parseSemgrepResponse(response)["findings"], "Semgrep findings");
|
|
365
|
+
for (const page of pages) {
|
|
366
|
+
const findings = array(parseSemgrepResponse(page)["findings"], "Semgrep findings");
|
|
101
367
|
const previousCount = selected.size;
|
|
102
368
|
for (const finding of findings) {
|
|
103
369
|
if (!isRecord(finding))
|
|
104
370
|
continue;
|
|
105
|
-
const id =
|
|
371
|
+
const id = semgrepPlatformIdOrUndefined(finding["id"]);
|
|
106
372
|
if (!id || !wanted.has(id))
|
|
107
373
|
continue;
|
|
108
374
|
if (selected.has(id))
|
|
109
375
|
throw new Error(`Duplicate selected Semgrep finding ${id}.`);
|
|
110
|
-
|
|
111
|
-
const repositoryId = repo["id"] == null ? undefined : requiredPlatformId(repo["id"]);
|
|
112
|
-
const url = repo["url"];
|
|
113
|
-
const name = repo["name"];
|
|
114
|
-
const matchesQualifiedPath = name === projectPath && projectPath.includes("/");
|
|
115
|
-
if (finding["ref"] !== scope.ref ||
|
|
116
|
-
(repositoryId !== undefined && repositoryId !== scope.project.id) ||
|
|
117
|
-
(url != null
|
|
118
|
-
? url !== scope.project.url
|
|
119
|
-
: repositoryId === undefined || !matchesQualifiedPath))
|
|
120
|
-
throw new Error("Selected Semgrep finding does not belong to the selected project and ref.");
|
|
121
|
-
if ([finding["issue_type"], finding["product"]].some((product) => product != null &&
|
|
122
|
-
(typeof product !== "string" ||
|
|
123
|
-
!["sast", "code"].includes(product.toLowerCase()))))
|
|
124
|
-
throw new Error("Select Semgrep Code (SAST) findings.");
|
|
376
|
+
checkSemgrepPlatformRow(finding, scope, undefined, repository, semgrepPlatformId, repositoryUrl, true);
|
|
125
377
|
selected.set(id, finding);
|
|
126
378
|
}
|
|
127
379
|
// The v1 findings endpoint returns a single product per response page.
|
|
@@ -130,33 +382,470 @@ export function normalizeSelectedSemgrepPlatformFindings(options) {
|
|
|
130
382
|
throw new Error("Select Semgrep Code (SAST) findings.");
|
|
131
383
|
}
|
|
132
384
|
const rows = Array.from(wanted, (id) => {
|
|
133
|
-
const
|
|
134
|
-
if (!
|
|
135
|
-
throw new Error(`Selected Semgrep finding ${id} is missing.`);
|
|
136
|
-
return
|
|
385
|
+
const value = selected.get(id);
|
|
386
|
+
if (!value)
|
|
387
|
+
throw new Error(`Selected Semgrep finding ${id} is missing from the supplied pages.`);
|
|
388
|
+
return value;
|
|
137
389
|
});
|
|
138
|
-
|
|
390
|
+
return { scope, rows };
|
|
391
|
+
}
|
|
392
|
+
/** Select existing SAST findings from native Web API responses for one project and ref. */
|
|
393
|
+
export function selectSemgrepPlatformFindings(options) {
|
|
394
|
+
const { scope, rows } = selectedRows(options, (scope) => selectionRepository(scope.project.url, options.sourceRepositories));
|
|
395
|
+
return {
|
|
396
|
+
format: semgrepSelectionFormat,
|
|
397
|
+
...scope,
|
|
398
|
+
findings: rows.map((row) => stringifySemgrepFinding(row)),
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
/** Select SAST findings using the operator's exact, independently supplied HTTP(S) spelling. */
|
|
402
|
+
export function normalizeSelectedSemgrepPlatformFindings(options) {
|
|
403
|
+
const url = hostedRepositoryUrl(options.sourceRepositoryUrl, "Semgrep");
|
|
404
|
+
const { scope, rows } = selectedRows(options, (scope) => {
|
|
405
|
+
if (scope.project.url !== url)
|
|
406
|
+
throw new Error("Selected Semgrep project does not match the operator's source repository URL.");
|
|
407
|
+
const exact = (value) => value;
|
|
408
|
+
return {
|
|
409
|
+
source: { url },
|
|
410
|
+
selectableProject: true,
|
|
411
|
+
key: exact,
|
|
412
|
+
name: exact,
|
|
413
|
+
};
|
|
414
|
+
}, hostedRepositoryUrl);
|
|
415
|
+
return {
|
|
416
|
+
...normalizePlatformRows(rows.map((finding) => ({ finding, selectable: true })), scope, "local"),
|
|
417
|
+
...reportScope(semgrepSelectionFormat, scope),
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
function sourceId(scope, finding) {
|
|
421
|
+
// Keep the same tuple for a selected import and a subsequent scoped Platform collection.
|
|
139
422
|
const exact = (id) => Number.isSafeInteger(Number(id)) ? Number(id) : id;
|
|
140
|
-
return
|
|
423
|
+
return stableId("semgrep-platform", [
|
|
424
|
+
scope.deployment,
|
|
425
|
+
exact(semgrepPlatformId(wireJson.rawJSON(scope.project.id))),
|
|
426
|
+
scope.product,
|
|
427
|
+
scope.ref,
|
|
428
|
+
exact(semgrepPlatformId(finding["id"])),
|
|
429
|
+
]);
|
|
430
|
+
}
|
|
431
|
+
function scopeProduct(native, complete) {
|
|
432
|
+
const product = SEMGREP_PLATFORM_PRODUCTS.find((value) => value === native);
|
|
433
|
+
if (!product || (!complete && product !== "sast"))
|
|
434
|
+
throw new Error("Select a supported Semgrep Platform product for this report.");
|
|
435
|
+
return product;
|
|
436
|
+
}
|
|
437
|
+
function readScope(input, references, target = "local") {
|
|
438
|
+
const complete = input["format"] === semgrepPlatformFormat;
|
|
439
|
+
const product = scopeProduct(input["product"], complete);
|
|
440
|
+
const project = responseRecord(input["project"], "Semgrep project");
|
|
441
|
+
if (input["format"] === semgrepPlatformFormat &&
|
|
442
|
+
typeof project["id"] !== "string")
|
|
443
|
+
throw new Error("A Semgrep Platform v2 project ID must be a positive decimal string.");
|
|
444
|
+
if (!complete)
|
|
445
|
+
requiredText(project["id"], "Semgrep selected project ID");
|
|
446
|
+
const mapping = complete && input["sourceRepositoryUrl"] !== undefined
|
|
447
|
+
? hostedRepositoryUrl(input["sourceRepositoryUrl"], "Semgrep source repository")
|
|
448
|
+
: undefined;
|
|
449
|
+
// Captures expose an HTTP URL; stored occurrences retain the provider's SSH spelling.
|
|
450
|
+
const projectUrl = project["url"];
|
|
451
|
+
const suppliedNative = complete ? input["nativeProjectUrl"] : undefined;
|
|
452
|
+
const raw = suppliedNative !== undefined
|
|
453
|
+
? requiredText(suppliedNative, "Semgrep native project URL")
|
|
454
|
+
: complete &&
|
|
455
|
+
typeof projectUrl === "string" &&
|
|
456
|
+
!/^https?:\/\//iu.test(projectUrl)
|
|
457
|
+
? projectUrl
|
|
458
|
+
: undefined;
|
|
459
|
+
const native = raw === undefined ? undefined : semgrepNativeProjectUrl(raw, references);
|
|
460
|
+
if (suppliedNative !== undefined &&
|
|
461
|
+
(!native || native === raw || native !== projectUrl))
|
|
462
|
+
throw new Error("Semgrep native project URL does not match its recorded HTTP repository.");
|
|
463
|
+
if (mapping && projectUrl != null) {
|
|
464
|
+
const key = native && repositoryContext(native, references, target).key;
|
|
465
|
+
if (key ? key(native) !== key(mapping) : projectUrl !== mapping)
|
|
466
|
+
throw new Error("Semgrep project does not match its recorded source repository URL.");
|
|
467
|
+
}
|
|
468
|
+
const scope = {
|
|
469
|
+
...scopeOf(input["deployment"], { ...project, url: native ?? mapping ?? project["url"] }, input["ref"], savedPlatformId, complete ? hostedRepositoryUrl : selectedProjectUrl),
|
|
470
|
+
...(mapping && { sourceRepositoryUrl: mapping }),
|
|
471
|
+
...(native && { nativeProjectUrl: raw }),
|
|
472
|
+
product,
|
|
473
|
+
};
|
|
474
|
+
const aliases = complete
|
|
475
|
+
? new Set(array(input["repositoryAliases"], "Semgrep repository aliases").map((value) => requiredText(value, "Semgrep repository alias")))
|
|
476
|
+
: undefined;
|
|
477
|
+
return { scope, aliases };
|
|
478
|
+
}
|
|
479
|
+
function matchesNativeInteger(value, expected) {
|
|
480
|
+
if (expected == null)
|
|
481
|
+
return value == null;
|
|
482
|
+
const token = hostedNumberToken(value);
|
|
483
|
+
if (token === undefined)
|
|
484
|
+
return value === expected;
|
|
485
|
+
return expected === 0
|
|
486
|
+
? /^-?0(?:\.0+)?(?:e[+-]?\d+)?$/iu.test(token)
|
|
487
|
+
: canonicalNumber(token) === String(expected);
|
|
488
|
+
}
|
|
489
|
+
const generatedId = /^semgrep-platform:[0-9a-f]{64}$/u;
|
|
490
|
+
/** Recognize reserved Platform IDs and native scope before accepting normalized evidence. */
|
|
491
|
+
export function isSemgrepPlatformEvidence(finding, provider) {
|
|
492
|
+
const data = finding.evidence.source_data;
|
|
493
|
+
if (generatedId.test(finding.source_finding_id))
|
|
494
|
+
return true;
|
|
495
|
+
if (!data)
|
|
496
|
+
return false;
|
|
497
|
+
if (isSemgrepPlatformFormat(data["format"]) ||
|
|
498
|
+
Object.hasOwn(data, "semgrepPlatformFindingJson"))
|
|
499
|
+
return true;
|
|
500
|
+
// Other scanners can use the same project and finding fields, including numeric IDs.
|
|
501
|
+
if (provider !== "semgrep")
|
|
502
|
+
return false;
|
|
503
|
+
const project = data["project"];
|
|
504
|
+
const row = data["finding"];
|
|
505
|
+
return (isRecord(row) &&
|
|
506
|
+
"id" in row &&
|
|
507
|
+
isRecord(project) &&
|
|
508
|
+
project["id"] != null &&
|
|
509
|
+
typeof project["name"] === "string" &&
|
|
510
|
+
typeof data["ref"] === "string" &&
|
|
511
|
+
typeof data["deployment"] === "string" &&
|
|
512
|
+
SEMGREP_PLATFORM_PRODUCTS.some((product) => product === data["product"]));
|
|
513
|
+
}
|
|
514
|
+
function nativeOccurrence(data, references, target) {
|
|
515
|
+
if (!isSemgrepPlatformFormat(data["format"]))
|
|
516
|
+
throw new Error("Unsupported Semgrep finding format. Recollect the Platform findings.");
|
|
517
|
+
const { scope, aliases } = readScope(data, references, target);
|
|
518
|
+
const repository = repositoryContext(scope.project.url, references, target);
|
|
519
|
+
const row = parseSemgrepResponse(requiredText(data["semgrepPlatformFindingJson"], "Semgrep finding JSON"));
|
|
520
|
+
return { scope, aliases, repository, row };
|
|
521
|
+
}
|
|
522
|
+
/** Reproduce the native Cloud title fallback for an unmodified Platform message title. */
|
|
523
|
+
export function storedSemgrepCloudEvidence(finding, references = []) {
|
|
524
|
+
const { evidence } = finding;
|
|
525
|
+
if (evidence.title !== evidence.description ||
|
|
526
|
+
Buffer.byteLength(evidence.title) <= DEFAULT_CLOUD_STRING_BYTES ||
|
|
527
|
+
!evidence.source_data ||
|
|
528
|
+
!isSemgrepPlatformEvidence(finding, "semgrep"))
|
|
529
|
+
return;
|
|
530
|
+
const { row, scope, aliases, repository } = nativeOccurrence(evidence.source_data, references, "local");
|
|
531
|
+
if (sourceId(scope, row) !== finding.source_finding_id)
|
|
532
|
+
return;
|
|
533
|
+
const selectable = checkSemgrepPlatformRow(row, scope, aliases, repository);
|
|
534
|
+
const projectNames = aliases &&
|
|
535
|
+
projectAliases(scope.project.name, scope.project.url, references);
|
|
536
|
+
const title = (target) => normalizePlatformRows([{ finding: row, selectable }], scope, target, projectNames).findings[0]?.evidence.title;
|
|
537
|
+
if (title("local") !== evidence.title)
|
|
538
|
+
return;
|
|
539
|
+
const cloud = title("cloud");
|
|
540
|
+
if (cloud && cloud !== evidence.title)
|
|
541
|
+
return { ...evidence, title: cloud };
|
|
542
|
+
}
|
|
543
|
+
/** Recheck the source repository when an SDK caller supplies normalized evidence directly. */
|
|
544
|
+
export function semgrepPlatformFindingRepository(finding, provider, references = []) {
|
|
545
|
+
return semgrepPlatformFindingBinding(finding, provider, references)?.url;
|
|
546
|
+
}
|
|
547
|
+
export function platformLocationPath(value) {
|
|
548
|
+
const path = text(value);
|
|
549
|
+
const relative = relativePath(path);
|
|
550
|
+
return relative && !relative.endsWith("/.") && repositoryFilePath(relative)
|
|
551
|
+
? path
|
|
552
|
+
: null;
|
|
553
|
+
}
|
|
554
|
+
function platformLocation(location, product, coerceStrings) {
|
|
555
|
+
const path = platformLocationPath(location["file_path"]);
|
|
556
|
+
if (!path)
|
|
557
|
+
return { locations: [], endLine: null };
|
|
558
|
+
const line = sourceLine(location["line"], coerceStrings);
|
|
559
|
+
const endLine = line !== null && product !== "sca"
|
|
560
|
+
? sourceLine(location["end_line"], coerceStrings)
|
|
561
|
+
: null;
|
|
562
|
+
return { locations: [{ path, line }], endLine };
|
|
563
|
+
}
|
|
564
|
+
function platformSeverity(value, selectable) {
|
|
565
|
+
const severity = text(value)?.toLowerCase();
|
|
566
|
+
return scannerSeverity(selectable && severity === "informational" ? null : severity);
|
|
567
|
+
}
|
|
568
|
+
function qualifiedBranch(ref) {
|
|
569
|
+
return ref.startsWith("refs/") ? ref : `refs/heads/${ref}`;
|
|
570
|
+
}
|
|
571
|
+
function checkProjectedProduct(finding, product, native = false) {
|
|
572
|
+
const kind = finding.evidence.details?.kind;
|
|
573
|
+
if ((product === "sca" && kind === "sast") ||
|
|
574
|
+
(native && (kind === "secret" || kind === "iac")))
|
|
575
|
+
throw new Error("The projected finding kind does not match the Semgrep report product.");
|
|
576
|
+
}
|
|
577
|
+
/** A marked report reserves the v1 finding's repository, ref and product for Semgrep scope. */
|
|
578
|
+
export function hasRetainedSemgrepScope(finding) {
|
|
579
|
+
if (!isRecord(finding))
|
|
580
|
+
return false;
|
|
581
|
+
const repository = finding["repository"];
|
|
582
|
+
if (finding["ref"] !== undefined ||
|
|
583
|
+
hasSemgrepScaEvidence(finding) ||
|
|
584
|
+
(isRecord(repository) &&
|
|
585
|
+
(repository["id"] != null ||
|
|
586
|
+
!!text(repository["url"]) ||
|
|
587
|
+
!!text(repository["name"]))))
|
|
588
|
+
return true;
|
|
589
|
+
return [finding["product"], finding["issue_type"]].some((value) => {
|
|
590
|
+
if (typeof value !== "string")
|
|
591
|
+
return false;
|
|
592
|
+
const product = value.toLowerCase();
|
|
593
|
+
return (product === "code" ||
|
|
594
|
+
SEMGREP_PLATFORM_PRODUCTS.some((known) => known === product));
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
export function semgrepPlatformFindingBinding(finding, provider, references = [], reportScope, projectedSources = [], target = "local") {
|
|
598
|
+
const retained = finding.evidence.source_data;
|
|
599
|
+
if (!isSemgrepPlatformEvidence(finding, provider)) {
|
|
600
|
+
if (provider === "semgrep" &&
|
|
601
|
+
reportScope?.format !== undefined &&
|
|
602
|
+
hasRetainedSemgrepScope(retained?.["finding"]))
|
|
603
|
+
throw new Error("Retained Semgrep finding scope requires the original collection scope in a marked Platform report.");
|
|
604
|
+
if (reportScope && reportScope.format !== semgrepSelectionFormat) {
|
|
605
|
+
const source = repositoryContext(reportScope.url, references).source;
|
|
606
|
+
const claims = [
|
|
607
|
+
{
|
|
608
|
+
url: finding.evidence.details?.repository?.url,
|
|
609
|
+
branch: finding.evidence.branch,
|
|
610
|
+
},
|
|
611
|
+
...projectedSources,
|
|
612
|
+
];
|
|
613
|
+
if (claims.some((claim) => claim?.url && !semgrepReferenceMatches(source, claim.url)))
|
|
614
|
+
throw new Error("The projected repository does not match the Semgrep report repository.");
|
|
615
|
+
const ref = reportScope.ref && qualifiedBranch(reportScope.ref);
|
|
616
|
+
if (ref &&
|
|
617
|
+
claims.some((claim) => claim?.branch && qualifiedBranch(claim.branch) !== ref))
|
|
618
|
+
throw new Error("The projected branch does not match the Semgrep report ref.");
|
|
619
|
+
checkProjectedProduct(finding, reportScope.product);
|
|
620
|
+
}
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
if (!retained)
|
|
624
|
+
throw new Error("Missing the original Semgrep finding evidence.");
|
|
625
|
+
const { scope, aliases, repository, row } = nativeOccurrence(retained, references, target);
|
|
626
|
+
checkProjectedProduct(finding, scope.product, true);
|
|
627
|
+
if (reportScope?.deployment !== undefined &&
|
|
628
|
+
(scope.deployment !== reportScope.deployment ||
|
|
629
|
+
scope.project.id !== reportScope.projectId ||
|
|
630
|
+
scope.ref !== reportScope.ref ||
|
|
631
|
+
scope.product !== reportScope.product))
|
|
632
|
+
throw new Error("The Semgrep report repository scope does not match the finding's deployment, project ID, ref, or product.");
|
|
633
|
+
const other = retained["finding"];
|
|
634
|
+
if (isRecord(other) && Object.hasOwn(other, "id")) {
|
|
635
|
+
const original = parseSemgrepResponse(JSON.stringify(other));
|
|
636
|
+
if (semgrepPlatformIdOrUndefined(original["id"]) !== undefined &&
|
|
637
|
+
stringifySemgrepFinding(original) !== stringifySemgrepFinding(row))
|
|
638
|
+
throw new Error("The retained Semgrep finding representations disagree.");
|
|
639
|
+
}
|
|
640
|
+
const selectable = checkSemgrepPlatformRow(row, scope, aliases, repository);
|
|
641
|
+
if (reportScope?.format === semgrepSelectionFormat && !selectable)
|
|
642
|
+
throw new Error("Semgrep finding does not belong to the selected project and ref.");
|
|
643
|
+
const nativeId = sourceId(scope, row);
|
|
644
|
+
if (generatedId.test(finding.source_finding_id) &&
|
|
645
|
+
finding.source_finding_id !== nativeId)
|
|
646
|
+
throw new Error("The generated Semgrep finding ID does not match its native occurrence.");
|
|
647
|
+
const { name, url } = scope.project;
|
|
648
|
+
let namedOnly = aliases && repositoryWithOnlyAlias(row, projectAliases(name, url));
|
|
649
|
+
const raw = retained["repositoryWitnessJson"];
|
|
650
|
+
// Only rely on the reader's platform hint when there is no independent proof.
|
|
651
|
+
if (namedOnly &&
|
|
652
|
+
raw === undefined &&
|
|
653
|
+
projectAliases(name, url, references).has(namedOnly))
|
|
654
|
+
namedOnly = undefined;
|
|
655
|
+
if (raw !== undefined || namedOnly) {
|
|
656
|
+
const label = text(record(row["repository"], "Semgrep finding repository")["name"]);
|
|
657
|
+
const witness = parseSemgrepResponse(requiredText(raw, "Semgrep repository alias witness"));
|
|
658
|
+
if (!label ||
|
|
659
|
+
witness["name"] !== label ||
|
|
660
|
+
(witness["id"] == null && !text(witness["url"])))
|
|
661
|
+
throw new Error("Semgrep repository alias lacks a matching project ID or URL.");
|
|
662
|
+
checkSemgrepPlatformRow({ repository: witness }, scope, aliases ?? new Set([label]), repository, (id) => semgrepPlatformId(wireJson.rawJSON(savedPlatformId(id))));
|
|
663
|
+
}
|
|
664
|
+
const claimed = finding.evidence.details?.repository?.url;
|
|
665
|
+
if (finding.evidence.branch !== scope.ref ||
|
|
666
|
+
(!claimed && scope.product !== "sca") ||
|
|
667
|
+
(!!claimed &&
|
|
668
|
+
repository.key(hostedRepositoryUrl(claimed, "Semgrep evidence repository")) !== repository.key(scope.project.url)))
|
|
669
|
+
throw new Error("The normalized finding does not match its original Semgrep repository and ref.");
|
|
670
|
+
const canonical = platformSourceData(row, scope, selectable, aliases !== undefined, namedOnly);
|
|
671
|
+
const { repositoryAliases: _aliases, repositoryWitnessJson: _witness, nativeProjectUrl: _native, ...metadata } = retained;
|
|
672
|
+
const selectedSeverity = platformSeverity(row["severity"], true);
|
|
673
|
+
const previousSeverity = platformSeverity(row["severity"], false);
|
|
674
|
+
return {
|
|
675
|
+
url,
|
|
676
|
+
nativeId,
|
|
677
|
+
// A reader-provided repository binding can promote a backlog row to a selected SAST row.
|
|
678
|
+
migration: retained["format"] === semgrepPlatformFormat &&
|
|
679
|
+
canonical.format === semgrepSelectionFormat &&
|
|
680
|
+
finding.evidence.severity === previousSeverity &&
|
|
681
|
+
previousSeverity !== selectedSeverity
|
|
682
|
+
? { severity: selectedSeverity }
|
|
683
|
+
: undefined,
|
|
684
|
+
sourceData: {
|
|
685
|
+
...metadata,
|
|
686
|
+
...canonical,
|
|
687
|
+
project: {
|
|
688
|
+
...record(retained["project"], "Semgrep project"),
|
|
689
|
+
...canonical.project,
|
|
690
|
+
},
|
|
691
|
+
},
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
/** Normalize a saved selection or Platform project export. The default target is local. */
|
|
695
|
+
export function normalizeSemgrepPlatformFindings(report, options = {}, target = "local", references = typeof options === "object"
|
|
696
|
+
? (options.sourceRepositories ?? [])
|
|
697
|
+
: []) {
|
|
698
|
+
const declaredUrl = typeof options === "string" ? options : options.sourceRepositoryUrl;
|
|
699
|
+
const input = record(report, "Semgrep Platform report");
|
|
700
|
+
const sourceFormat = input["format"];
|
|
701
|
+
if (!isSemgrepPlatformFormat(sourceFormat))
|
|
702
|
+
throw new Error("Expected a Semgrep Platform selection or project export.");
|
|
703
|
+
const { scope, aliases } = readScope(input, references, target);
|
|
704
|
+
const repository = selectionRepository(scope.project.url, references, target);
|
|
705
|
+
if (declaredUrl &&
|
|
706
|
+
repository.key(hostedRepositoryUrl(declaredUrl, "Semgrep")) !==
|
|
707
|
+
repository.key(scope.project.url))
|
|
708
|
+
throw new Error("Semgrep project does not match the declared source repository URL.");
|
|
709
|
+
const verifiedLabels = new Set();
|
|
710
|
+
const projectNames = projectAliases(scope.project.name, scope.project.url, references);
|
|
711
|
+
const entries = array(input["findings"], "Semgrep Platform findings");
|
|
712
|
+
if (!aliases && !entries.length)
|
|
713
|
+
throw new Error("A saved Semgrep selection must contain at least one finding.");
|
|
714
|
+
const rows = entries.map((value) => {
|
|
715
|
+
const raw = requiredText(value, "Semgrep finding JSON");
|
|
716
|
+
const finding = parseSemgrepResponse(raw);
|
|
717
|
+
const selectable = checkSemgrepPlatformRow(finding, scope, aliases, repository);
|
|
718
|
+
if (aliases) {
|
|
719
|
+
const repo = record(finding["repository"] ?? {}, "Semgrep finding repository");
|
|
720
|
+
const label = text(repo["name"]);
|
|
721
|
+
if (label && (repo["id"] != null || text(repo["url"])))
|
|
722
|
+
verifiedLabels.add(label);
|
|
723
|
+
}
|
|
724
|
+
return { finding, selectable };
|
|
725
|
+
});
|
|
726
|
+
if (aliases && !matchesNativeInteger(input["findingCount"], rows.length))
|
|
727
|
+
throw new Error("Incomplete Semgrep Platform export: finding count does not match.");
|
|
728
|
+
if (aliases) {
|
|
729
|
+
for (const { finding } of rows) {
|
|
730
|
+
const name = repositoryWithOnlyAlias(finding, projectNames);
|
|
731
|
+
if (name && !verifiedLabels.has(name))
|
|
732
|
+
throw new Error("Semgrep finding repository lacks a matching project name, ID or URL.");
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
const unhintedNames = projectAliases(scope.project.name, scope.project.url);
|
|
736
|
+
const result = normalizePlatformRows(rows, scope, target, aliases && {
|
|
737
|
+
has: (name) => (verifiedLabels.has(name) ? unhintedNames : projectNames).has(name),
|
|
738
|
+
});
|
|
739
|
+
return { ...result, ...reportScope(sourceFormat, scope) };
|
|
740
|
+
}
|
|
741
|
+
function reportScope(sourceFormat, scope) {
|
|
742
|
+
return {
|
|
743
|
+
sourceFormat,
|
|
744
|
+
sourceRepositoryUrl: scope.project.url,
|
|
745
|
+
semgrepPlatformScope: {
|
|
746
|
+
deployment: scope.deployment,
|
|
747
|
+
projectId: scope.project.id,
|
|
748
|
+
ref: scope.ref,
|
|
749
|
+
product: scope.product,
|
|
750
|
+
},
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
export function stringifySemgrepFinding(finding) {
|
|
754
|
+
const repo = finding["repository"];
|
|
755
|
+
const nativeIds = [finding["id"], isRecord(repo) ? repo["id"] : undefined];
|
|
756
|
+
return JSON.stringify(finding, (_key, value) => {
|
|
757
|
+
if (wireJson.isRawJSON(value)) {
|
|
758
|
+
const id = nativeIds.includes(value)
|
|
759
|
+
? semgrepPlatformIdOrUndefined(value)
|
|
760
|
+
: undefined;
|
|
761
|
+
return wireJson.rawJSON(id ?? canonicalNumber(value.rawJSON));
|
|
762
|
+
}
|
|
763
|
+
if (isRecord(value))
|
|
764
|
+
return Object.fromEntries(Object.keys(value)
|
|
765
|
+
.sort()
|
|
766
|
+
.map((key) => [key, value[key]]));
|
|
767
|
+
return value;
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
function platformSourceData(finding, scope, selectable, bulk, namedOnly) {
|
|
771
|
+
const repo = record(finding["repository"] ?? {}, "Semgrep finding repository");
|
|
772
|
+
const label = text(repo["name"]);
|
|
773
|
+
const { nativeProjectUrl, ...evidenceScope } = scope;
|
|
774
|
+
const nativeBulkScope = !selectable ||
|
|
775
|
+
scope.sourceRepositoryUrl !== undefined ||
|
|
776
|
+
nativeProjectUrl !== undefined;
|
|
777
|
+
const needsBulkScope = bulk && nativeBulkScope;
|
|
778
|
+
return {
|
|
779
|
+
format: needsBulkScope ? semgrepPlatformFormat : semgrepSelectionFormat,
|
|
780
|
+
...evidenceScope,
|
|
781
|
+
project: {
|
|
782
|
+
...scope.project,
|
|
783
|
+
url: nativeProjectUrl ??
|
|
784
|
+
(scope.sourceRepositoryUrl ? null : scope.project.url),
|
|
785
|
+
},
|
|
786
|
+
...(needsBulkScope && { repositoryAliases: label ? [label] : [] }),
|
|
787
|
+
// Store the verified binding independently of the native fields retained on its proving row.
|
|
788
|
+
...(namedOnly && {
|
|
789
|
+
repositoryWitnessJson: JSON.stringify({
|
|
790
|
+
id: scope.project.id,
|
|
791
|
+
name: namedOnly,
|
|
792
|
+
}),
|
|
793
|
+
}),
|
|
794
|
+
semgrepPlatformFindingJson: stringifySemgrepFinding(finding),
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
// Selected rows and complete captures share their evidence projection and identity tuple.
|
|
798
|
+
function normalizePlatformRows(rows, scope, target, projectNames) {
|
|
799
|
+
return normalizeRecords(rows, ({ finding, selectable }) => {
|
|
141
800
|
const rule = responseRecord(finding["rule"] ?? {}, "Semgrep rule");
|
|
142
801
|
const name = text(rule["name"]) ?? text(finding["rule_name"]);
|
|
143
|
-
const severity = text(finding["severity"])?.toLowerCase() ?? "";
|
|
144
802
|
const description = text(rule["message"]) ?? text(finding["rule_message"]);
|
|
145
803
|
const location = responseRecord(finding["location"] ?? {}, "Semgrep location");
|
|
146
|
-
const
|
|
147
|
-
const
|
|
148
|
-
const
|
|
149
|
-
? rawPath
|
|
150
|
-
: null;
|
|
151
|
-
const startLine = path ? sourceLine(location["line"]) : null;
|
|
152
|
-
return validateExternalEvidence({
|
|
153
|
-
title: requiredText(name ?? description, "Semgrep finding title"),
|
|
804
|
+
const { locations, endLine } = platformLocation(location, scope.product, !!projectNames && !selectable);
|
|
805
|
+
const namedOnly = projectNames && repositoryWithOnlyAlias(finding, projectNames);
|
|
806
|
+
const common = {
|
|
154
807
|
description,
|
|
155
|
-
severity: ["
|
|
156
|
-
|
|
157
|
-
: "unknown",
|
|
158
|
-
locations: path ? [{ path, line: startLine }] : [],
|
|
808
|
+
severity: platformSeverity(finding["severity"], selectable),
|
|
809
|
+
locations,
|
|
159
810
|
branch: scope.ref,
|
|
811
|
+
source_data: platformSourceData(finding, scope, selectable, projectNames !== undefined, namedOnly),
|
|
812
|
+
};
|
|
813
|
+
let messageTitle = description ??
|
|
814
|
+
(scope.product === "sast"
|
|
815
|
+
? null
|
|
816
|
+
: `Semgrep finding ${semgrepPlatformId(finding["id"])}`);
|
|
817
|
+
if (target === "cloud" &&
|
|
818
|
+
description &&
|
|
819
|
+
Buffer.byteLength(description) > DEFAULT_CLOUD_STRING_BYTES) {
|
|
820
|
+
const id = finding["id"];
|
|
821
|
+
messageTitle = `Semgrep finding ${text(id) ?? semgrepPlatformId(id)}`;
|
|
822
|
+
}
|
|
823
|
+
if (scope.product === "sca") {
|
|
824
|
+
const dependency = responseRecord(finding["found_dependency"] ?? {}, "Semgrep found dependency");
|
|
825
|
+
const packages = [];
|
|
826
|
+
if (dependency["package"] !== undefined) {
|
|
827
|
+
const name = requiredText(dependency["package"], "Semgrep package name");
|
|
828
|
+
const fixes = array(finding["fix_recommendations"] ?? [], "Semgrep fix recommendations");
|
|
829
|
+
packages.push({
|
|
830
|
+
name,
|
|
831
|
+
ecosystem: text(dependency["ecosystem"]),
|
|
832
|
+
installed_version: text(dependency["version"]),
|
|
833
|
+
fixed_versions: strings(fixes.flatMap((fix) => isRecord(fix) && fix["package"] === name
|
|
834
|
+
? [fix["version"]]
|
|
835
|
+
: [])),
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
const advisory = text(finding["vulnerability_identifier"]);
|
|
839
|
+
return validateExternalEvidence({
|
|
840
|
+
...common,
|
|
841
|
+
title: requiredText(name ?? advisory ?? packages[0]?.name ?? messageTitle, "Semgrep finding title"),
|
|
842
|
+
advisory_ids: advisory ? [advisory] : [],
|
|
843
|
+
packages,
|
|
844
|
+
}, target);
|
|
845
|
+
}
|
|
846
|
+
return validateExternalEvidence({
|
|
847
|
+
...common,
|
|
848
|
+
title: requiredText(name ?? messageTitle, "Semgrep finding title"),
|
|
160
849
|
details: {
|
|
161
850
|
kind: "sast",
|
|
162
851
|
repository: { url: scope.project.url },
|
|
@@ -164,35 +853,9 @@ export function normalizeSelectedSemgrepPlatformFindings(options) {
|
|
|
164
853
|
rule: name ? { id: name } : null,
|
|
165
854
|
source_status: text(finding["status"]),
|
|
166
855
|
weakness_ids: weaknessIds(rule["cwe_names"]),
|
|
167
|
-
code: {
|
|
168
|
-
end_line: startLine !== null ? sourceLine(location["end_line"]) : null,
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
source_data: {
|
|
172
|
-
format: "semgrep-platform-selection/v1",
|
|
173
|
-
...scope,
|
|
174
|
-
project: {
|
|
175
|
-
...scope.project,
|
|
176
|
-
id: text(native["id"]) ?? scope.project.id,
|
|
177
|
-
},
|
|
178
|
-
semgrepPlatformFindingJson: JSON.stringify(finding, (_key, value) => {
|
|
179
|
-
if (wireJson.isRawJSON(value))
|
|
180
|
-
return wireJson.rawJSON(canonicalNumber(value.rawJSON));
|
|
181
|
-
// Native object key order can vary across otherwise identical reads.
|
|
182
|
-
if (isRecord(value))
|
|
183
|
-
return Object.fromEntries(Object.keys(value)
|
|
184
|
-
.sort()
|
|
185
|
-
.map((key) => [key, value[key]]));
|
|
186
|
-
return value;
|
|
187
|
-
}),
|
|
856
|
+
code: { end_line: endLine },
|
|
188
857
|
},
|
|
189
|
-
},
|
|
190
|
-
}, (finding) =>
|
|
191
|
-
scope.deployment,
|
|
192
|
-
exact(scope.project.id),
|
|
193
|
-
scope.product,
|
|
194
|
-
scope.ref,
|
|
195
|
-
exact(requiredPlatformId(finding["id"])),
|
|
196
|
-
]), "local");
|
|
858
|
+
}, target);
|
|
859
|
+
}, ({ finding }) => sourceId(scope, finding), target);
|
|
197
860
|
}
|
|
198
861
|
//# sourceMappingURL=semgrep-platform-findings.js.map
|