@openai/codex-security 0.9.1 → 0.10.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 +37 -788
- package/_bundled_plugin/.codex-plugin/plugin.json +2 -0
- package/_bundled_plugin/.mcp.json +3 -0
- package/_bundled_plugin/mcp/helpers.mjs.br +0 -0
- 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/server.mjs.br +0 -0
- package/_bundled_plugin/references/access-advisory.md +1 -1
- 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/final-report.md +1 -1
- package/_bundled_plugin/references/focused-investigator.md +13 -0
- 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/threat-model.md +1 -0
- package/_bundled_plugin/references/validate-scan-findings.md +3 -0
- package/_bundled_plugin/scripts/deep_scan_workbench.py +30 -12
- package/_bundled_plugin/scripts/dispatch_inventory_tool +7 -0
- package/_bundled_plugin/scripts/finalize_scan_contract.py +47 -9
- package/_bundled_plugin/scripts/launch_codex_security_mcp +54 -16
- package/_bundled_plugin/scripts/launch_codex_security_mcp.cmd +2 -0
- package/_bundled_plugin/scripts/posix_scan_local_files.py +26 -1
- package/_bundled_plugin/scripts/snapshot_sqlite.py +8 -2
- package/_bundled_plugin/scripts/windows_scan_local_files.py +216 -25
- package/_bundled_plugin/scripts/workbench/handoff.py +55 -25
- package/_bundled_plugin/scripts/workbench/storage.py +25 -5
- package/_bundled_plugin/scripts/workbench_cli.py +24 -2
- package/_bundled_plugin/scripts/workbench_constants.py +2 -0
- package/_bundled_plugin/scripts/workbench_db.py +257 -268
- package/_bundled_plugin/scripts/workbench_feedback.py +49 -4
- package/_bundled_plugin/scripts/workbench_native_indexes.py +226 -29
- package/_bundled_plugin/scripts/workbench_progress.py +159 -3
- package/_bundled_plugin/scripts/workbench_publication.py +2 -3
- package/_bundled_plugin/scripts/workbench_remediation.py +142 -2
- package/_bundled_plugin/scripts/workbench_saved_results.py +48 -8
- package/_bundled_plugin/scripts/workbench_scan_history.py +291 -134
- package/_bundled_plugin/scripts/workbench_scan_start.py +208 -11
- package/_bundled_plugin/scripts/workbench_scan_usage.py +36 -10
- package/_bundled_plugin/scripts/workbench_schema.py +220 -14
- package/_bundled_plugin/scripts/workbench_setup.py +1 -1
- package/_bundled_plugin/scripts/workbench_source_scopes.py +8 -0
- package/_bundled_plugin/scripts/workbench_target.py +486 -85
- package/_bundled_plugin/scripts/workbench_target_state.py +1108 -22
- package/_bundled_plugin/shared/workbench-history-repairs.json +64 -14
- package/_bundled_plugin/shared/workbench-migrations.json +66 -0
- package/_bundled_plugin/skills/attack-path-analysis/SKILL.md +4 -2
- package/_bundled_plugin/skills/attack-path-analysis/references/severity-policy.md +2 -2
- package/_bundled_plugin/skills/fix-finding/SKILL.md +1 -0
- package/_bundled_plugin/skills/publish-findings/SKILL.md +26 -160
- package/_bundled_plugin/skills/publish-findings/agents/openai.yaml +2 -2
- package/_bundled_plugin/skills/publish-findings/references/checkmarx-import.md +2 -2
- package/_bundled_plugin/skills/publish-findings/scripts/collect_checkmarx.py +3 -58
- 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/bin/codex-security.mjs +2 -2
- package/dist/api.d.ts +7 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +459 -157
- 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 +33 -12
- 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/blackduck-findings.d.ts +1 -1
- package/dist/blackduck-findings.d.ts.map +1 -1
- package/dist/blackduck-findings.js +5 -18
- package/dist/blackduck-findings.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/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-diagnostics.d.ts +10 -0
- package/dist/classify-severity-diagnostics.d.ts.map +1 -0
- package/dist/classify-severity-diagnostics.js +57 -0
- package/dist/classify-severity-diagnostics.js.map +1 -0
- package/dist/classify-severity-records.d.ts +4 -0
- package/dist/classify-severity-records.d.ts.map +1 -1
- package/dist/classify-severity-records.js +35 -8
- package/dist/classify-severity-records.js.map +1 -1
- package/dist/classify-severity.d.ts.map +1 -1
- package/dist/classify-severity.js +9 -6
- 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 +8 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1860 -903
- package/dist/cli.js.map +1 -1
- package/dist/cloud-publish.d.ts.map +1 -1
- package/dist/cloud-publish.js +33 -31
- 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-plan.d.ts.map +1 -1
- package/dist/component-plan.js +3 -3
- package/dist/component-plan.js.map +1 -1
- package/dist/component-scan.d.ts +3 -1
- package/dist/component-scan.d.ts.map +1 -1
- package/dist/component-scan.js +40 -7
- 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 +30 -1
- package/dist/config.js.map +1 -1
- package/dist/continuum-aws.d.ts +6 -0
- package/dist/continuum-aws.d.ts.map +1 -0
- package/dist/continuum-aws.js +202 -0
- package/dist/continuum-aws.js.map +1 -0
- package/dist/continuum-collector.d.ts +44 -0
- package/dist/continuum-collector.d.ts.map +1 -0
- package/dist/continuum-collector.js +266 -0
- package/dist/continuum-collector.js.map +1 -0
- package/dist/continuum-findings.d.ts +31 -2
- package/dist/continuum-findings.d.ts.map +1 -1
- package/dist/continuum-findings.js +497 -59
- package/dist/continuum-findings.js.map +1 -1
- package/dist/contract.d.ts +1 -0
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +3 -0
- package/dist/contract.js.map +1 -1
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +1 -45
- package/dist/cost.js.map +1 -1
- package/dist/crowdstrike-findings.d.ts +7 -0
- package/dist/crowdstrike-findings.d.ts.map +1 -0
- package/dist/crowdstrike-findings.js +210 -0
- package/dist/crowdstrike-findings.js.map +1 -0
- 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 +3 -1
- package/dist/deduplication/local.d.ts.map +1 -1
- package/dist/deduplication/local.js +8 -1
- package/dist/deduplication/local.js.map +1 -1
- package/dist/deduplication/refusal.d.ts.map +1 -1
- package/dist/deduplication/refusal.js +2 -1
- package/dist/deduplication/refusal.js.map +1 -1
- package/dist/deduplication/scan.d.ts +2 -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-scan.d.ts.map +1 -1
- package/dist/deep-scan.js +16 -15
- package/dist/deep-scan.js.map +1 -1
- package/dist/endor-findings.d.ts +2 -2
- package/dist/endor-findings.d.ts.map +1 -1
- package/dist/endor-findings.js +6 -23
- package/dist/endor-findings.js.map +1 -1
- package/dist/errors.d.ts +3 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +7 -3
- 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.map +1 -1
- package/dist/external-findings-import.js +12 -1
- package/dist/external-findings-import.js.map +1 -1
- package/dist/external-findings-local.d.ts +66 -4
- package/dist/external-findings-local.d.ts.map +1 -1
- package/dist/external-findings-local.js +258 -59
- package/dist/external-findings-local.js.map +1 -1
- package/dist/external-findings-publish.d.ts +6 -1
- package/dist/external-findings-publish.d.ts.map +1 -1
- package/dist/external-findings-publish.js +330 -1633
- package/dist/external-findings-publish.js.map +1 -1
- package/dist/external-findings-read.d.ts +11 -2
- package/dist/external-findings-read.d.ts.map +1 -1
- package/dist/external-findings-read.js +56 -53
- package/dist/external-findings-read.js.map +1 -1
- package/dist/external-findings.d.ts +1 -1
- package/dist/external-findings.d.ts.map +1 -1
- package/dist/external-findings.js +12 -1
- package/dist/external-findings.js.map +1 -1
- package/dist/external-import-contract.d.ts +6 -11
- package/dist/external-import-contract.d.ts.map +1 -1
- package/dist/external-import-contract.js +35 -177
- package/dist/external-import-contract.js.map +1 -1
- package/dist/external-import-models.d.ts +1 -1
- package/dist/external-import-models.d.ts.map +1 -1
- package/dist/external-import-models.js.map +1 -1
- package/dist/finding-prompt.d.ts.map +1 -1
- package/dist/finding-prompt.js +2 -2
- package/dist/finding-prompt.js.map +1 -1
- package/dist/github-dependabot-findings.d.ts.map +1 -1
- package/dist/github-dependabot-findings.js +3 -4
- package/dist/github-dependabot-findings.js.map +1 -1
- package/dist/github-findings.d.ts.map +1 -1
- package/dist/github-findings.js +19 -287
- package/dist/github-findings.js.map +1 -1
- package/dist/host-protocol.d.ts +6 -0
- package/dist/host-protocol.d.ts.map +1 -1
- package/dist/host-protocol.js +11 -1
- package/dist/host-protocol.js.map +1 -1
- package/dist/host-records-protocol.d.ts +2 -0
- package/dist/host-records-protocol.d.ts.map +1 -1
- package/dist/host-records-protocol.js +4 -0
- package/dist/host-records-protocol.js.map +1 -1
- 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/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/inspector-findings.d.ts.map +1 -1
- package/dist/inspector-findings.js +19 -35
- 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 +34 -27
- 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 -4
- package/dist/local-git-metadata.js.map +1 -1
- package/dist/multiscan.d.ts +4 -0
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +83 -39
- package/dist/multiscan.js.map +1 -1
- package/dist/opengrep-findings.d.ts +4 -2
- package/dist/opengrep-findings.d.ts.map +1 -1
- package/dist/opengrep-findings.js +39 -22
- package/dist/opengrep-findings.js.map +1 -1
- package/dist/private-finding-import.d.ts +8 -13
- package/dist/private-finding-import.d.ts.map +1 -1
- package/dist/private-finding-import.js +69 -129
- package/dist/private-finding-import.js.map +1 -1
- package/dist/project-config-schema.d.ts +2 -0
- package/dist/project-config-schema.d.ts.map +1 -1
- package/dist/project-config-schema.js +1 -0
- package/dist/project-config-schema.js.map +1 -1
- package/dist/project-config.d.ts +1 -0
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +56 -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.map +1 -1
- package/dist/provider-profile.js +4 -9
- package/dist/provider-profile.js.map +1 -1
- package/dist/publication.d.ts +1 -1
- package/dist/publication.d.ts.map +1 -1
- package/dist/publication.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.map +1 -1
- package/dist/remediation.js +3 -1
- package/dist/remediation.js.map +1 -1
- package/dist/runtime.d.ts +35 -7
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +782 -153
- package/dist/runtime.js.map +1 -1
- package/dist/saved-scan-bootstrap.d.ts +6 -1
- package/dist/saved-scan-bootstrap.d.ts.map +1 -1
- package/dist/saved-scan-bootstrap.js +267 -115
- package/dist/saved-scan-bootstrap.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 +20 -2
- package/dist/scan-comparison.d.ts.map +1 -1
- package/dist/scan-comparison.js +26 -5
- package/dist/scan-comparison.js.map +1 -1
- package/dist/scan-dashboard.d.ts +1 -0
- package/dist/scan-dashboard.d.ts.map +1 -1
- package/dist/scan-dashboard.js +18 -2
- package/dist/scan-dashboard.js.map +1 -1
- package/dist/scan-executor.d.ts.map +1 -1
- package/dist/scan-executor.js +4 -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 +25 -9
- package/dist/scan-history-renderer.js.map +1 -1
- package/dist/scan-logs.d.ts.map +1 -1
- package/dist/scan-logs.js +28 -4
- package/dist/scan-logs.js.map +1 -1
- package/dist/scan-settings.d.ts +1 -0
- package/dist/scan-settings.d.ts.map +1 -1
- package/dist/scan-settings.js +1 -0
- package/dist/scan-settings.js.map +1 -1
- package/dist/scanner-import.d.ts +5 -11
- package/dist/scanner-import.d.ts.map +1 -1
- package/dist/scanner-import.js +16 -89
- package/dist/scanner-import.js.map +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.map +1 -1
- package/dist/semgrep-findings.js +14 -48
- package/dist/semgrep-findings.js.map +1 -1
- package/dist/semgrep-platform-findings.d.ts +20 -70
- package/dist/semgrep-platform-findings.d.ts.map +1 -1
- package/dist/semgrep-platform-findings.js +116 -333
- package/dist/semgrep-platform-findings.js.map +1 -1
- package/dist/severity-review.d.ts.map +1 -1
- package/dist/severity-review.js +1 -0
- package/dist/severity-review.js.map +1 -1
- package/dist/snyk-findings.d.ts +2 -0
- package/dist/snyk-findings.d.ts.map +1 -1
- package/dist/snyk-findings.js +5 -8
- package/dist/snyk-findings.js.map +1 -1
- package/dist/snyk-rest-findings.d.ts +3 -20
- package/dist/snyk-rest-findings.d.ts.map +1 -1
- package/dist/snyk-rest-findings.js +45 -217
- package/dist/snyk-rest-findings.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 +28 -30
- 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 +129 -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/targets.d.ts +8 -1
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +103 -23
- package/dist/targets.js.map +1 -1
- package/dist/tenable-findings.d.ts +1 -4
- package/dist/tenable-findings.d.ts.map +1 -1
- package/dist/tenable-findings.js.map +1 -1
- package/dist/trivy-findings.d.ts.map +1 -1
- package/dist/trivy-findings.js +0 -11
- package/dist/trivy-findings.js.map +1 -1
- package/dist/trusted-executable.d.ts +7 -0
- package/dist/trusted-executable.d.ts.map +1 -1
- package/dist/trusted-executable.js +148 -37
- package/dist/trusted-executable.js.map +1 -1
- package/dist/value.js +3 -1
- package/dist/value.js.map +1 -1
- package/dist/veracode-findings.d.ts +1 -3
- package/dist/veracode-findings.d.ts.map +1 -1
- package/dist/veracode-findings.js +13 -38
- 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/wiz-findings.d.ts +2 -2
- package/dist/wiz-findings.d.ts.map +1 -1
- package/dist/wiz-findings.js +14 -92
- package/dist/wiz-findings.js.map +1 -1
- package/docs/classify-severity-records.md +30 -0
- package/docs/cli.md +537 -124
- package/docs/findings-service.md +22 -9
- package/docs/hosted-remediation.md +13 -4
- package/docs/sdk.md +918 -0
- package/package.json +15 -6
- package/schemas/external-findings.schema.json +2 -1
- package/schemas/project-config.schema.json +5 -0
- package/dist/hosted-scanner-v1.d.ts +0 -6
- package/dist/hosted-scanner-v1.d.ts.map +0 -1
- package/dist/hosted-scanner-v1.js +0 -60
- package/dist/hosted-scanner-v1.js.map +0 -1
- package/dist/reader-selection.d.ts +0 -15
- package/dist/reader-selection.d.ts.map +0 -1
- package/dist/reader-selection.js +0 -89
- package/dist/reader-selection.js.map +0 -1
- package/dist/semgrep-platform-v1.d.ts +0 -6
- package/dist/semgrep-platform-v1.d.ts.map +0 -1
- package/dist/semgrep-platform-v1.js +0 -83
- package/dist/semgrep-platform-v1.js.map +0 -1
- package/dist/snyk-rest-v1.d.ts +0 -28
- package/dist/snyk-rest-v1.d.ts.map +0 -1
- package/dist/snyk-rest-v1.js +0 -132
- package/dist/snyk-rest-v1.js.map +0 -1
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import type { ExternalFinding, ExternalSourceRepository } from "./external-findings.js";
|
|
2
2
|
import type { Provider } from "./external-import-models.js";
|
|
3
|
-
|
|
3
|
+
/** Readers whose findings Cloud does not accept, with their display names. */
|
|
4
|
+
export declare const LOCAL_ONLY_PROVIDERS: {
|
|
5
|
+
readonly tenable: "Tenable";
|
|
6
|
+
readonly crowdstrike: "CrowdStrike";
|
|
7
|
+
};
|
|
8
|
+
type LocalOnlyProvider = keyof typeof LOCAL_ONLY_PROVIDERS;
|
|
9
|
+
export type LocalFindingProvider = Provider | LocalOnlyProvider;
|
|
4
10
|
/** File reader names mapped to the provider stored with each finding. */
|
|
5
11
|
export declare const EXTERNAL_FINDINGS_PROVIDERS: {
|
|
6
12
|
readonly wiz: "wiz";
|
|
13
|
+
readonly armorcode: "armorcode";
|
|
7
14
|
readonly snyk: "snyk";
|
|
8
15
|
readonly semgrep: "semgrep";
|
|
9
16
|
readonly trivy: "trivy";
|
|
@@ -17,9 +24,10 @@ export declare const EXTERNAL_FINDINGS_PROVIDERS: {
|
|
|
17
24
|
readonly continuum: "continuum";
|
|
18
25
|
readonly checkmarx: "checkmarx";
|
|
19
26
|
readonly tenable: "tenable";
|
|
27
|
+
readonly crowdstrike: "crowdstrike";
|
|
20
28
|
};
|
|
21
29
|
export type ExternalFindingsReader = keyof typeof EXTERNAL_FINDINGS_PROVIDERS;
|
|
22
|
-
export type CloudFindingsReader = Exclude<ExternalFindingsReader,
|
|
30
|
+
export type CloudFindingsReader = Exclude<ExternalFindingsReader, LocalOnlyProvider>;
|
|
23
31
|
export declare function requireCloudReader(options: ExternalFindingsReaderOptions): asserts options is ExternalFindingsReaderOptions & {
|
|
24
32
|
provider: CloudFindingsReader;
|
|
25
33
|
};
|
|
@@ -42,4 +50,5 @@ export declare function semgrepSarifRepositories({ evidence }: ExternalFinding,
|
|
|
42
50
|
export declare function snykFileRepositories(input: unknown): {
|
|
43
51
|
url: string;
|
|
44
52
|
}[];
|
|
53
|
+
export {};
|
|
45
54
|
//# sourceMappingURL=external-findings-read.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-findings-read.d.ts","sourceRoot":"","sources":["../src/external-findings-read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,
|
|
1
|
+
{"version":3,"file":"external-findings-read.d.ts","sourceRoot":"","sources":["../src/external-findings-read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAEf,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAkC5D,8EAA8E;AAC9E,eAAO,MAAM,oBAAoB;aAC/B,OAAO,EAAE,SAAS;aAClB,WAAW,EAAE,aAAa;CAClB,CAAC;AACX,KAAK,iBAAiB,GAAG,MAAM,OAAO,oBAAoB,CAAC;AAE3D,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,iBAAiB,CAAC;AAEhE,yEAAyE;AACzE,eAAO,MAAM,2BAA2B;kBACjC,KAAK;wBACC,WAAW;mBAChB,MAAM;sBACH,SAAS;oBACX,OAAO;uBAEJ,SAAS;oBACZ,OAAO;qBACN,QAAQ;wBACL,WAAW;wBACX,WAAW;uBACZ,UAAU;oBACb,OAAO;wBACH,WAAW;wBACX,WAAW;sBACb,SAAS;0BACL,aAAa;CAC6B,CAAC;AAE1D,MAAM,MAAM,sBAAsB,GAAG,MAAM,OAAO,2BAA2B,CAAC;AAC9E,MAAM,MAAM,mBAAmB,GAAG,OAAO,CACvC,sBAAsB,EACtB,iBAAiB,CAClB,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,OAAO,IAAI,6BAA6B,GAAG;IACpD,QAAQ,EAAE,mBAAmB,CAAC;CAC/B,CAKA;AAED,eAAO,MAAM,yBAAyB,EAEjC,sBAAsB,EAAE,CAAC;AAE9B,oFAAoF;AACpF,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,EAAE,sBAAsB,CAAC;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAQD,yEAAyE;AACzE,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,eAAe,GACvB,wBAAwB,EAAE,CAiB5B;AAED,8DAA8D;AAC9D,wBAAgB,wBAAwB,CACtC,EAAE,QAAQ,EAAE,EAAE,eAAe,EAC7B,oBAAoB,UAAQ,GAC3B;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,CAkCpC;AAeD,sFAAsF;AACtF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO;;IAIlD"}
|
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
import { readScannerJson, sarifRunRepositories } from "./scanner-import.js";
|
|
2
2
|
import { CodexSecurityError } from "./errors.js";
|
|
3
3
|
import { readTenableFindings } from "./tenable-findings.js";
|
|
4
|
+
import { readCrowdStrikeFindings } from "./crowdstrike-findings.js";
|
|
4
5
|
import { dependabotRepository } from "./github-dependabot-findings.js";
|
|
5
|
-
import { normalizeSnykFile,
|
|
6
|
+
import { normalizeSnykFile, emptySnykReportRepositories, snykRepositoryUrls, } from "./snyk-findings.js";
|
|
6
7
|
import { isSemgrepSarifDriver, normalizeSemgrepFindings, readSemgrepReport, } from "./semgrep-findings.js";
|
|
7
8
|
import { semgrepPlatformReportRepository } from "./semgrep-platform-findings.js";
|
|
8
|
-
import { normalizeTrivyFindings
|
|
9
|
+
import { normalizeTrivyFindings } from "./trivy-findings.js";
|
|
9
10
|
import { readOpenGrepFindings } from "./opengrep-findings.js";
|
|
10
|
-
import { normalizeEndorFindings,
|
|
11
|
+
import { normalizeEndorFindings, endorRepositoryUrls, } from "./endor-findings.js";
|
|
11
12
|
import { readGitHubFindings } from "./github-findings.js";
|
|
12
13
|
import { readSonarFindings } from "./sonar-findings.js";
|
|
13
|
-
import { normalizeVeracodeFindings
|
|
14
|
-
import {
|
|
15
|
-
import { normalizeContinuumFindings
|
|
14
|
+
import { normalizeVeracodeFindings } from "./veracode-findings.js";
|
|
15
|
+
import { normalizeBlackDuckFindings } from "./blackduck-findings.js";
|
|
16
|
+
import { normalizeContinuumFindings } from "./continuum-findings.js";
|
|
16
17
|
import { readCheckmarxFindings } from "./checkmarx-findings.js";
|
|
17
|
-
import { normalizeInspectorFindings
|
|
18
|
-
import { hasPreviousCloudProjection } from "./reader-selection.js";
|
|
18
|
+
import { normalizeInspectorFindings } from "./inspector-findings.js";
|
|
19
19
|
import { isRecord } from "./record.js";
|
|
20
|
-
import {
|
|
20
|
+
import { readWizSelection, wizFindingRepository } from "./wiz-findings.js";
|
|
21
|
+
import { normalizeArmorCodeFindings } from "./armorcode-findings.js";
|
|
22
|
+
/** Readers whose findings Cloud does not accept, with their display names. */
|
|
23
|
+
export const LOCAL_ONLY_PROVIDERS = {
|
|
24
|
+
tenable: "Tenable",
|
|
25
|
+
crowdstrike: "CrowdStrike",
|
|
26
|
+
};
|
|
21
27
|
/** File reader names mapped to the provider stored with each finding. */
|
|
22
28
|
export const EXTERNAL_FINDINGS_PROVIDERS = {
|
|
23
29
|
wiz: "wiz",
|
|
30
|
+
armorcode: "armorcode",
|
|
24
31
|
snyk: "snyk",
|
|
25
32
|
semgrep: "semgrep",
|
|
26
33
|
trivy: "trivy",
|
|
@@ -35,10 +42,11 @@ export const EXTERNAL_FINDINGS_PROVIDERS = {
|
|
|
35
42
|
continuum: "continuum",
|
|
36
43
|
checkmarx: "checkmarx",
|
|
37
44
|
tenable: "tenable",
|
|
45
|
+
crowdstrike: "crowdstrike",
|
|
38
46
|
};
|
|
39
47
|
export function requireCloudReader(options) {
|
|
40
|
-
if (options.provider
|
|
41
|
-
throw new CodexSecurityError(
|
|
48
|
+
if (Object.hasOwn(LOCAL_ONLY_PROVIDERS, options.provider))
|
|
49
|
+
throw new CodexSecurityError(`${LOCAL_ONLY_PROVIDERS[options.provider]} findings require a local import (--to local).`);
|
|
42
50
|
}
|
|
43
51
|
export const EXTERNAL_FINDINGS_READERS = Object.keys(EXTERNAL_FINDINGS_PROVIDERS);
|
|
44
52
|
/** Repository references retained by a provider's individual finding. */
|
|
@@ -108,18 +116,18 @@ export function snykFileRepositories(input) {
|
|
|
108
116
|
export async function readExternalFindings(path, options, target = "cloud", references = []) {
|
|
109
117
|
const { provider } = options;
|
|
110
118
|
const url = options.sourceRepositoryUrl ?? "";
|
|
111
|
-
// Both projections describe the same captured rows, including exclusions.
|
|
112
|
-
function withReplay(findings, couldDiffer, previous) {
|
|
113
|
-
return {
|
|
114
|
-
findings,
|
|
115
|
-
previousFindings: target === "cloud" && couldDiffer(findings) ? previous : undefined,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
119
|
if (provider === "tenable") {
|
|
119
120
|
if (target === "cloud")
|
|
120
121
|
requireCloudReader(options);
|
|
121
122
|
return { findings: await readTenableFindings(path, url) };
|
|
122
123
|
}
|
|
124
|
+
if (provider === "crowdstrike") {
|
|
125
|
+
if (target === "cloud")
|
|
126
|
+
requireCloudReader(options);
|
|
127
|
+
return {
|
|
128
|
+
findings: await readCrowdStrikeFindings(path, options.sourceRepositoryUrl),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
123
131
|
if (provider === "sonar") {
|
|
124
132
|
const findings = await readSonarFindings(path, url, target);
|
|
125
133
|
const binding = findings.report?.["repositoryUrl"];
|
|
@@ -135,7 +143,7 @@ export async function readExternalFindings(path, options, target = "cloud", refe
|
|
|
135
143
|
return { findings, sourceRepositories: [{ url }] };
|
|
136
144
|
}
|
|
137
145
|
if (provider === "snyk") {
|
|
138
|
-
const input = await
|
|
146
|
+
const input = await readScannerJson(path);
|
|
139
147
|
const findings = await normalizeSnykFile(input, target, references);
|
|
140
148
|
return { findings, sourceRepositories: snykFileRepositories(input) };
|
|
141
149
|
}
|
|
@@ -152,57 +160,52 @@ export async function readExternalFindings(path, options, target = "cloud", refe
|
|
|
152
160
|
sourceRepositories.push({ url: options.sourceRepositoryUrl });
|
|
153
161
|
return { findings, sourceRepositories };
|
|
154
162
|
}
|
|
163
|
+
if (provider === "armorcode") {
|
|
164
|
+
const input = await readScannerJson(path);
|
|
165
|
+
return {
|
|
166
|
+
findings: normalizeArmorCodeFindings(input, target, options.sourceRepositoryUrl),
|
|
167
|
+
};
|
|
168
|
+
}
|
|
155
169
|
if (provider === "github")
|
|
156
170
|
return { findings: await readGitHubFindings(path, target) };
|
|
157
171
|
if (provider === "wiz") {
|
|
158
|
-
const wiz =
|
|
159
|
-
|
|
160
|
-
: await readVendorFindingsForPublication(path, target);
|
|
161
|
-
const sourceRepositories = wiz.current.findings.flatMap((finding) => localFindingRepositories("wiz", finding));
|
|
172
|
+
const wiz = await readWizSelection(path, target);
|
|
173
|
+
const sourceRepositories = wiz.findings.findings.flatMap((finding) => localFindingRepositories("wiz", finding));
|
|
162
174
|
return {
|
|
163
|
-
findings: wiz.
|
|
164
|
-
...("legacy" in wiz && { publication: wiz }),
|
|
175
|
+
findings: wiz.findings,
|
|
165
176
|
sourceRepositories: [...wiz.sourceRepositories, ...sourceRepositories],
|
|
166
177
|
};
|
|
167
178
|
}
|
|
168
179
|
const input = await readScannerJson(path);
|
|
169
|
-
if (provider === "trivy")
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
180
|
+
if (provider === "trivy")
|
|
181
|
+
return {
|
|
182
|
+
findings: normalizeTrivyFindings(input, target, options.trivyScanRoot),
|
|
183
|
+
};
|
|
173
184
|
if (provider === "endor") {
|
|
174
185
|
const findings = normalizeEndorFindings(input, target);
|
|
175
186
|
return {
|
|
176
|
-
|
|
187
|
+
findings,
|
|
177
188
|
sourceRepositories: sarifFileRepositories(input, "Endor") ??
|
|
178
189
|
findings.findings.flatMap((row) => localFindingRepositories(provider, row)),
|
|
179
190
|
};
|
|
180
191
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
needsPreviousBlackDuckProjection,
|
|
196
|
-
],
|
|
197
|
-
veracode: [
|
|
198
|
-
normalizeVeracodeFindings,
|
|
199
|
-
normalizePreviousVeracodeFindings,
|
|
200
|
-
hasPreviousCloudProjection,
|
|
201
|
-
],
|
|
192
|
+
if (provider === "continuum") {
|
|
193
|
+
const findings = normalizeContinuumFindings(input, url, target);
|
|
194
|
+
const binding = findings.report?.["sourceRepositoryUrl"];
|
|
195
|
+
return {
|
|
196
|
+
findings,
|
|
197
|
+
sourceRepositories: [
|
|
198
|
+
{ url: typeof binding === "string" ? binding : url },
|
|
199
|
+
],
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
const normalize = {
|
|
203
|
+
inspector: normalizeInspectorFindings,
|
|
204
|
+
blackduck: normalizeBlackDuckFindings,
|
|
205
|
+
veracode: normalizeVeracodeFindings,
|
|
202
206
|
}[provider];
|
|
203
|
-
const args = [input, url, target, options.inspectorProjectMap];
|
|
204
207
|
return {
|
|
205
|
-
|
|
208
|
+
findings: normalize(input, url, target, options.inspectorProjectMap),
|
|
206
209
|
sourceRepositories: [{ url }],
|
|
207
210
|
};
|
|
208
211
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-findings-read.js","sourceRoot":"","sources":["../src/external-findings-read.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,2BAA2B,EAC3B,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AACjF,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EACL,sBAAsB,EACtB,8BAA8B,EAC9B,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EACL,yBAAyB,EACzB,iCAAiC,GAClC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,gCAAgC,EAChC,0BAA0B,EAC1B,kCAAkC,GACnC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,0BAA0B,EAC1B,kCAAkC,GACnC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,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0BAA0B,EAAE,GAAG,EAAE,CACvD,8BAA8B,CAAC,KAAK,EAAE,MAAM,CAAC,CAC9C;YACD,kBAAkB,EAChB,qBAAqB,CAAC,KAAK,EAAE,OAAO,CAAC;gBACrC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAChC,wBAAwB,CAAC,QAAQ,EAAE,GAAG,CAAC,CACxC;SACJ,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC,GACtC;QACE,SAAS,EAAE;YACT,0BAA0B;YAC1B,kCAAkC;YAClC,GAAG,EAAE,CAAC,IAAI;SACX;QACD,SAAS,EAAE;YACT,0BAA0B;YAC1B,kCAAkC;YAClC,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;SAC5B;QACD,SAAS,EAAE;YACT,0BAA0B;YAC1B,kCAAkC;YAClC,gCAAgC;SACjC;QACD,QAAQ,EAAE;YACR,yBAAyB;YACzB,iCAAiC;YACjC,0BAA0B;SAC3B;KAEJ,CAAC,QAAQ,CAAC,CAAC;IACZ,MAAM,IAAI,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAU,CAAC;IACxE,OAAO;QACL,GAAG,UAAU,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;QACvE,kBAAkB,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;KAC9B,CAAC;AACJ,CAAC","sourcesContent":["import type {\n ExternalFinding,\n ExternalFindings,\n ExternalPublicationInput,\n ExternalSourceRepository,\n} from \"./external-findings.js\";\nimport { readScannerJson, sarifRunRepositories } from \"./scanner-import.js\";\nimport type { Provider } from \"./external-import-models.js\";\nimport { CodexSecurityError } from \"./errors.js\";\nimport { readTenableFindings } from \"./tenable-findings.js\";\nimport type { ExternalImportTarget } from \"./external-import-contract.js\";\nimport { dependabotRepository } from \"./github-dependabot-findings.js\";\nimport {\n normalizeSnykFile,\n readSnykReport,\n emptySnykReportRepositories,\n snykRepositoryUrls,\n} from \"./snyk-findings.js\";\nimport {\n isSemgrepSarifDriver,\n normalizeSemgrepFindings,\n readSemgrepReport,\n} from \"./semgrep-findings.js\";\nimport { semgrepPlatformReportRepository } from \"./semgrep-platform-findings.js\";\nimport {\n normalizeTrivyFindings,\n needsPreviousTrivyProjection,\n normalizePreviousTrivyFindings,\n} from \"./trivy-findings.js\";\nimport { readOpenGrepFindings } from \"./opengrep-findings.js\";\nimport {\n normalizeEndorFindings,\n normalizePreviousEndorFindings,\n endorRepositoryUrls,\n} from \"./endor-findings.js\";\nimport { readGitHubFindings } from \"./github-findings.js\";\nimport { readSonarFindings } from \"./sonar-findings.js\";\nimport {\n normalizeVeracodeFindings,\n normalizePreviousVeracodeFindings,\n} from \"./veracode-findings.js\";\nimport {\n needsPreviousBlackDuckProjection,\n normalizeBlackDuckFindings,\n normalizePreviousBlackDuckFindings,\n} from \"./blackduck-findings.js\";\nimport {\n normalizeContinuumFindings,\n normalizePreviousContinuumFindings,\n} from \"./continuum-findings.js\";\nimport { readCheckmarxFindings } from \"./checkmarx-findings.js\";\nimport {\n normalizeInspectorFindings,\n normalizePreviousInspectorFindings,\n} from \"./inspector-findings.js\";\nimport { hasPreviousCloudProjection } from \"./reader-selection.js\";\nimport { isRecord } from \"./record.js\";\nimport {\n readLocalWizFindings,\n readVendorFindingsForPublication,\n wizFindingRepository,\n} from \"./wiz-findings.js\";\n\nexport type LocalFindingProvider = Provider | \"tenable\";\n\n/** File reader names mapped to the provider stored with each finding. */\nexport const EXTERNAL_FINDINGS_PROVIDERS = {\n wiz: \"wiz\",\n snyk: \"snyk\",\n semgrep: \"semgrep\",\n trivy: \"trivy\",\n // OpenGrep uses the existing SAST contract; evidence retains its scanner origin.\n opengrep: \"semgrep\",\n endor: \"endor\",\n github: \"github\",\n inspector: \"inspector\",\n blackduck: \"blackduck\",\n veracode: \"veracode\",\n sonar: \"sonar\",\n continuum: \"continuum\",\n checkmarx: \"checkmarx\",\n tenable: \"tenable\",\n} as const satisfies Record<string, LocalFindingProvider>;\n\nexport type ExternalFindingsReader = keyof typeof EXTERNAL_FINDINGS_PROVIDERS;\nexport type CloudFindingsReader = Exclude<ExternalFindingsReader, \"tenable\">;\n\nexport function requireCloudReader(\n options: ExternalFindingsReaderOptions,\n): asserts options is ExternalFindingsReaderOptions & {\n provider: CloudFindingsReader;\n} {\n if (options.provider === \"tenable\")\n throw new CodexSecurityError(\n \"Tenable findings require a local import (--to local).\",\n );\n}\n\nexport const EXTERNAL_FINDINGS_READERS = Object.keys(\n EXTERNAL_FINDINGS_PROVIDERS,\n) as ExternalFindingsReader[];\n\n/** File readers available in this SDK. Cloud supports a subset of these readers. */\nexport interface ExternalFindingsReaderOptions {\n provider: ExternalFindingsReader;\n sourceRepositoryUrl?: string;\n inspectorProjectMap?: ReadonlyMap<string, string>;\n trivyScanRoot?: string;\n}\n\n/** @internal Shared parser output, including immutable Cloud retry projections. */\nexport interface ReadExternalFindings {\n findings: ExternalFindings;\n previousFindings?: () => ExternalFindings;\n /** Preserve previous Wiz projections when resuming immutable Cloud requests. */\n publication?: ExternalPublicationInput;\n sourceRepositories?: ExternalSourceRepository[];\n}\n\n/** Repository references retained by a provider's individual finding. */\nexport function localFindingRepositories(\n provider: Provider,\n finding: ExternalFinding,\n): ExternalSourceRepository[] {\n const { evidence } = finding;\n if (provider === \"snyk\")\n return snykRepositoryUrls(evidence.source_data, {\n normalizeGitRemote: false,\n }).map((url) => ({ url }));\n if (provider === \"endor\")\n return endorRepositoryUrls(evidence.source_data).map((url) => ({ url }));\n if (provider === \"wiz\") {\n const repository = wizFindingRepository(evidence);\n return repository ? [repository] : [];\n }\n if (provider === \"github\") {\n const url = dependabotRepository(finding);\n if (url) return [{ url, platform: \"github\" }];\n }\n return [];\n}\n\n/** Repository claims retained by the Semgrep SARIF reader. */\nexport function semgrepSarifRepositories(\n { evidence }: ExternalFinding,\n allowPartialCloudUrl = false,\n): { url: string; branch?: string }[] {\n const data = evidence.source_data;\n const document = data?.[\"documentContext\"];\n const driver = data?.[\"driverContext\"];\n const partial = allowPartialCloudUrl && document === undefined;\n if (\n (!partial && (!isRecord(document) || document[\"version\"] !== \"2.1.0\")) ||\n !isRecord(driver) ||\n typeof driver[\"name\"] !== \"string\" ||\n !isSemgrepSarifDriver(driver[\"name\"]) ||\n !isRecord(data?.[\"result\"])\n )\n return [];\n const context = data[\"runContext\"];\n const references = isRecord(context)\n ? context[\"versionControlProvenance\"]\n : undefined;\n return Array.isArray(references)\n ? references.flatMap((reference) =>\n isRecord(reference) &&\n typeof reference[\"repositoryUri\"] === \"string\" &&\n reference[\"repositoryUri\"].trim()\n ? [\n {\n url: reference[\"repositoryUri\"],\n ...(!partial &&\n typeof reference[\"branch\"] === \"string\" && {\n branch: reference[\"branch\"],\n }),\n },\n ]\n : [],\n )\n : [];\n}\n\n/** A run may name a repository even when it produces no findings. */\nfunction sarifFileRepositories(\n input: unknown,\n producer: \"Endor\" | \"Semgrep\" | \"Snyk\",\n) {\n if (\n isRecord(input) &&\n input[\"version\"] === \"2.1.0\" &&\n Array.isArray(input[\"runs\"])\n )\n return input[\"runs\"].flatMap((run) => sarifRunRepositories(run, producer));\n}\n\n/** Repository claims from every project or SARIF run, even those with no findings. */\nexport function snykFileRepositories(input: unknown) {\n return (\n sarifFileRepositories(input, \"Snyk\") ?? emptySnykReportRepositories(input)\n );\n}\n\n/** @internal Read vendor evidence for the local and Cloud import entrypoints. */\nexport async function readExternalFindings(\n path: string,\n options: ExternalFindingsReaderOptions,\n target: ExternalImportTarget = \"cloud\",\n references: readonly ExternalSourceRepository[] = [],\n): Promise<ReadExternalFindings> {\n const { provider } = options;\n const url = options.sourceRepositoryUrl ?? \"\";\n // Both projections describe the same captured rows, including exclusions.\n function withReplay(\n findings: ExternalFindings,\n couldDiffer: (findings: ExternalFindings) => boolean,\n previous: () => ExternalFindings,\n ): ReadExternalFindings {\n return {\n findings,\n previousFindings:\n target === \"cloud\" && couldDiffer(findings) ? previous : undefined,\n };\n }\n if (provider === \"tenable\") {\n if (target === \"cloud\") requireCloudReader(options);\n return { findings: await readTenableFindings(path, url) };\n }\n if (provider === \"sonar\") {\n const findings = await readSonarFindings(path, url, target);\n const binding = findings.report?.[\"repositoryUrl\"];\n return {\n findings,\n sourceRepositories: typeof binding === \"string\" ? [{ url: binding }] : [],\n };\n }\n if (provider === \"opengrep\" || provider === \"checkmarx\") {\n const findings =\n provider === \"opengrep\"\n ? await readOpenGrepFindings(path, { sourceRepositoryUrl: url }, target)\n : await readCheckmarxFindings(path, url, target);\n return { findings, sourceRepositories: [{ url }] };\n }\n if (provider === \"snyk\") {\n const input = await readSnykReport(path);\n const findings = await normalizeSnykFile(input, target, references);\n return { findings, sourceRepositories: snykFileRepositories(input) };\n }\n if (provider === \"semgrep\") {\n const input = await readSemgrepReport(path);\n const findings = normalizeSemgrepFindings(\n input,\n {\n sourceRepositoryUrl: options.sourceRepositoryUrl,\n sourceRepositories: references,\n },\n target,\n );\n if (semgrepPlatformReportRepository(findings)) return { findings };\n const sourceRepositories = sarifFileRepositories(input, \"Semgrep\") ?? [];\n if (!sourceRepositories.length && options.sourceRepositoryUrl)\n sourceRepositories.push({ url: options.sourceRepositoryUrl });\n return { findings, sourceRepositories };\n }\n if (provider === \"github\")\n return { findings: await readGitHubFindings(path, target) };\n if (provider === \"wiz\") {\n const wiz =\n target === \"local\"\n ? await readLocalWizFindings(path)\n : await readVendorFindingsForPublication(path, target);\n const sourceRepositories = wiz.current.findings.flatMap((finding) =>\n localFindingRepositories(\"wiz\", finding),\n );\n return {\n findings: wiz.current,\n ...(\"legacy\" in wiz && { publication: wiz }),\n sourceRepositories: [...wiz.sourceRepositories, ...sourceRepositories],\n };\n }\n const input = await readScannerJson(path);\n if (provider === \"trivy\") {\n const args = [input, target, options.trivyScanRoot] as const;\n return withReplay(\n normalizeTrivyFindings(...args),\n needsPreviousTrivyProjection,\n () => normalizePreviousTrivyFindings(...args),\n );\n }\n if (provider === \"endor\") {\n const findings = normalizeEndorFindings(input, target);\n return {\n ...withReplay(findings, hasPreviousCloudProjection, () =>\n normalizePreviousEndorFindings(input, target),\n ),\n sourceRepositories:\n sarifFileRepositories(input, \"Endor\") ??\n findings.findings.flatMap((row) =>\n localFindingRepositories(provider, row),\n ),\n };\n }\n const [normalize, previous, couldDiffer] = (\n {\n inspector: [\n normalizeInspectorFindings,\n normalizePreviousInspectorFindings,\n () => true,\n ],\n continuum: [\n normalizeContinuumFindings,\n normalizePreviousContinuumFindings,\n () => !Array.isArray(input),\n ],\n blackduck: [\n normalizeBlackDuckFindings,\n normalizePreviousBlackDuckFindings,\n needsPreviousBlackDuckProjection,\n ],\n veracode: [\n normalizeVeracodeFindings,\n normalizePreviousVeracodeFindings,\n hasPreviousCloudProjection,\n ],\n } as const\n )[provider];\n const args = [input, url, target, options.inspectorProjectMap] as const;\n return {\n ...withReplay(normalize(...args), couldDiffer, () => previous(...args)),\n sourceRepositories: [{ url }],\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"external-findings-read.js","sourceRoot":"","sources":["../src/external-findings-read.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EACL,iBAAiB,EACjB,2BAA2B,EAC3B,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,GAClB,MAAM,uB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S,GAAG;QAChB,SAAS,EAAE,0BAA0B;QACrC,SAAS,EAAE,0BAA0B;QACrC,QAAQ,EAAE,yBAAyB;KACpC,CAAC,QAAQ,CAAC,CAAC;IACZ,OAAO;QACL,QAAQ,EAAE,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC;QACpE,kBAAkB,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;KAC9B,CAAC;AACJ,CAAC","sourcesContent":["import type {\n ExternalFinding,\n ExternalFindings,\n ExternalSourceRepository,\n} from \"./external-findings.js\";\nimport { readScannerJson, sarifRunRepositories } from \"./scanner-import.js\";\nimport type { Provider } from \"./external-import-models.js\";\nimport { CodexSecurityError } from \"./errors.js\";\nimport { readTenableFindings } from \"./tenable-findings.js\";\nimport { readCrowdStrikeFindings } from \"./crowdstrike-findings.js\";\nimport type { ExternalImportTarget } from \"./external-import-contract.js\";\nimport { dependabotRepository } from \"./github-dependabot-findings.js\";\nimport {\n normalizeSnykFile,\n emptySnykReportRepositories,\n snykRepositoryUrls,\n} from \"./snyk-findings.js\";\nimport {\n isSemgrepSarifDriver,\n normalizeSemgrepFindings,\n readSemgrepReport,\n} from \"./semgrep-findings.js\";\nimport { semgrepPlatformReportRepository } from \"./semgrep-platform-findings.js\";\nimport { normalizeTrivyFindings } from \"./trivy-findings.js\";\nimport { readOpenGrepFindings } from \"./opengrep-findings.js\";\nimport {\n normalizeEndorFindings,\n endorRepositoryUrls,\n} from \"./endor-findings.js\";\nimport { readGitHubFindings } from \"./github-findings.js\";\nimport { readSonarFindings } from \"./sonar-findings.js\";\nimport { normalizeVeracodeFindings } from \"./veracode-findings.js\";\nimport { normalizeBlackDuckFindings } from \"./blackduck-findings.js\";\nimport { normalizeContinuumFindings } from \"./continuum-findings.js\";\nimport { readCheckmarxFindings } from \"./checkmarx-findings.js\";\nimport { normalizeInspectorFindings } from \"./inspector-findings.js\";\nimport { isRecord } from \"./record.js\";\nimport { readWizSelection, wizFindingRepository } from \"./wiz-findings.js\";\nimport { normalizeArmorCodeFindings } from \"./armorcode-findings.js\";\n\n/** Readers whose findings Cloud does not accept, with their display names. */\nexport const LOCAL_ONLY_PROVIDERS = {\n tenable: \"Tenable\",\n crowdstrike: \"CrowdStrike\",\n} as const;\ntype LocalOnlyProvider = keyof typeof LOCAL_ONLY_PROVIDERS;\n\nexport type LocalFindingProvider = Provider | LocalOnlyProvider;\n\n/** File reader names mapped to the provider stored with each finding. */\nexport const EXTERNAL_FINDINGS_PROVIDERS = {\n wiz: \"wiz\",\n armorcode: \"armorcode\",\n snyk: \"snyk\",\n semgrep: \"semgrep\",\n trivy: \"trivy\",\n // OpenGrep uses the existing SAST contract; evidence retains its scanner origin.\n opengrep: \"semgrep\",\n endor: \"endor\",\n github: \"github\",\n inspector: \"inspector\",\n blackduck: \"blackduck\",\n veracode: \"veracode\",\n sonar: \"sonar\",\n continuum: \"continuum\",\n checkmarx: \"checkmarx\",\n tenable: \"tenable\",\n crowdstrike: \"crowdstrike\",\n} as const satisfies Record<string, LocalFindingProvider>;\n\nexport type ExternalFindingsReader = keyof typeof EXTERNAL_FINDINGS_PROVIDERS;\nexport type CloudFindingsReader = Exclude<\n ExternalFindingsReader,\n LocalOnlyProvider\n>;\n\nexport function requireCloudReader(\n options: ExternalFindingsReaderOptions,\n): asserts options is ExternalFindingsReaderOptions & {\n provider: CloudFindingsReader;\n} {\n if (Object.hasOwn(LOCAL_ONLY_PROVIDERS, options.provider))\n throw new CodexSecurityError(\n `${LOCAL_ONLY_PROVIDERS[options.provider as LocalOnlyProvider]} findings require a local import (--to local).`,\n );\n}\n\nexport const EXTERNAL_FINDINGS_READERS = Object.keys(\n EXTERNAL_FINDINGS_PROVIDERS,\n) as ExternalFindingsReader[];\n\n/** File readers available in this SDK. Cloud supports a subset of these readers. */\nexport interface ExternalFindingsReaderOptions {\n provider: ExternalFindingsReader;\n sourceRepositoryUrl?: string;\n inspectorProjectMap?: ReadonlyMap<string, string>;\n trivyScanRoot?: string;\n}\n\n/** @internal Normalized file contents and any repository claims supplied by its reader. */\nexport interface ReadExternalFindings {\n findings: ExternalFindings;\n sourceRepositories?: ExternalSourceRepository[];\n}\n\n/** Repository references retained by a provider's individual finding. */\nexport function localFindingRepositories(\n provider: Provider,\n finding: ExternalFinding,\n): ExternalSourceRepository[] {\n const { evidence } = finding;\n if (provider === \"snyk\")\n return snykRepositoryUrls(evidence.source_data, {\n normalizeGitRemote: false,\n }).map((url) => ({ url }));\n if (provider === \"endor\")\n return endorRepositoryUrls(evidence.source_data).map((url) => ({ url }));\n if (provider === \"wiz\") {\n const repository = wizFindingRepository(evidence);\n return repository ? [repository] : [];\n }\n if (provider === \"github\") {\n const url = dependabotRepository(finding);\n if (url) return [{ url, platform: \"github\" }];\n }\n return [];\n}\n\n/** Repository claims retained by the Semgrep SARIF reader. */\nexport function semgrepSarifRepositories(\n { evidence }: ExternalFinding,\n allowPartialCloudUrl = false,\n): { url: string; branch?: string }[] {\n const data = evidence.source_data;\n const document = data?.[\"documentContext\"];\n const driver = data?.[\"driverContext\"];\n const partial = allowPartialCloudUrl && document === undefined;\n if (\n (!partial && (!isRecord(document) || document[\"version\"] !== \"2.1.0\")) ||\n !isRecord(driver) ||\n typeof driver[\"name\"] !== \"string\" ||\n !isSemgrepSarifDriver(driver[\"name\"]) ||\n !isRecord(data?.[\"result\"])\n )\n return [];\n const context = data[\"runContext\"];\n const references = isRecord(context)\n ? context[\"versionControlProvenance\"]\n : undefined;\n return Array.isArray(references)\n ? references.flatMap((reference) =>\n isRecord(reference) &&\n typeof reference[\"repositoryUri\"] === \"string\" &&\n reference[\"repositoryUri\"].trim()\n ? [\n {\n url: reference[\"repositoryUri\"],\n ...(!partial &&\n typeof reference[\"branch\"] === \"string\" && {\n branch: reference[\"branch\"],\n }),\n },\n ]\n : [],\n )\n : [];\n}\n\n/** A run may name a repository even when it produces no findings. */\nfunction sarifFileRepositories(\n input: unknown,\n producer: \"Endor\" | \"Semgrep\" | \"Snyk\",\n) {\n if (\n isRecord(input) &&\n input[\"version\"] === \"2.1.0\" &&\n Array.isArray(input[\"runs\"])\n )\n return input[\"runs\"].flatMap((run) => sarifRunRepositories(run, producer));\n}\n\n/** Repository claims from every project or SARIF run, even those with no findings. */\nexport function snykFileRepositories(input: unknown) {\n return (\n sarifFileRepositories(input, \"Snyk\") ?? emptySnykReportRepositories(input)\n );\n}\n\n/** @internal Read vendor evidence for the local and Cloud import entrypoints. */\nexport async function readExternalFindings(\n path: string,\n options: ExternalFindingsReaderOptions,\n target: ExternalImportTarget = \"cloud\",\n references: readonly ExternalSourceRepository[] = [],\n): Promise<ReadExternalFindings> {\n const { provider } = options;\n const url = options.sourceRepositoryUrl ?? \"\";\n if (provider === \"tenable\") {\n if (target === \"cloud\") requireCloudReader(options);\n return { findings: await readTenableFindings(path, url) };\n }\n if (provider === \"crowdstrike\") {\n if (target === \"cloud\") requireCloudReader(options);\n return {\n findings: await readCrowdStrikeFindings(\n path,\n options.sourceRepositoryUrl,\n ),\n };\n }\n if (provider === \"sonar\") {\n const findings = await readSonarFindings(path, url, target);\n const binding = findings.report?.[\"repositoryUrl\"];\n return {\n findings,\n sourceRepositories: typeof binding === \"string\" ? [{ url: binding }] : [],\n };\n }\n if (provider === \"opengrep\" || provider === \"checkmarx\") {\n const findings =\n provider === \"opengrep\"\n ? await readOpenGrepFindings(path, { sourceRepositoryUrl: url }, target)\n : await readCheckmarxFindings(path, url, target);\n return { findings, sourceRepositories: [{ url }] };\n }\n if (provider === \"snyk\") {\n const input = await readScannerJson(path);\n const findings = await normalizeSnykFile(input, target, references);\n return { findings, sourceRepositories: snykFileRepositories(input) };\n }\n if (provider === \"semgrep\") {\n const input = await readSemgrepReport(path);\n const findings = normalizeSemgrepFindings(\n input,\n {\n sourceRepositoryUrl: options.sourceRepositoryUrl,\n sourceRepositories: references,\n },\n target,\n );\n if (semgrepPlatformReportRepository(findings)) return { findings };\n const sourceRepositories = sarifFileRepositories(input, \"Semgrep\") ?? [];\n if (!sourceRepositories.length && options.sourceRepositoryUrl)\n sourceRepositories.push({ url: options.sourceRepositoryUrl });\n return { findings, sourceRepositories };\n }\n if (provider === \"armorcode\") {\n const input = await readScannerJson(path);\n return {\n findings: normalizeArmorCodeFindings(\n input,\n target,\n options.sourceRepositoryUrl,\n ),\n };\n }\n if (provider === \"github\")\n return { findings: await readGitHubFindings(path, target) };\n if (provider === \"wiz\") {\n const wiz = await readWizSelection(path, target);\n const sourceRepositories = wiz.findings.findings.flatMap((finding) =>\n localFindingRepositories(\"wiz\", finding),\n );\n return {\n findings: wiz.findings,\n sourceRepositories: [...wiz.sourceRepositories, ...sourceRepositories],\n };\n }\n const input = await readScannerJson(path);\n if (provider === \"trivy\")\n return {\n findings: normalizeTrivyFindings(input, target, options.trivyScanRoot),\n };\n if (provider === \"endor\") {\n const findings = normalizeEndorFindings(input, target);\n return {\n findings,\n sourceRepositories:\n sarifFileRepositories(input, \"Endor\") ??\n findings.findings.flatMap((row) =>\n localFindingRepositories(provider, row),\n ),\n };\n }\n if (provider === \"continuum\") {\n const findings = normalizeContinuumFindings(input, url, target);\n const binding = findings.report?.[\"sourceRepositoryUrl\"];\n return {\n findings,\n sourceRepositories: [\n { url: typeof binding === \"string\" ? binding : url },\n ],\n };\n }\n const normalize = {\n inspector: normalizeInspectorFindings,\n blackduck: normalizeBlackDuckFindings,\n veracode: normalizeVeracodeFindings,\n }[provider];\n return {\n findings: normalize(input, url, target, options.inspectorProjectMap),\n sourceRepositories: [{ url }],\n };\n}\n"]}
|
|
@@ -35,7 +35,7 @@ export declare class NoPublishableFindingsError extends CodexSecurityError {
|
|
|
35
35
|
export declare function reportForJson(report: ExternalFindings["report"]): Record<string, unknown> | undefined;
|
|
36
36
|
export declare const nativeErrorStackGetter: (() => any) | undefined;
|
|
37
37
|
/** Capture the caller's import settings before reading an export or resolving its destination. */
|
|
38
|
-
export declare function snapshotImportOptions<P extends
|
|
38
|
+
export declare function snapshotImportOptions<P extends string>({ repository, provider, sourceKey, sourceRepositoryUrl, trivyScanRoot, inspectorProjectMap, }: Omit<LocalExternalImportOptions, "provider"> & {
|
|
39
39
|
provider: P;
|
|
40
40
|
}): {
|
|
41
41
|
repository: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-findings.d.ts","sourceRoot":"","sources":["../src/external-findings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAQhF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,iFAAiF;AACjF,MAAM,WAAW,eAAe;IAC9B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,uBAAuB,CAAC;CACnC;AAED,iFAAiF;AACjF,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAChC;AAED,wBAAgB,0BAA0B,CACxC,UAAU,GAAE,SAAS,wBAAwB,EAAO,GACnD,wBAAwB,EAAE,CAE5B;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,QAAQ,EAAE;QACR,QAAQ,EAAE,MAAM,CAAC;QACjB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;QACjC,MAAM,EAAE,MAAM,CAAC;KAChB,EAAE,CAAC;CACL;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAErE;AAED,2FAA2F;AAC3F,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,gBAAgB,GACtB,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,QAA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AE,gBAAgB,GAAG,OAAO,CAErE;AAED,2FAA2F;AAC3F,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,gBAAgB,GACtB,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAM3C;AAED,gGAAgG;AAChG,qBAAa,0BAA2B,SAAQ,kBAAkB;aAGpC,SAAS,EAAE,gBAAgB;IAFvD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,YAA4B,SAAS,EAAE,gBAAgB,EAWtD;CACF;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,uCAO/D;AAGD,eAAO,MAAM,sBAAsB,yBAG7B,CAAC;AAuIP,kGAAkG;AAClG,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EAAE,EACtD,UAAU,EACV,QAAQ,EACR,SAAS,EACT,mBAAmB,EACnB,aAAa,EACb,mBAAmB,GACpB,EAAE,IAAI,CAAC,0BAA0B,EAAE,UAAU,CAAC,GAAG;IAAE,QAAQ,EAAE,CAAC,CAAA;CAAE;;;;;;;EAqBhE"}
|
|
@@ -69,7 +69,7 @@ function cloneScannerDiagnostic(source) {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
/** @internal Capture fresh input once, so preview, limits and storage use the same JSON. */
|
|
72
|
-
export function snapshotNormalizedFindings(input, checkEvidenceNumber = (value) => requireJsonNumber(value, "Evidence"), target = "local") {
|
|
72
|
+
export function snapshotNormalizedFindings(input, checkEvidenceNumber = (value) => requireJsonNumber(value, "Evidence"), target = "local", provider) {
|
|
73
73
|
const fields = new Map();
|
|
74
74
|
const errors = [];
|
|
75
75
|
let root;
|
|
@@ -135,6 +135,17 @@ export function snapshotNormalizedFindings(input, checkEvidenceNumber = (value)
|
|
|
135
135
|
Object.defineProperties(error, Object.getOwnPropertyDescriptors(parent[key]));
|
|
136
136
|
parent[key] = error;
|
|
137
137
|
}
|
|
138
|
+
// Reader scope can live on a getter. Do not evaluate enumerable getters twice.
|
|
139
|
+
if (provider !== undefined) {
|
|
140
|
+
const keys = ["sourceFormat", "semgrepPlatformScope", "snykRestContext"];
|
|
141
|
+
if (provider === "semgrep" || provider === "snyk")
|
|
142
|
+
keys.push("sourceRepositoryUrl", "sourceRepositoryPlatform");
|
|
143
|
+
for (const key of keys)
|
|
144
|
+
if (!(key in result) &&
|
|
145
|
+
key in input &&
|
|
146
|
+
!Object.prototype.propertyIsEnumerable.call(input, key))
|
|
147
|
+
result[key] = structuredClone(Reflect.get(input, key));
|
|
148
|
+
}
|
|
138
149
|
return result;
|
|
139
150
|
}
|
|
140
151
|
/** @internal Clone owned values without serializing the evidence again in every preview view. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-findings.js","sourceRoot":"","sources":["../src/external-findings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,yBAAyB,EACzB,iBAAiB,GAElB,MAAM,+BAA+B,CAAC;AAevC,MAAM,UAAU,0BAA0B,CACxC,UAAU,GAAwC,EAAE;IAEpD,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;AACpE,CAAC;AAcD,MAAM,UAAU,oBAAoB,CAAC,KAAuB;IAC1D,OAAO,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;AAC9E,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,yBAAyB,CACvC,KAAuB;IAEvB,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM;QA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V,QAAQ;QACR,SAAS;QACT,mBAAmB;QACnB,aAAa;QACb,mBAAmB,EAAE,mBAAmB,IAAI,IAAI,GAAG,CAAC,mBAAmB,CAAC;KACzE,CAAC;AACJ,CAAC","sourcesContent":["import { isNativeError, isNumberObject } from \"node:util/types\";\nimport { CodexSecurityError } from \"./errors.js\";\nimport type { LocalExternalImportOptions } from \"./external-findings-import.js\";\nimport {\n checkEmittedJsonNumber,\n checkReportNumber,\n requireCloudEvidenceDepth,\n requireJsonNumber,\n type ExternalImportTarget,\n} from \"./external-import-contract.js\";\nimport type { ExternalFindingEvidence } from \"./external-import-models.js\";\n\n/** A provider occurrence and its evidence, independent of a Codex assessment. */\nexport interface ExternalFinding {\n source_finding_id: string;\n evidence: ExternalFindingEvidence;\n}\n\n/** Repository provenance retained by a reader outside the published evidence. */\nexport interface ExternalSourceRepository {\n url: string;\n platform?: \"github\" | \"gitlab\";\n}\n\nexport function snapshotSourceRepositories(\n references: readonly ExternalSourceRepository[] = [],\n): ExternalSourceRepository[] {\n return references.map(({ url, platform }) => ({ url, platform }));\n}\n\nexport interface ExternalFindings {\n read: number;\n /** Reader-retained run metadata, including diagnostics for empty reports. */\n report?: Record<string, unknown>;\n findings: ExternalFinding[];\n excluded: {\n position: number;\n source_finding_id: string | null;\n reason: string;\n }[];\n}\n\nexport function hasNoExternalRecords(input: ExternalFindings): boolean {\n return input.read === 0 && !input.findings.length && !input.excluded.length;\n}\n\n/** Classify a reader selection before deciding whether to store, publish, or report it. */\nexport function externalImportDisposition(\n input: ExternalFindings,\n): \"ready\" | \"empty\" | \"excluded\" | \"failed\" {\n if (input.findings.length) return \"ready\";\n const errors = input.report?.[\"errors\"];\n if (Array.isArray(errors) && errors.length) return \"failed\";\n if (hasNoExternalRecords(input)) return \"empty\";\n return input.read === input.excluded.length ? \"excluded\" : \"failed\";\n}\n\n/** No findings can be imported. The selection retains every reader exclusion and diagnostic. */\nexport class NoPublishableFindingsError extends CodexSecurityError {\n readonly summary: string;\n\n constructor(public readonly selection: ExternalFindings) {\n const diagnostics = reportForJson(selection.report)?.[\"errors\"];\n const summary =\n externalImportDisposition(selection) === \"empty\"\n ? \"No supported findings are ready to publish: the report is empty.\"\n : `No supported findings are ready to publish (${selection.read} read, ${selection.excluded.length} excluded).${Array.isArray(diagnostics) && diagnostics.length ? ` Scanner diagnostics: ${JSON.stringify(diagnostics)}` : \"\"}`;\n const reasons = selection.excluded.map(\n (item) => `Item ${item.position}: ${item.reason}`,\n );\n super([summary, ...reasons].join(\" \"));\n this.summary = summary;\n }\n}\n\nexport function reportForJson(report: ExternalFindings[\"report\"]) {\n const errors = report?.[\"errors\"];\n if (!Array.isArray(errors)) return report;\n const json = JSON.stringify(errors, (_key, entry: unknown) =>\n entry instanceof Error ? { ...entry, message: entry.message } : entry,\n );\n return { ...report, errors: JSON.parse(json) as unknown[] };\n}\n\nconst isScannerError = Error.isError ?? isNativeError;\nexport const nativeErrorStackGetter = Object.getOwnPropertyDescriptor(\n new Error(),\n \"stack\",\n)?.get;\n\nfunction cloneScannerDiagnostic(source: Error): Error {\n const message = Object.getOwnPropertyDescriptor(source, \"message\");\n const stack = Object.getOwnPropertyDescriptor(source, \"stack\");\n try {\n if (\n (!message || Object.hasOwn(message, \"value\")) &&\n (!stack?.get || stack.get === nativeErrorStackGetter)\n )\n return structuredClone(source);\n // Keep the native error type and data-valued cause without running a\n // caller-supplied message or stack getter while restoring diagnostics.\n const cause = Object.getOwnPropertyDescriptor(source, \"cause\");\n const clean = new Error(message?.value, { cause: cause?.value });\n const name = Object.getOwnPropertyDescriptor(\n Object.getPrototypeOf(source),\n \"name\",\n )?.value;\n if (typeof name === \"string\") clean.name = name;\n if (!message?.get && nativeErrorStackGetter) {\n const nativeStack: unknown = nativeErrorStackGetter.call(source);\n if (typeof nativeStack === \"string\") clean.stack = nativeStack;\n }\n return structuredClone(clean);\n } catch {\n // A noncloneable cause does not prevent JSON export.\n return new Error(message?.value);\n }\n}\n\n/** @internal Capture fresh input once, so preview, limits and storage use the same JSON. */\nexport function snapshotNormalizedFindings<T extends Partial<ExternalFindings>>(\n input: T,\n checkEvidenceNumber = (value: number) => requireJsonNumber(value, \"Evidence\"),\n target: ExternalImportTarget = \"local\",\n): T {\n const fields = new Map<string, unknown>();\n const errors: { path: string[]; error: Error }[] = [];\n let root: unknown;\n\n function captureField(field: string, observed: unknown): string | undefined {\n const parents: { key: string; value: object }[] = [];\n // The outer traversal already called this field's toJSON with its real key.\n // Returning that value from the wrapper keeps JSON from calling it twice.\n return JSON.stringify(\n { toJSON: () => observed },\n function (this: object, key, value: unknown) {\n while (parents.length && parents.at(-1)!.value !== this) parents.pop();\n const evidence = field === \"findings\" && parents[2]?.key === \"evidence\";\n if (evidence && target === \"cloud\")\n requireCloudEvidenceDepth(parents.length - 2, this, value);\n if (isNumberObject(value)) value = +value;\n if (field === \"report\") checkReportNumber(value);\n if (evidence) checkEmittedJsonNumber(value, checkEvidenceNumber);\n if (value !== null && typeof value === \"object\") {\n if (value === root) {\n const path = [field, ...parents.slice(1).map((p) => p.key)];\n if (parents.length) path.push(key);\n throw new TypeError(\n `Converting circular structure to JSON at ${JSON.stringify(path)}`,\n );\n }\n if (\n field === \"report\" &&\n parents[1]?.key === \"errors\" &&\n Array.isArray(parents[1].value) &&\n isScannerError(value)\n ) {\n errors.push({\n path: [field, ...parents.slice(1).map((p) => p.key), key],\n error: value,\n });\n }\n parents.push({ key, value });\n }\n return value;\n },\n );\n }\n\n // Capture each member in native property order. A report and a findings\n // payload can each fit in a string while their combined JSON does not.\n const envelope = JSON.stringify(\n input,\n function (this: object, field, value: unknown) {\n if (this !== root) {\n root = value;\n return value;\n }\n const json = captureField(field, value);\n if (json === undefined) return undefined;\n fields.set(field, JSON.parse(json));\n return null;\n },\n );\n const result = JSON.parse(envelope);\n for (const [key, value] of fields) result[key] = value;\n for (const { path, error: source } of errors) {\n const key = path.pop()!;\n let parent = result as unknown as Record<string, unknown>;\n for (const field of path) parent = parent[field] as Record<string, unknown>;\n const error = cloneScannerDiagnostic(source);\n Object.defineProperties(\n error,\n Object.getOwnPropertyDescriptors(parent[key] as object),\n );\n parent[key] = error;\n }\n return result;\n}\n\n/** @internal Clone owned values without serializing the evidence again in every preview view. */\nexport function cloneImportPreview<T extends ExternalFindings>(input: T): T {\n if (input.report === undefined) return structuredClone(input);\n return {\n ...structuredClone({ ...input, report: undefined }),\n ...snapshotNormalizedFindings({ report: input.report }),\n };\n}\n\n/** @internal Keep earlier provider projections only for immutable request replay. */\nexport interface ExternalPublicationInput {\n current: ExternalFindings;\n legacy: ExternalFindings;\n currentIdentity: unknown;\n legacyIdentity: unknown;\n}\n\n/** Capture the caller's import settings before reading an export or resolving its destination. */\nexport function snapshotImportOptions<\n P extends LocalExternalImportOptions[\"provider\"],\n>({\n repository,\n provider,\n sourceKey,\n sourceRepositoryUrl,\n trivyScanRoot,\n inspectorProjectMap,\n}: LocalExternalImportOptions & { provider: P }) {\n if (provider === \"trivy\" && sourceRepositoryUrl !== undefined)\n throw new CodexSecurityError(\n \"Trivy reads repository provenance from the report; do not supply --source-repository-url.\",\n );\n if (trivyScanRoot !== undefined && provider !== \"trivy\")\n throw new CodexSecurityError(\n \"--trivy-scan-root applies only to --provider trivy.\",\n );\n if (inspectorProjectMap !== undefined && provider !== \"inspector\")\n throw new CodexSecurityError(\n \"An Inspector project map requires the inspector provider.\",\n );\n return {\n repository,\n provider,\n sourceKey,\n sourceRepositoryUrl,\n trivyScanRoot,\n inspectorProjectMap: inspectorProjectMap && new Map(inspectorProjectMap),\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"external-findings.js","sourceRoot":"","sources":["../src/external-findings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,yBAAyB,EACzB,iBAAiB,GAElB,MAAM,+BA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J,CAAC","sourcesContent":["import { isNativeError, isNumberObject } from \"node:util/types\";\nimport { CodexSecurityError } from \"./errors.js\";\nimport type { LocalExternalImportOptions } from \"./external-findings-import.js\";\nimport {\n checkEmittedJsonNumber,\n checkReportNumber,\n requireCloudEvidenceDepth,\n requireJsonNumber,\n type ExternalImportTarget,\n} from \"./external-import-contract.js\";\nimport type { ExternalFindingEvidence } from \"./external-import-models.js\";\n\n/** A provider occurrence and its evidence, independent of a Codex assessment. */\nexport interface ExternalFinding {\n source_finding_id: string;\n evidence: ExternalFindingEvidence;\n}\n\n/** Repository provenance retained by a reader outside the published evidence. */\nexport interface ExternalSourceRepository {\n url: string;\n platform?: \"github\" | \"gitlab\";\n}\n\nexport function snapshotSourceRepositories(\n references: readonly ExternalSourceRepository[] = [],\n): ExternalSourceRepository[] {\n return references.map(({ url, platform }) => ({ url, platform }));\n}\n\nexport interface ExternalFindings {\n read: number;\n /** Reader-retained run metadata, including diagnostics for empty reports. */\n report?: Record<string, unknown>;\n findings: ExternalFinding[];\n excluded: {\n position: number;\n source_finding_id: string | null;\n reason: string;\n }[];\n}\n\nexport function hasNoExternalRecords(input: ExternalFindings): boolean {\n return input.read === 0 && !input.findings.length && !input.excluded.length;\n}\n\n/** Classify a reader selection before deciding whether to store, publish, or report it. */\nexport function externalImportDisposition(\n input: ExternalFindings,\n): \"ready\" | \"empty\" | \"excluded\" | \"failed\" {\n if (input.findings.length) return \"ready\";\n const errors = input.report?.[\"errors\"];\n if (Array.isArray(errors) && errors.length) return \"failed\";\n if (hasNoExternalRecords(input)) return \"empty\";\n return input.read === input.excluded.length ? \"excluded\" : \"failed\";\n}\n\n/** No findings can be imported. The selection retains every reader exclusion and diagnostic. */\nexport class NoPublishableFindingsError extends CodexSecurityError {\n readonly summary: string;\n\n constructor(public readonly selection: ExternalFindings) {\n const diagnostics = reportForJson(selection.report)?.[\"errors\"];\n const summary =\n externalImportDisposition(selection) === \"empty\"\n ? \"No supported findings are ready to publish: the report is empty.\"\n : `No supported findings are ready to publish (${selection.read} read, ${selection.excluded.length} excluded).${Array.isArray(diagnostics) && diagnostics.length ? ` Scanner diagnostics: ${JSON.stringify(diagnostics)}` : \"\"}`;\n const reasons = selection.excluded.map(\n (item) => `Item ${item.position}: ${item.reason}`,\n );\n super([summary, ...reasons].join(\" \"));\n this.summary = summary;\n }\n}\n\nexport function reportForJson(report: ExternalFindings[\"report\"]) {\n const errors = report?.[\"errors\"];\n if (!Array.isArray(errors)) return report;\n const json = JSON.stringify(errors, (_key, entry: unknown) =>\n entry instanceof Error ? { ...entry, message: entry.message } : entry,\n );\n return { ...report, errors: JSON.parse(json) as unknown[] };\n}\n\nconst isScannerError = Error.isError ?? isNativeError;\nexport const nativeErrorStackGetter = Object.getOwnPropertyDescriptor(\n new Error(),\n \"stack\",\n)?.get;\n\nfunction cloneScannerDiagnostic(source: Error): Error {\n const message = Object.getOwnPropertyDescriptor(source, \"message\");\n const stack = Object.getOwnPropertyDescriptor(source, \"stack\");\n try {\n if (\n (!message || Object.hasOwn(message, \"value\")) &&\n (!stack?.get || stack.get === nativeErrorStackGetter)\n )\n return structuredClone(source);\n // Keep the native error type and data-valued cause without running a\n // caller-supplied message or stack getter while restoring diagnostics.\n const cause = Object.getOwnPropertyDescriptor(source, \"cause\");\n const clean = new Error(message?.value, { cause: cause?.value });\n const name = Object.getOwnPropertyDescriptor(\n Object.getPrototypeOf(source),\n \"name\",\n )?.value;\n if (typeof name === \"string\") clean.name = name;\n if (!message?.get && nativeErrorStackGetter) {\n const nativeStack: unknown = nativeErrorStackGetter.call(source);\n if (typeof nativeStack === \"string\") clean.stack = nativeStack;\n }\n return structuredClone(clean);\n } catch {\n // A noncloneable cause does not prevent JSON export.\n return new Error(message?.value);\n }\n}\n\n/** @internal Capture fresh input once, so preview, limits and storage use the same JSON. */\nexport function snapshotNormalizedFindings<T extends Partial<ExternalFindings>>(\n input: T,\n checkEvidenceNumber = (value: number) => requireJsonNumber(value, \"Evidence\"),\n target: ExternalImportTarget = \"local\",\n provider?: string,\n): T {\n const fields = new Map<string, unknown>();\n const errors: { path: string[]; error: Error }[] = [];\n let root: unknown;\n\n function captureField(field: string, observed: unknown): string | undefined {\n const parents: { key: string; value: object }[] = [];\n // The outer traversal already called this field's toJSON with its real key.\n // Returning that value from the wrapper keeps JSON from calling it twice.\n return JSON.stringify(\n { toJSON: () => observed },\n function (this: object, key, value: unknown) {\n while (parents.length && parents.at(-1)!.value !== this) parents.pop();\n const evidence = field === \"findings\" && parents[2]?.key === \"evidence\";\n if (evidence && target === \"cloud\")\n requireCloudEvidenceDepth(parents.length - 2, this, value);\n if (isNumberObject(value)) value = +value;\n if (field === \"report\") checkReportNumber(value);\n if (evidence) checkEmittedJsonNumber(value, checkEvidenceNumber);\n if (value !== null && typeof value === \"object\") {\n if (value === root) {\n const path = [field, ...parents.slice(1).map((p) => p.key)];\n if (parents.length) path.push(key);\n throw new TypeError(\n `Converting circular structure to JSON at ${JSON.stringify(path)}`,\n );\n }\n if (\n field === \"report\" &&\n parents[1]?.key === \"errors\" &&\n Array.isArray(parents[1].value) &&\n isScannerError(value)\n ) {\n errors.push({\n path: [field, ...parents.slice(1).map((p) => p.key), key],\n error: value,\n });\n }\n parents.push({ key, value });\n }\n return value;\n },\n );\n }\n\n // Capture each member in native property order. A report and a findings\n // payload can each fit in a string while their combined JSON does not.\n const envelope = JSON.stringify(\n input,\n function (this: object, field, value: unknown) {\n if (this !== root) {\n root = value;\n return value;\n }\n const json = captureField(field, value);\n if (json === undefined) return undefined;\n fields.set(field, JSON.parse(json));\n return null;\n },\n );\n const result = JSON.parse(envelope);\n for (const [key, value] of fields) result[key] = value;\n for (const { path, error: source } of errors) {\n const key = path.pop()!;\n let parent = result as unknown as Record<string, unknown>;\n for (const field of path) parent = parent[field] as Record<string, unknown>;\n const error = cloneScannerDiagnostic(source);\n Object.defineProperties(\n error,\n Object.getOwnPropertyDescriptors(parent[key] as object),\n );\n parent[key] = error;\n }\n // Reader scope can live on a getter. Do not evaluate enumerable getters twice.\n if (provider !== undefined) {\n const keys = [\"sourceFormat\", \"semgrepPlatformScope\", \"snykRestContext\"];\n if (provider === \"semgrep\" || provider === \"snyk\")\n keys.push(\"sourceRepositoryUrl\", \"sourceRepositoryPlatform\");\n for (const key of keys)\n if (\n !(key in result) &&\n key in input &&\n !Object.prototype.propertyIsEnumerable.call(input, key)\n )\n result[key] = structuredClone(Reflect.get(input, key));\n }\n return result;\n}\n\n/** @internal Clone owned values without serializing the evidence again in every preview view. */\nexport function cloneImportPreview<T extends ExternalFindings>(input: T): T {\n if (input.report === undefined) return structuredClone(input);\n return {\n ...structuredClone({ ...input, report: undefined }),\n ...snapshotNormalizedFindings({ report: input.report }),\n };\n}\n\n/** Capture the caller's import settings before reading an export or resolving its destination. */\nexport function snapshotImportOptions<P extends string>({\n repository,\n provider,\n sourceKey,\n sourceRepositoryUrl,\n trivyScanRoot,\n inspectorProjectMap,\n}: Omit<LocalExternalImportOptions, \"provider\"> & { provider: P }) {\n if (provider === \"trivy\" && sourceRepositoryUrl !== undefined)\n throw new CodexSecurityError(\n \"Trivy reads repository provenance from the report; do not supply --source-repository-url.\",\n );\n if (trivyScanRoot !== undefined && provider !== \"trivy\")\n throw new CodexSecurityError(\n \"--trivy-scan-root applies only to --provider trivy.\",\n );\n if (inspectorProjectMap !== undefined && provider !== \"inspector\")\n throw new CodexSecurityError(\n \"An Inspector project map requires the inspector provider.\",\n );\n return {\n repository,\n provider,\n sourceKey,\n sourceRepositoryUrl,\n trivyScanRoot,\n inspectorProjectMap: inspectorProjectMap && new Map(inspectorProjectMap),\n };\n}\n"]}
|
|
@@ -18,7 +18,6 @@ export declare function requireJsonNumber(value: number, label: string): void;
|
|
|
18
18
|
export declare function validateExternalReport(report: Record<string, unknown> | undefined): void;
|
|
19
19
|
export declare function validateCodeLineRange(firstLine: number | null | undefined, endLine: number | null | undefined): void;
|
|
20
20
|
export declare function validateExternalEvidenceFields(input: unknown, target?: ExternalImportTarget): ExternalFindingEvidence;
|
|
21
|
-
export declare function previousAdmission(value: object): "uncertain" | import("./external-import-models.js").ImportedFindingEvidence | null | undefined;
|
|
22
21
|
/** Keep a valid native record when its optional structured fields exceed the target's bounds. */
|
|
23
22
|
export declare function validateEnrichedExternalEvidence(evidence: Record<string, unknown>, target: ExternalImportTarget, ...projections: (Record<string, unknown> | undefined)[]): ExternalFindingEvidence;
|
|
24
23
|
export declare function validateExternalEvidence(input: unknown, target?: ExternalImportTarget): ExternalFindingEvidence;
|
|
@@ -31,21 +30,17 @@ export declare class CloudEvidenceDepthError extends Error {
|
|
|
31
30
|
}
|
|
32
31
|
/** JSON omits these object properties, but emits null for the same array elements. */
|
|
33
32
|
export declare function requireCloudEvidenceDepth(depth: number, holder: object, value: unknown): void;
|
|
33
|
+
export declare const CLOUD_EVIDENCE_BYTES: number;
|
|
34
|
+
export declare class CloudEvidenceSizeError extends Error {
|
|
35
|
+
constructor();
|
|
36
|
+
}
|
|
34
37
|
/** Return the validated Cloud wire size, or zero for local evidence. */
|
|
35
|
-
export declare function validateExternalEvidenceJson(input: unknown, target: ExternalImportTarget, additionalCloudBytes?: number
|
|
36
|
-
/** Reproduce the released SDK's checks on a detached native finding. */
|
|
37
|
-
export declare function validatePreviousCloudEvidence(input: unknown): ExternalFindingEvidence;
|
|
38
|
+
export declare function validateExternalEvidenceJson(input: unknown, target: ExternalImportTarget, additionalCloudBytes?: number): number;
|
|
38
39
|
/** Use the array index as toJSON's key, as when saving the supplied GitHub records. */
|
|
39
|
-
export declare function exportedGitHubRecord(value: unknown, index: number, target: ExternalImportTarget
|
|
40
|
+
export declare function exportedGitHubRecord(value: unknown, index: number, target: ExternalImportTarget): {
|
|
40
41
|
record: unknown;
|
|
41
|
-
bytes: number;
|
|
42
|
-
adjustment: number;
|
|
43
|
-
previousInvalid: unknown;
|
|
44
|
-
skippedRawValue: boolean;
|
|
45
42
|
invalid: unknown;
|
|
46
43
|
};
|
|
47
|
-
/** Combine the observed vendor bytes with the old native mapping's typed fields. */
|
|
48
|
-
export declare function previousGitHubExclusion(evidence: ExternalFindingEvidence, sourceBytes: number, adjustment: number): string | undefined;
|
|
49
44
|
export declare function validateImportRequest(input: unknown): FindingImportRequest;
|
|
50
45
|
export {};
|
|
51
46
|
//# sourceMappingURL=external-import-contract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-import-contract.d.ts","sourceRoot":"","sources":["../src/external-import-contract.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACb,MAAM,6BAA6B,CAAC;AAQrC,qFAAqF;AACrF,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,OAAO,CAAC;AAOrD,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAe9C;;kFAEkF;AAClF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAatD;AAID,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3D;
|
|
1
|
+
{"version":3,"file":"external-import-contract.d.ts","sourceRoot":"","sources":["../src/external-import-contract.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACb,MAAM,6BAA6B,CAAC;AAQrC,qFAAqF;AACrF,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,OAAO,CAAC;AAOrD,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAe9C;;kFAEkF;AAClF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAatD;AAID,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3D;AA2JD,eAAO,MAAM,qBAAqB,UA/BjB,OAAO,yBAiCvB,CAAC;AACF,eAAO,MAAM,oBAAoB,UAlChB,O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