@openai/codex-security 0.8.1 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -57
- package/_bundled_plugin/.app.json +4 -0
- package/_bundled_plugin/.mcp.json +1 -0
- package/_bundled_plugin/mcp/helpers.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/helpers.mjs.br.part-001 +0 -0
- package/_bundled_plugin/mcp/native/THIRD_PARTY_NOTICES.txt +4 -4
- package/_bundled_plugin/mcp/native/darwin-arm64/unix.node +0 -0
- package/_bundled_plugin/mcp/native/darwin-x64/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-arm64-gnu/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-arm64-musl/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-x64-gnu/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-x64-musl/unix.node +0 -0
- package/_bundled_plugin/mcp/native/win32-arm64/windows.node +0 -0
- package/_bundled_plugin/mcp/native/win32-x64/windows.node +0 -0
- package/_bundled_plugin/mcp/permission-profile-preflight.mjs +46 -12
- package/_bundled_plugin/mcp/server.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-001 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-002 +0 -0
- package/_bundled_plugin/references/artifact-storage.md +1 -1
- package/_bundled_plugin/references/core-scan.md +14 -5
- package/_bundled_plugin/references/default-severity-rubric.md +28 -0
- package/_bundled_plugin/references/finding-detail-fields.md +1 -0
- package/_bundled_plugin/references/threat-model.md +1 -0
- package/_bundled_plugin/scripts/deep_scan_workbench.py +23 -112
- package/_bundled_plugin/scripts/finalize_scan_contract.py +167 -153
- package/_bundled_plugin/scripts/finding_preview.py +5 -29
- package/_bundled_plugin/scripts/posix_scan_local_files.py +187 -0
- package/_bundled_plugin/scripts/report_projection.py +87 -136
- package/_bundled_plugin/scripts/validate_scan_contract.py +2 -6
- package/_bundled_plugin/scripts/windows_scan_local_files.py +212 -55
- package/_bundled_plugin/scripts/workbench/retained_coverage.py +8 -24
- package/_bundled_plugin/scripts/workbench/saved_coverage.py +143 -231
- package/_bundled_plugin/scripts/workbench_cli.py +102 -13
- package/_bundled_plugin/scripts/workbench_constants.py +9 -0
- package/_bundled_plugin/scripts/workbench_coverage_receipts.py +0 -17
- package/_bundled_plugin/scripts/workbench_db.py +187 -363
- package/_bundled_plugin/scripts/workbench_finding_workflows.py +86 -4
- package/_bundled_plugin/scripts/workbench_native_indexes.py +17 -21
- package/_bundled_plugin/scripts/workbench_remediation.py +495 -11
- package/_bundled_plugin/scripts/workbench_saved_results.py +0 -66
- package/_bundled_plugin/scripts/workbench_scan_history.py +22 -25
- package/_bundled_plugin/scripts/workbench_scan_start.py +1 -1
- package/_bundled_plugin/scripts/workbench_scan_usage.py +25 -52
- package/_bundled_plugin/scripts/workbench_schema.py +1 -1
- package/_bundled_plugin/scripts/workbench_setup.py +239 -0
- package/_bundled_plugin/scripts/workbench_source_scopes.py +15 -23
- package/_bundled_plugin/scripts/workbench_target.py +120 -35
- package/_bundled_plugin/scripts/workbench_validation.py +1 -9
- package/_bundled_plugin/shared/workbench-history-repairs.json +7 -0
- package/_bundled_plugin/shared/workbench-migrations.json +19 -0
- package/_bundled_plugin/skills/attack-path-analysis/SKILL.md +1 -1
- package/_bundled_plugin/skills/attack-path-analysis/references/severity-policy.md +4 -68
- package/_bundled_plugin/skills/check-skills/SKILL.md +43 -0
- package/_bundled_plugin/skills/check-skills/agents/openai.yaml +4 -0
- package/_bundled_plugin/skills/cloud-findings/SKILL.md +2 -0
- package/_bundled_plugin/skills/fix-finding/SKILL.md +18 -1
- package/_bundled_plugin/skills/publish-findings/SKILL.md +68 -35
- package/_bundled_plugin/skills/publish-findings/references/wiz-import.md +2 -21
- package/_bundled_plugin/skills/resolve-dependency-alert/SKILL.md +18 -0
- package/_bundled_plugin/skills/resolve-dependency-alert/agents/openai.yaml +4 -0
- package/_bundled_plugin/skills/threat-model-visualize/SKILL.md +83 -0
- package/_bundled_plugin/skills/threat-model-visualize/agents/openai.yaml +4 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/context-reference-overview.svg +366 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/context-reference-path.svg +558 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/control-effects.js +85 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/explorer.css +17 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/explorer.html +38 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/explorer.js +372 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/route-paths.js +71 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/source-roles.js +47 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/svg-layout.js +149 -0
- package/_bundled_plugin/skills/threat-model-visualize/references/context-explorer.md +21 -0
- package/_bundled_plugin/skills/threat-model-visualize/references/view-model.md +49 -0
- package/_bundled_plugin/skills/threat-model-visualize/scripts/build_explorer.py +569 -0
- package/_bundled_plugin/skills/track-findings/SKILL.md +5 -3
- package/_bundled_plugin/skills/triage-finding/references/github-rest-intake.md +22 -68
- package/_bundled_plugin/skills/triage-finding/references/ticket-intake.md +6 -4
- package/dist/api.d.ts +6 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +414 -163
- package/dist/api.js.map +1 -1
- package/dist/auth.js +7 -2
- package/dist/auth.js.map +1 -1
- package/dist/blackduck-findings.d.ts +8 -0
- package/dist/blackduck-findings.d.ts.map +1 -0
- package/dist/blackduck-findings.js +305 -0
- package/dist/blackduck-findings.js.map +1 -0
- package/dist/bulk-scan-discovery.d.ts.map +1 -1
- package/dist/bulk-scan-discovery.js +51 -36
- package/dist/bulk-scan-discovery.js.map +1 -1
- package/dist/classify-severity-records.d.ts +5 -0
- package/dist/classify-severity-records.d.ts.map +1 -1
- package/dist/classify-severity-records.js +6 -8
- package/dist/classify-severity-records.js.map +1 -1
- package/dist/classify-severity.d.ts +4 -1
- package/dist/classify-severity.d.ts.map +1 -1
- package/dist/classify-severity.js +28 -9
- package/dist/classify-severity.js.map +1 -1
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +635 -266
- package/dist/cli.js.map +1 -1
- package/dist/codex-prompt.d.ts +2 -0
- package/dist/codex-prompt.d.ts.map +1 -1
- package/dist/codex-prompt.js +6 -0
- package/dist/codex-prompt.js.map +1 -1
- package/dist/component-scan.d.ts.map +1 -1
- package/dist/component-scan.js +6 -5
- package/dist/component-scan.js.map +1 -1
- package/dist/config.d.ts +2 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +162 -40
- package/dist/config.js.map +1 -1
- package/dist/continuum-findings.d.ts +7 -0
- package/dist/continuum-findings.d.ts.map +1 -0
- package/dist/continuum-findings.js +157 -0
- package/dist/continuum-findings.js.map +1 -0
- package/dist/contract-values.d.ts +28 -0
- package/dist/contract-values.d.ts.map +1 -0
- package/dist/contract-values.js +75 -0
- package/dist/contract-values.js.map +1 -0
- package/dist/contract.d.ts +2 -20
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +58 -669
- package/dist/contract.js.map +1 -1
- package/dist/cost-model.d.ts.map +1 -1
- package/dist/cost-model.js +1 -4
- package/dist/cost-model.js.map +1 -1
- package/dist/cost.d.ts +19 -1
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +2120 -39
- package/dist/cost.js.map +1 -1
- package/dist/custom-validation-prompt.d.ts +1 -1
- package/dist/custom-validation-prompt.d.ts.map +1 -1
- package/dist/custom-validation-prompt.js +5 -0
- package/dist/custom-validation-prompt.js.map +1 -1
- package/dist/custom-validation.d.ts +2 -0
- package/dist/custom-validation.d.ts.map +1 -1
- package/dist/custom-validation.js +6 -2
- package/dist/custom-validation.js.map +1 -1
- package/dist/deduplication/deduplication-prompts.d.ts +4 -4
- package/dist/deduplication/deduplication-prompts.d.ts.map +1 -1
- package/dist/deduplication/deduplication-prompts.js +2 -2
- package/dist/deduplication/deduplication-prompts.js.map +1 -1
- package/dist/deduplication/deduplication-reviewer.d.ts +14 -11
- package/dist/deduplication/deduplication-reviewer.d.ts.map +1 -1
- package/dist/deduplication/deduplication-reviewer.js +12 -5
- package/dist/deduplication/deduplication-reviewer.js.map +1 -1
- package/dist/deduplication/deduplication.js.map +1 -1
- package/dist/deduplication/finding-schema.d.ts +19 -1
- package/dist/deduplication/finding-schema.d.ts.map +1 -1
- package/dist/deduplication/finding-schema.js +25 -0
- package/dist/deduplication/finding-schema.js.map +1 -1
- package/dist/deduplication/local.d.ts.map +1 -1
- package/dist/deduplication/local.js +3 -8
- package/dist/deduplication/local.js.map +1 -1
- package/dist/deduplication/records.d.ts +11 -3
- package/dist/deduplication/records.d.ts.map +1 -1
- package/dist/deduplication/records.js +48 -16
- package/dist/deduplication/records.js.map +1 -1
- package/dist/deep-scan.d.ts +11 -0
- package/dist/deep-scan.d.ts.map +1 -1
- package/dist/deep-scan.js +235 -4
- package/dist/deep-scan.js.map +1 -1
- package/dist/default-severity-rubric.d.ts +1 -2
- package/dist/default-severity-rubric.d.ts.map +1 -1
- package/dist/default-severity-rubric.js +2 -66
- package/dist/default-severity-rubric.js.map +1 -1
- package/dist/endor-findings.d.ts.map +1 -1
- package/dist/endor-findings.js +44 -89
- package/dist/endor-findings.js.map +1 -1
- package/dist/errors.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/external-findings-import.d.ts.map +1 -1
- package/dist/external-findings-import.js +11 -15
- package/dist/external-findings-import.js.map +1 -1
- package/dist/external-findings-local.d.ts +12 -1
- package/dist/external-findings-local.d.ts.map +1 -1
- package/dist/external-findings-local.js +411 -184
- package/dist/external-findings-local.js.map +1 -1
- package/dist/external-findings-publish.d.ts +15 -1
- package/dist/external-findings-publish.d.ts.map +1 -1
- package/dist/external-findings-publish.js +1238 -226
- package/dist/external-findings-publish.js.map +1 -1
- package/dist/external-findings-read.d.ts +10 -0
- package/dist/external-findings-read.d.ts.map +1 -1
- package/dist/external-findings-read.js +71 -51
- package/dist/external-findings-read.js.map +1 -1
- package/dist/external-findings.d.ts +13 -0
- package/dist/external-findings.d.ts.map +1 -1
- package/dist/external-findings.js +124 -1
- package/dist/external-findings.js.map +1 -1
- package/dist/external-import-contract.d.ts +29 -1
- package/dist/external-import-contract.d.ts.map +1 -1
- package/dist/external-import-contract.js +314 -44
- package/dist/external-import-contract.js.map +1 -1
- package/dist/external-import-models.d.ts +1 -1
- package/dist/external-import-models.d.ts.map +1 -1
- package/dist/external-import-models.js.map +1 -1
- package/dist/finding-normalization.d.ts +1 -1
- package/dist/finding-normalization.d.ts.map +1 -1
- package/dist/finding-normalization.js +46 -11
- package/dist/finding-normalization.js.map +1 -1
- package/dist/finding-retrieval.d.ts +3 -3
- package/dist/finding-retrieval.d.ts.map +1 -1
- package/dist/finding-retrieval.js.map +1 -1
- package/dist/finding-workflow.d.ts +6 -1
- package/dist/finding-workflow.d.ts.map +1 -1
- package/dist/finding-workflow.js +2 -2
- package/dist/finding-workflow.js.map +1 -1
- package/dist/git-remote.d.ts +4 -0
- package/dist/git-remote.d.ts.map +1 -1
- package/dist/git-remote.js +20 -0
- package/dist/git-remote.js.map +1 -1
- package/dist/github-advisories.d.ts +3 -12
- package/dist/github-advisories.d.ts.map +1 -1
- package/dist/github-advisories.js +9 -29
- package/dist/github-advisories.js.map +1 -1
- package/dist/github-dependabot-findings.d.ts.map +1 -1
- package/dist/github-dependabot-findings.js +7 -16
- package/dist/github-dependabot-findings.js.map +1 -1
- package/dist/github-findings.d.ts.map +1 -1
- package/dist/github-findings.js +344 -56
- package/dist/github-findings.js.map +1 -1
- package/dist/github.d.ts +17 -7
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +43 -30
- package/dist/github.js.map +1 -1
- package/dist/host-protocol.d.ts +7 -2
- package/dist/host-protocol.d.ts.map +1 -1
- package/dist/host-protocol.js +27 -3
- package/dist/host-protocol.js.map +1 -1
- package/dist/host-records-protocol.d.ts +10 -11
- package/dist/host-records-protocol.d.ts.map +1 -1
- package/dist/host-records-protocol.js +69 -9
- package/dist/host-records-protocol.js.map +1 -1
- package/dist/hosted-scan.d.ts +15 -0
- package/dist/hosted-scan.d.ts.map +1 -1
- package/dist/hosted-scan.js +55 -33
- package/dist/hosted-scan.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/inspector-findings.d.ts +9 -0
- package/dist/inspector-findings.d.ts.map +1 -0
- package/dist/inspector-findings.js +512 -0
- package/dist/inspector-findings.js.map +1 -0
- package/dist/knowledge-base.js +18 -5
- package/dist/knowledge-base.js.map +1 -1
- package/dist/local-git-metadata.d.ts +5 -0
- package/dist/local-git-metadata.d.ts.map +1 -0
- package/dist/local-git-metadata.js +131 -0
- package/dist/local-git-metadata.js.map +1 -0
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +22 -12
- package/dist/multiscan.js.map +1 -1
- package/dist/opengrep-findings.d.ts.map +1 -1
- package/dist/opengrep-findings.js +34 -20
- package/dist/opengrep-findings.js.map +1 -1
- package/dist/patch-tui.d.ts +1 -1
- package/dist/patch-tui.d.ts.map +1 -1
- package/dist/patch-tui.js +94 -36
- package/dist/patch-tui.js.map +1 -1
- package/dist/private-finding-import.d.ts +246 -0
- package/dist/private-finding-import.d.ts.map +1 -0
- package/dist/private-finding-import.js +387 -0
- package/dist/private-finding-import.js.map +1 -0
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +2 -2
- package/dist/project-config.js.map +1 -1
- package/dist/provider-profile.d.ts +10 -2
- package/dist/provider-profile.d.ts.map +1 -1
- package/dist/provider-profile.js +72 -10
- package/dist/provider-profile.js.map +1 -1
- package/dist/publication.js +7 -1
- package/dist/publication.js.map +1 -1
- package/dist/reader-selection.d.ts +13 -0
- package/dist/reader-selection.d.ts.map +1 -0
- package/dist/reader-selection.js +81 -0
- package/dist/reader-selection.js.map +1 -0
- package/dist/record.d.ts +6 -1
- package/dist/record.d.ts.map +1 -1
- package/dist/record.js +53 -2
- package/dist/record.js.map +1 -1
- package/dist/remediation.d.ts +5 -0
- package/dist/remediation.d.ts.map +1 -1
- package/dist/remediation.js +30 -0
- package/dist/remediation.js.map +1 -1
- package/dist/result.d.ts +2 -0
- package/dist/result.d.ts.map +1 -1
- package/dist/result.js +3 -1
- package/dist/result.js.map +1 -1
- package/dist/runtime.d.ts +5 -3
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +110 -57
- package/dist/runtime.js.map +1 -1
- package/dist/scan-activity.js +40 -17
- package/dist/scan-activity.js.map +1 -1
- package/dist/scan-comparison.d.ts +1 -1
- package/dist/scan-comparison.d.ts.map +1 -1
- package/dist/scan-comparison.js +11 -13
- package/dist/scan-comparison.js.map +1 -1
- package/dist/scan-dashboard.d.ts +1 -0
- package/dist/scan-dashboard.d.ts.map +1 -1
- package/dist/scan-dashboard.js +37 -48
- package/dist/scan-dashboard.js.map +1 -1
- package/dist/scan-executor.d.ts +2 -0
- package/dist/scan-executor.d.ts.map +1 -1
- package/dist/scan-executor.js.map +1 -1
- package/dist/scan-history-renderer.d.ts.map +1 -1
- package/dist/scan-history-renderer.js +22 -9
- package/dist/scan-history-renderer.js.map +1 -1
- package/dist/scan-logs.d.ts.map +1 -1
- package/dist/scan-logs.js +5 -5
- package/dist/scan-logs.js.map +1 -1
- package/dist/scanner-import.d.ts +48 -3
- package/dist/scanner-import.d.ts.map +1 -1
- package/dist/scanner-import.js +214 -39
- package/dist/scanner-import.js.map +1 -1
- package/dist/scanner-repository-url.d.ts +14 -0
- package/dist/scanner-repository-url.d.ts.map +1 -0
- package/dist/scanner-repository-url.js +67 -0
- package/dist/scanner-repository-url.js.map +1 -0
- package/dist/semgrep-findings.d.ts.map +1 -1
- package/dist/semgrep-findings.js +50 -88
- package/dist/semgrep-findings.js.map +1 -1
- package/dist/semgrep-platform-findings.d.ts +12 -0
- package/dist/semgrep-platform-findings.d.ts.map +1 -0
- package/dist/semgrep-platform-findings.js +198 -0
- package/dist/semgrep-platform-findings.js.map +1 -0
- package/dist/severity-rubric.d.ts +20 -0
- package/dist/severity-rubric.d.ts.map +1 -0
- package/dist/severity-rubric.js +73 -0
- package/dist/severity-rubric.js.map +1 -0
- package/dist/severity-store.js +15 -5
- package/dist/severity-store.js.map +1 -1
- package/dist/snyk-findings.d.ts.map +1 -1
- package/dist/snyk-findings.js +97 -106
- package/dist/snyk-findings.js.map +1 -1
- package/dist/sonar-collector.d.ts +16 -0
- package/dist/sonar-collector.d.ts.map +1 -0
- package/dist/sonar-collector.js +383 -0
- package/dist/sonar-collector.js.map +1 -0
- package/dist/sonar-findings.d.ts +49 -0
- package/dist/sonar-findings.d.ts.map +1 -0
- package/dist/sonar-findings.js +288 -0
- package/dist/sonar-findings.js.map +1 -0
- package/dist/sonar-import.d.ts +111 -0
- package/dist/sonar-import.d.ts.map +1 -0
- package/dist/sonar-import.js +279 -0
- package/dist/sonar-import.js.map +1 -0
- package/dist/suggest-owners.d.ts.map +1 -1
- package/dist/suggest-owners.js +2 -1
- package/dist/suggest-owners.js.map +1 -1
- package/dist/targets.d.ts +3 -0
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +18 -12
- package/dist/targets.js.map +1 -1
- package/dist/terminal-columns.d.ts +4 -0
- package/dist/terminal-columns.d.ts.map +1 -0
- package/dist/terminal-columns.js +19 -0
- package/dist/terminal-columns.js.map +1 -0
- package/dist/validation-records.d.ts +0 -3
- package/dist/validation-records.d.ts.map +1 -1
- package/dist/validation-records.js +0 -16
- package/dist/validation-records.js.map +1 -1
- package/dist/veracode-findings.d.ts +7 -0
- package/dist/veracode-findings.d.ts.map +1 -0
- package/dist/veracode-findings.js +371 -0
- package/dist/veracode-findings.js.map +1 -0
- package/dist/windows-path.d.ts.map +1 -1
- package/dist/windows-path.js +1 -0
- package/dist/windows-path.js.map +1 -1
- package/dist/wiz-csv.d.ts +2 -2
- package/dist/wiz-csv.d.ts.map +1 -1
- package/dist/wiz-csv.js +1 -3
- package/dist/wiz-csv.js.map +1 -1
- package/dist/wiz-findings.d.ts +10 -2
- package/dist/wiz-findings.d.ts.map +1 -1
- package/dist/wiz-findings.js +88 -49
- package/dist/wiz-findings.js.map +1 -1
- package/docs/classify-severity-records.md +1 -1
- package/docs/cli.md +320 -481
- package/docs/dedupe-records.md +27 -4
- package/docs/findings-service.md +21 -8
- package/docs/hosted-scans.md +16 -1
- package/package.json +9 -10
- package/schemas/external-findings.schema.json +12 -1
- package/schemas/hosted-scan-v2.fixture.json +16 -1
- package/_bundled_plugin/scripts/validate_tracking_source.py +0 -82
- package/_bundled_plugin/scripts/workbench_local_dedupe.py +0 -136
- package/dist/deduplication/records-protocol.d.ts +0 -4
- package/dist/deduplication/records-protocol.d.ts.map +0 -1
- package/dist/deduplication/records-protocol.js +0 -35
- package/dist/deduplication/records-protocol.js.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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","sourcesContent":["export { exportArtifact } from \"./artifact-export.js\";\nexport type {\n ExportArtifactOptions,\n ArtifactExportResult,\n} from \"./artifact-export.js\";\nexport { CodexSecurity, createSecurity } from \"./api.js\";\nexport {\n runHostedRemediation,\n HostedRemediationInputSchema,\n HostedRemediationPreparationError,\n} from \"./hosted-remediation.js\";\nexport type {\n HostedRemediationInput,\n HostedRemediationOptions,\n HostedRemediationResult,\n RemediationExecutor,\n RemediationExecutionRequest,\n RemediationExecutionResult,\n RemediationExecutionEvent,\n} from \"./hosted-remediation.js\";\nexport { runHostedRemediationProtocol } from \"./hosted-remediation-protocol.js\";\nexport type { FindingPatch, FindingVerification } from \"./remediation.js\";\nexport {\n runHostedScan,\n HostedScanInputSchema,\n HostedScanPreparationError,\n} from \"./hosted-scan.js\";\nexport type {\n HostedScanInput,\n HostedScanOptions,\n HostedScanResult,\n} from \"./hosted-scan.js\";\nexport type {\n ScanExecutor,\n ScanExecutionRequest,\n ScanExecutionResult,\n ScanExecutionEvent,\n} from \"./scan-executor.js\";\nexport { loadProjectConfig, resolveProjectConfig } from \"./project-config.js\";\nexport type {\n ResolvedProjectConfig,\n ProjectConfigProvenance,\n} from \"./project-config.js\";\nexport type {\n ProjectConfigInput,\n ProjectScope,\n} from \"./project-config-schema.js\";\nexport type { ScanSettings } from \"./scan-settings.js\";\nexport { classifySeverity } from \"./classify-severity.js\";\nexport { suggestOwners, suggestOwnersFromScan } from \"./suggest-owners.js\";\nexport type {\n OwnerFinding,\n CodeownerIdentity,\n OwnerIdentity,\n OwnerSuggestion,\n OwnerSuggestions,\n SuggestOwnersOptions,\n} from \"./suggest-owners.js\";\nexport type {\n ClassifySeverityOptions,\n SeverityClassificationFinding,\n SeverityClassification,\n SeverityAssessment,\n} from \"./classify-severity.js\";\nexport {\n classifyScanSeverity,\n classifyScanDirectorySeverity,\n} from \"./classify-scan-severity.js\";\nexport type {\n ClassifyScanSeverityOptions,\n ScanSeverityClassification,\n} from \"./classify-scan-severity.js\";\nexport { runComponentScans } from \"./component-scan.js\";\nexport type {\n ComponentDeduplicationSummary,\n ComponentReceipt,\n ComponentScanOptions,\n ComponentScanEvent,\n ComponentScanResult,\n} from \"./component-scan.js\";\nexport { normalizeComponentPlan, planComponents } from \"./component-plan.js\";\nexport type {\n ComponentPlan,\n ComponentPlanningOptions,\n} from \"./component-plan.js\";\nexport { estimateScanCost } from \"./cost.js\";\nexport type {\n ScanAccountRateLimit,\n ScanAccountRateLimitWindow,\n ScanCost,\n ScanSessionEvent,\n ScanUsageObservation,\n ScanWorkerEvent,\n} from \"./cost.js\";\nexport type { ScanTokenUsage } from \"./cost-model.js\";\nexport type { DeepScanProgress } from \"./scan-progress.js\";\nexport type { CustomValidationResult } from \"./custom-validation.js\";\nexport type { ScanActivity, ScanActivityStatus } from \"./scan-activity.js\";\nexport { matchScanFindings } from \"./scan-comparison.js\";\nexport type {\n ScanComparisonInput,\n ScanComparisonOptions,\n ScanComparisonProgress,\n ScanComparisonResult,\n} from \"./scan-comparison.js\";\nexport type {\n CodexSecurityMetadata,\n DeepScanOptions,\n PatchOptions,\n PatchResult,\n ScanAuthMode,\n ScanAuthentication,\n ScanBudget,\n ScanOptions,\n ScanPreflight,\n ScanReconnectDetails,\n ScanTrustedAccessStatus,\n ScanWarningDetails,\n ValidationOptions,\n ValidationResult,\n} from \"./api.js\";\nexport type {\n ScanPhase,\n ScanProgress,\n ScanWorkerPhase,\n ScanWorkerStatus,\n} from \"./worker-progress.js\";\nexport { CodexLoginHandle } from \"./auth.js\";\nexport type { AccountStatus, LoginResult } from \"./auth.js\";\n\nexport {\n AuthenticationRequiredError,\n CodexSecurityError,\n ConfigurationError,\n ContractValidationError,\n DeduplicationReviewError,\n IncompleteScanError,\n InvalidTargetError,\n LocalPluginBootstrapError,\n OutputDirectoryError,\n OutputDirectoryNotEmptyError,\n OutputInsideProtectedRootError,\n PluginBootstrapError,\n PluginPythonUnavailableError,\n SandboxUnavailableError,\n ScanCostLimitExceededError,\n ScanInterruptedError,\n} from \"./errors.js\";\nexport type {\n DeduplicationReviewFailureCategory,\n DeduplicationReviewFailureMetadata,\n DeduplicationReviewStage,\n ProtectedScanPathKind,\n} from \"./errors.js\";\nexport {\n DEFAULT_CODEX_CONFIG,\n mergedCodexConfig,\n writeCodexConfig,\n} from \"./config.js\";\nexport type { CodexSecurityConfig, JsonObject, JsonValue } from \"./config.js\";\nexport { loadContract, requireScanFile } from \"./contract.js\";\nexport type { LoadedContract, ScanExpectation } from \"./contract.js\";\nexport type * from \"./models.js\";\nexport {\n resolveSecurityPolicyTarget,\n securityPolicyDiff,\n} from \"./security-policy.js\";\nexport type {\n SecurityPolicyDraft,\n SecurityPolicyOptions,\n SecurityPolicyPreflight,\n SecurityPolicyStage,\n SecurityPolicyTarget,\n} from \"./security-policy.js\";\nexport { checkScanPublication, publishScan } from \"./publish.js\";\nexport { publishScanToCustom } from \"./custom-publish.js\";\nexport type {\n PublishScanToCustomOptions,\n CustomPublicationResult,\n} from \"./custom-publish.js\";\nexport { deduplicateRecords } from \"./deduplication/records.js\";\nexport type {\n DeduplicateRecordsInput,\n DeduplicateRecordsOptions,\n DeduplicateRecordsResult,\n} from \"./deduplication/records.js\";\nexport type {\n DeduplicationReviewRequest,\n DeduplicationReviewAttribution,\n DeduplicationReviewRunner,\n} from \"./deduplication/review.js\";\nexport {\n deduplicateScan,\n deduplicateScanDirectory,\n} from \"./deduplication/scan.js\";\nexport type {\n DeduplicateScanDirectoryOptions,\n DeduplicateScanOptions,\n DeduplicateScanResult,\n} from \"./deduplication/scan.js\";\nexport type { DeduplicationRefusal } from \"./deduplication/deduplication.js\";\nexport type { FindingEmbeddingBinding } from \"./deduplication/local.js\";\nexport type {\n DeduplicationDiagnostic,\n DeduplicationDiagnosticObserver,\n} from \"./deduplication/diagnostics.js\";\nexport type { FindingEmbedder } from \"./server/embeddings.js\";\nexport {\n ExternalPublicationError,\n prepareExternalPublication,\n prepareNormalizedExternalPublication,\n} from \"./external-findings-publish.js\";\nexport type {\n ExternalPublicationOptions,\n NormalizedExternalPublicationOptions,\n ExternalPublicationDependencies,\n ExternalPublicationPreview,\n ExternalPublicationProgress,\n ExternalPublicationResult,\n PreparedExternalPublication,\n} from \"./external-findings-publish.js\";\nexport {\n prepareNormalizedLocalImport,\n listLocalExternalFindings,\n} from \"./external-findings-local.js\";\nexport type {\n StoredExternalFinding,\n NormalizedLocalImportOptions,\n LocalExternalImportDependencies,\n LocalExternalImportPreview,\n LocalExternalImportResult,\n PreparedLocalExternalImport,\n} from \"./external-findings-local.js\";\nexport type {\n ExternalFinding,\n ExternalFindings,\n ExternalSourceRepository,\n} from \"./external-findings.js\";\nexport type {\n ExternalFindingEvidence,\n FindingImportRequest,\n FindingImportReceipt,\n ImportRepository,\n SourceReport,\n} from \"./external-import-models.js\";\nexport {\n normalizeGitHubCodeScanningAlerts,\n normalizeGitHubAdvisories,\n readGitHubFindings,\n} from \"./github-findings.js\";\nexport { importGitHubAdvisories } from \"./github-advisories.js\";\nexport { normalizeGitHubDependabotAlerts } from \"./github-dependabot-findings.js\";\nexport type {\n GitHubAdvisoryImportOptions,\n ImportedGitHubAdvisory,\n} from \"./github-advisories.js\";\nexport { importGitHubCodeScanningAlerts } from \"./github.js\";\nexport type {\n GitHubCodeScanningImportOptions,\n ImportedGitHubCodeScanningAlert,\n} from \"./github.js\";\nexport type {\n CheckScanPublicationOptions,\n CheckScanPublicationResult,\n PublishScanOptions,\n PublishScanProgress,\n PublishScanResult,\n} from \"./publish.js\";\nexport { ScanResult } from \"./result.js\";\nexport type {\n RepositoryFinding,\n ScanResultOptions,\n TurnResultMetadata,\n} from \"./result.js\";\nexport {\n bootstrapPlugin,\n bundledPluginRoot,\n cleanupSdkDirectory,\n createIsolatedHome,\n createMarketplace,\n extractPluginZip,\n importAmbientAuth,\n MARKETPLACE_NAME,\n pluginExecutionEnvironment,\n pluginMetadata,\n PLUGIN_NAME,\n prepareOutputDir,\n resolveCodexCommand,\n resolvePluginPath,\n resolvePluginPython,\n validateOutputDir,\n} from \"./runtime.js\";\nexport type {\n CodexCommand,\n PluginInstall,\n PluginPythonOptions,\n ProcessEnvironment,\n} from \"./runtime.js\";\nexport {\n DiffTarget,\n normalizeRepository,\n normalizeTarget,\n repositoryRevision,\n validateMode,\n} from \"./targets.js\";\nexport type { NormalizedTarget, ScanMode, ScanTarget } from \"./targets.js\";\nexport type { AbsolutePath } from \"./config-path.js\";\nexport { BUNDLED_PLUGIN_VERSION, VERSION } from \"./version.js\";\n\nexport {\n classifySeverityRecords,\n classifySeverityRecordsInputSchema,\n} from \"./classify-severity-records.js\";\nexport type {\n ClassifySeverityRecordsInput,\n ClassifySeverityRecordsOptions,\n ClassifySeverityRecordsResult,\n CanonicalSeverityAssessment,\n SeverityClassificationReviewRequest,\n} from \"./classify-severity-records.js\";\nexport { validateRecords } from \"./validation-records.js\";\nexport type {\n ValidateRecordsInput,\n ValidateRecordsOptions,\n ValidationReviewRequest,\n} from \"./validation-records.js\";\n\nexport { prepareLocalExternalImport } from \"./external-findings-import.js\";\nexport {\n normalizeOpenGrepFindings,\n readOpenGrepFindings,\n type OpenGrepImportOptions,\n} from \"./opengrep-findings.js\";\nexport {\n normalizeSnykFindingsExport,\n normalizeSnykJson,\n normalizeSnykSarif,\n readSnykFindings,\n} from \"./snyk-findings.js\";\nexport {\n normalizeSemgrepFindings,\n normalizeSemgrepSarif,\n readSemgrepFindings,\n type SemgrepImportOptions,\n} from \"./semgrep-findings.js\";\nexport {\n normalizeEndorFindings,\n normalizeEndorSarif,\n readEndorFindings,\n} from \"./endor-findings.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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","sourcesContent":["export { exportArtifact } from \"./artifact-export.js\";\nexport type {\n ExportArtifactOptions,\n ArtifactExportResult,\n} from \"./artifact-export.js\";\nexport { CodexSecurity, createSecurity } from \"./api.js\";\nexport {\n runHostedRemediation,\n HostedRemediationInputSchema,\n HostedRemediationPreparationError,\n} from \"./hosted-remediation.js\";\nexport type {\n HostedRemediationInput,\n HostedRemediationOptions,\n HostedRemediationResult,\n RemediationExecutor,\n RemediationExecutionRequest,\n RemediationExecutionResult,\n RemediationExecutionEvent,\n} from \"./hosted-remediation.js\";\nexport { runHostedRemediationProtocol } from \"./hosted-remediation-protocol.js\";\nexport type { FindingPatch, FindingVerification } from \"./remediation.js\";\nexport {\n runHostedScan,\n HostedScanInputSchema,\n HostedScanPreparationError,\n} from \"./hosted-scan.js\";\nexport type {\n HostedScanInput,\n HostedScanOptions,\n HostedScanResult,\n} from \"./hosted-scan.js\";\nexport type {\n ScanExecutor,\n ScanExecutionRequest,\n ScanExecutionResult,\n ScanExecutionEvent,\n} from \"./scan-executor.js\";\nexport { loadProjectConfig, resolveProjectConfig } from \"./project-config.js\";\nexport type {\n ResolvedProjectConfig,\n ProjectConfigProvenance,\n} from \"./project-config.js\";\nexport type {\n ProjectConfigInput,\n ProjectScope,\n} from \"./project-config-schema.js\";\nexport type { ScanSettings } from \"./scan-settings.js\";\nexport type { SeverityRubricSnapshot } from \"./severity-rubric.js\";\nexport { classifySeverity } from \"./classify-severity.js\";\nexport { suggestOwners, suggestOwnersFromScan } from \"./suggest-owners.js\";\nexport type {\n OwnerFinding,\n CodeownerIdentity,\n OwnerIdentity,\n OwnerSuggestion,\n OwnerSuggestions,\n SuggestOwnersOptions,\n} from \"./suggest-owners.js\";\nexport type {\n ClassifySeverityOptions,\n SeverityClassificationFinding,\n SeverityClassification,\n SeverityAssessment,\n} from \"./classify-severity.js\";\nexport {\n classifyScanSeverity,\n classifyScanDirectorySeverity,\n} from \"./classify-scan-severity.js\";\nexport type {\n ClassifyScanSeverityOptions,\n ScanSeverityClassification,\n} from \"./classify-scan-severity.js\";\nexport { runComponentScans } from \"./component-scan.js\";\nexport type {\n ComponentDeduplicationSummary,\n ComponentReceipt,\n ComponentScanOptions,\n ComponentScanEvent,\n ComponentScanResult,\n} from \"./component-scan.js\";\nexport { normalizeComponentPlan, planComponents } from \"./component-plan.js\";\nexport type {\n ComponentPlan,\n ComponentPlanningOptions,\n} from \"./component-plan.js\";\nexport { estimateScanCost } from \"./cost.js\";\nexport type {\n ScanAccountRateLimit,\n ScanAccountRateLimitWindow,\n ScanCost,\n ScanSessionEvent,\n ScanUsageObservation,\n ScanWorkerEvent,\n} from \"./cost.js\";\nexport type { ScanTokenUsage } from \"./cost-model.js\";\nexport type { DeepScanProgress } from \"./scan-progress.js\";\nexport type { CustomValidationResult } from \"./custom-validation.js\";\nexport type { ScanActivity, ScanActivityStatus } from \"./scan-activity.js\";\nexport { matchScanFindings } from \"./scan-comparison.js\";\nexport type {\n ScanComparisonInput,\n ScanComparisonOptions,\n ScanComparisonProgress,\n ScanComparisonResult,\n} from \"./scan-comparison.js\";\nexport type {\n CodexSecurityMetadata,\n DeepScanOptions,\n PatchOptions,\n PatchResult,\n ScanAuthMode,\n ScanAuthentication,\n ScanBudget,\n ScanOptions,\n ScanPreflight,\n ScanReconnectDetails,\n ScanTrustedAccessStatus,\n ScanWarningDetails,\n ValidationOptions,\n ValidationResult,\n} from \"./api.js\";\nexport type {\n ScanPhase,\n ScanProgress,\n ScanWorkerPhase,\n ScanWorkerStatus,\n} from \"./worker-progress.js\";\nexport { CodexLoginHandle } from \"./auth.js\";\nexport type { AccountStatus, LoginResult } from \"./auth.js\";\n\nexport {\n AuthenticationRequiredError,\n CodexSecurityError,\n ConfigurationError,\n ContractValidationError,\n DeduplicationReviewError,\n IncompleteScanError,\n InvalidTargetError,\n LocalPluginBootstrapError,\n OutputDirectoryError,\n OutputDirectoryNotEmptyError,\n OutputInsideProtectedRootError,\n PluginBootstrapError,\n PluginPythonUnavailableError,\n SandboxUnavailableError,\n ScanCostLimitExceededError,\n ScanInterruptedError,\n} from \"./errors.js\";\nexport type {\n DeduplicationReviewFailureCategory,\n DeduplicationReviewFailureMetadata,\n DeduplicationReviewStage,\n ProtectedScanPathKind,\n} from \"./errors.js\";\nexport {\n DEFAULT_CODEX_CONFIG,\n mergedCodexConfig,\n writeCodexConfig,\n} from \"./config.js\";\nexport type { CodexSecurityConfig, JsonObject, JsonValue } from \"./config.js\";\nexport { loadContract, requireScanFile } from \"./contract.js\";\nexport type { LoadedContract, ScanExpectation } from \"./contract.js\";\nexport type * from \"./models.js\";\nexport {\n resolveSecurityPolicyTarget,\n securityPolicyDiff,\n} from \"./security-policy.js\";\nexport type {\n SecurityPolicyDraft,\n SecurityPolicyOptions,\n SecurityPolicyPreflight,\n SecurityPolicyStage,\n SecurityPolicyTarget,\n} from \"./security-policy.js\";\nexport { checkScanPublication, publishScan } from \"./publish.js\";\nexport { publishScanToCustom } from \"./custom-publish.js\";\nexport type {\n PublishScanToCustomOptions,\n CustomPublicationResult,\n} from \"./custom-publish.js\";\nexport { deduplicateRecords } from \"./deduplication/records.js\";\nexport type {\n DeduplicateRecordsInput,\n DeduplicateRecordsOptions,\n DeduplicateRecordsResult,\n} from \"./deduplication/records.js\";\nexport type {\n DeduplicationReviewRequest,\n DeduplicationReviewAttribution,\n DeduplicationReviewRunner,\n} from \"./deduplication/review.js\";\nexport {\n deduplicateScan,\n deduplicateScanDirectory,\n} from \"./deduplication/scan.js\";\nexport type {\n DeduplicateScanDirectoryOptions,\n DeduplicateScanOptions,\n DeduplicateScanResult,\n} from \"./deduplication/scan.js\";\nexport type { DeduplicationRefusal } from \"./deduplication/deduplication.js\";\nexport type { FindingEmbeddingBinding } from \"./deduplication/local.js\";\nexport type {\n DeduplicationDiagnostic,\n DeduplicationDiagnosticObserver,\n} from \"./deduplication/diagnostics.js\";\nexport type { FindingEmbedder } from \"./server/embeddings.js\";\nexport {\n ExternalPublicationError,\n prepareExternalPublication,\n prepareNormalizedExternalPublication,\n} from \"./external-findings-publish.js\";\nexport type {\n ExternalPublicationOptions,\n NormalizedExternalPublicationOptions,\n ExternalPublicationDependencies,\n ExternalPublicationPreview,\n ExternalPublicationProgress,\n ExternalPublicationResult,\n PreparedExternalPublication,\n} from \"./external-findings-publish.js\";\nexport {\n prepareNormalizedLocalImport,\n listLocalExternalFindings,\n} from \"./external-findings-local.js\";\nexport type {\n StoredExternalFinding,\n NormalizedLocalImportOptions,\n LocalExternalImportDependencies,\n LocalExternalImportPreview,\n LocalExternalImportResult,\n PreparedLocalExternalImport,\n} from \"./external-findings-local.js\";\nexport type {\n ExternalFinding,\n ExternalFindings,\n ExternalSourceRepository,\n} from \"./external-findings.js\";\nexport type {\n ExternalFindingEvidence,\n FindingImportRequest,\n FindingImportReceipt,\n ImportRepository,\n SourceReport,\n} from \"./external-import-models.js\";\nexport {\n normalizeGitHubCodeScanningAlerts,\n normalizeGitHubAdvisories,\n readGitHubFindings,\n} from \"./github-findings.js\";\nexport { importGitHubAdvisories } from \"./github-advisories.js\";\nexport { normalizeGitHubDependabotAlerts } from \"./github-dependabot-findings.js\";\nexport type {\n GitHubAdvisoryImportOptions,\n ImportedGitHubAdvisory,\n} from \"./github-advisories.js\";\nexport { importGitHubCodeScanningAlerts } from \"./github.js\";\nexport type {\n GitHubCodeScanningImportOptions,\n ImportedGitHubCodeScanningAlert,\n} from \"./github.js\";\nexport type {\n CheckScanPublicationOptions,\n CheckScanPublicationResult,\n PublishScanOptions,\n PublishScanProgress,\n PublishScanResult,\n} from \"./publish.js\";\nexport { ScanResult } from \"./result.js\";\nexport type {\n RepositoryFinding,\n ScanResultOptions,\n TurnResultMetadata,\n} from \"./result.js\";\nexport {\n bootstrapPlugin,\n bundledPluginRoot,\n cleanupSdkDirectory,\n createIsolatedHome,\n createMarketplace,\n extractPluginZip,\n importAmbientAuth,\n MARKETPLACE_NAME,\n pluginExecutionEnvironment,\n pluginMetadata,\n PLUGIN_NAME,\n prepareOutputDir,\n resolveCodexCommand,\n resolvePluginPath,\n resolvePluginPython,\n validateOutputDir,\n} from \"./runtime.js\";\nexport type {\n CodexCommand,\n PluginInstall,\n PluginPythonOptions,\n ProcessEnvironment,\n} from \"./runtime.js\";\nexport {\n DiffTarget,\n normalizeRepository,\n normalizeTarget,\n repositoryRevision,\n validateMode,\n} from \"./targets.js\";\nexport type { NormalizedTarget, ScanMode, ScanTarget } from \"./targets.js\";\nexport type { AbsolutePath } from \"./config-path.js\";\nexport { BUNDLED_PLUGIN_VERSION, VERSION } from \"./version.js\";\n\nexport {\n classifySeverityRecords,\n classifySeverityRecordsInputSchema,\n} from \"./classify-severity-records.js\";\nexport type {\n ClassifySeverityRecordsInput,\n ClassifySeverityRecordsOptions,\n ClassifySeverityRecordsResult,\n CanonicalSeverityAssessment,\n SeverityClassificationReviewRequest,\n} from \"./classify-severity-records.js\";\nexport { validateRecords } from \"./validation-records.js\";\nexport type {\n ValidateRecordsInput,\n ValidateRecordsOptions,\n ValidationReviewRequest,\n} from \"./validation-records.js\";\n\nexport { prepareLocalExternalImport } from \"./external-findings-import.js\";\nexport {\n normalizeOpenGrepFindings,\n readOpenGrepFindings,\n type OpenGrepImportOptions,\n} from \"./opengrep-findings.js\";\nexport { readSonarFindings, type SonarCapture } from \"./sonar-findings.js\";\nexport {\n collectSonarIssues,\n type SonarCollectionOptions,\n} from \"./sonar-collector.js\";\nexport {\n normalizeVeracodeFindings,\n readVeracodeFindings,\n} from \"./veracode-findings.js\";\nexport {\n normalizeBlackDuckFindings,\n readBlackDuckFindings,\n} from \"./blackduck-findings.js\";\nexport {\n normalizeContinuumFindings,\n readContinuumFindings,\n} from \"./continuum-findings.js\";\nexport {\n normalizeInspectorFindings,\n readInspectorFindings,\n} from \"./inspector-findings.js\";\nexport {\n normalizeSnykFindingsExport,\n normalizeSnykJson,\n normalizeSnykSarif,\n readSnykFindings,\n} from \"./snyk-findings.js\";\nexport { normalizeSelectedSemgrepPlatformFindings } from \"./semgrep-platform-findings.js\";\nexport {\n normalizeSemgrepFindings,\n normalizeSemgrepSarif,\n readSemgrepFindings,\n type SemgrepImportOptions,\n} from \"./semgrep-findings.js\";\nexport {\n normalizeEndorFindings,\n normalizeEndorSarif,\n readEndorFindings,\n} from \"./endor-findings.js\";\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ExternalFinding, ExternalFindings, ExternalSourceRepository } from "./external-findings.js";
|
|
2
|
+
import { type ExternalImportTarget } from "./external-import-contract.js";
|
|
3
|
+
import type { Provider } from "./external-import-models.js";
|
|
4
|
+
export declare function inspectorReportRepository(provider: Provider, findings: readonly ExternalFinding[], target: ExternalImportTarget, projectMap?: ReadonlyMap<string, string>): (ExternalSourceRepository & {
|
|
5
|
+
findingId: string;
|
|
6
|
+
}) | undefined;
|
|
7
|
+
export declare function normalizeInspectorFindings(input: unknown, sourceRepositoryUrl: string, target?: ExternalImportTarget, projectMap?: ReadonlyMap<string, string>): ExternalFindings;
|
|
8
|
+
export declare function readInspectorFindings(path: string, sourceRepositoryUrl: string, target?: ExternalImportTarget, projectMap?: ReadonlyMap<string, string>): Promise<ExternalFindings>;
|
|
9
|
+
//# sourceMappingURL=inspector-findings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspector-findings.d.ts","sourceRoot":"","sources":["../src/inspector-findings.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,+BAA+B,CAAC;AAGvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AA6W5D,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,SAAS,eAAe,EAAE,EACpC,MAAM,EAAE,oBAAoB,EAC5B,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACvC,CAAC,wBAAwB,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,SAAS,CA0DhE;AA2MD,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,EACd,mBAAmB,EAAE,MAAM,EAC3B,MAAM,GAAE,oBAA8B,EACtC,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACvC,gBAAgB,CAoDlB;AAED,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,MAAM,EACZ,mBAAmB,EAAE,MAAM,EAC3B,MAAM,GAAE,oBAA8B,EACtC,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACvC,OAAO,CAAC,gBAAgB,CAAC,CAQ3B"}
|
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
import { posix } from "node:path";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import validSemver from "semver/functions/valid.js";
|
|
4
|
+
import { cloudRepositoryUrlKey, repositoryUrlKey, validateExternalEvidence, } from "./external-import-contract.js";
|
|
5
|
+
import { isGitHubCloudHost } from "./git-remote.js";
|
|
6
|
+
import { CodexSecurityError, errorMessage } from "./errors.js";
|
|
7
|
+
import { isRecord } from "./record.js";
|
|
8
|
+
import { normalizeRecords, readScannerJson, record, repositoryFilePath, requiredText, text, } from "./scanner-import.js";
|
|
9
|
+
const listFindings = z.strictObject({ findings: z.array(z.unknown()) });
|
|
10
|
+
const format = "aws-inspector2-list-findings/v1";
|
|
11
|
+
const findingArn = /^(arn:(aws[a-zA-Z-]*):inspector2:([a-z]{2}(?:-gov)?-[a-z]+-\d):(\d{12})):finding\/[a-f0-9]{32}$/u;
|
|
12
|
+
const integrationArn = /^arn:aws[a-zA-Z-]*:inspector2:[a-z]{2}(?:-gov)?-[a-z]+-\d:\d{12}:codesecurity-integration\/[a-f0-9-]{36}$/u;
|
|
13
|
+
const projectSuffix = /^project-[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/u;
|
|
14
|
+
const absoluteUrl = /^[a-z][a-z\d+.-]*:\/\//iu;
|
|
15
|
+
function repositoryUrl(value) {
|
|
16
|
+
const raw = requiredText(value, "Inspector --source-repository-url");
|
|
17
|
+
const url = URL.parse(raw);
|
|
18
|
+
const path = /^https?:\/\/[^/?#]+(\/[^?#]+)$/iu.exec(raw)?.[1];
|
|
19
|
+
if (!url ||
|
|
20
|
+
!path ||
|
|
21
|
+
url.username ||
|
|
22
|
+
url.password ||
|
|
23
|
+
/[\s\\?#]|%(?:2f|5c)/iu.test(raw) ||
|
|
24
|
+
path !== url.pathname ||
|
|
25
|
+
!/^\/[^/]+(?:\/[^/]+)+\/?$/u.test(path))
|
|
26
|
+
throw new Error("Use a complete HTTP(S) Inspector source repository URL with a namespace and repository, without credentials, query or fragment.");
|
|
27
|
+
return raw;
|
|
28
|
+
}
|
|
29
|
+
function projectIntegration(projectArn) {
|
|
30
|
+
const separator = projectArn.lastIndexOf("/");
|
|
31
|
+
const parent = projectArn.slice(0, separator);
|
|
32
|
+
if (!integrationArn.test(parent) ||
|
|
33
|
+
!projectSuffix.test(projectArn.slice(separator + 1)))
|
|
34
|
+
throw new Error("Expected a full Inspector repository project ARN.");
|
|
35
|
+
return parent;
|
|
36
|
+
}
|
|
37
|
+
/** @internal Validate an operator-supplied project binding. */
|
|
38
|
+
export function validateInspectorProjectMapping(projectArn, canonicalUrl) {
|
|
39
|
+
projectIntegration(projectArn);
|
|
40
|
+
return repositoryUrl(canonicalUrl);
|
|
41
|
+
}
|
|
42
|
+
function identity(finding) {
|
|
43
|
+
const arn = requiredText(finding["findingArn"], "Inspector finding ARN");
|
|
44
|
+
const match = findingArn.exec(arn);
|
|
45
|
+
if (!match)
|
|
46
|
+
throw new Error("Expected an Inspector2 finding ARN.");
|
|
47
|
+
if (finding["awsAccountId"] !== match[4])
|
|
48
|
+
throw new Error("Inspector finding ARN and AWS account do not match.");
|
|
49
|
+
return {
|
|
50
|
+
arn,
|
|
51
|
+
issuer: match[1],
|
|
52
|
+
partition: match[2],
|
|
53
|
+
region: match[3],
|
|
54
|
+
account: match[4],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function repositoryClaim({ issuer, partition, region, account }, resource) {
|
|
58
|
+
for (const [field, expected] of Object.entries({
|
|
59
|
+
partition,
|
|
60
|
+
region,
|
|
61
|
+
provider: "AWS",
|
|
62
|
+
providerAccountId: account,
|
|
63
|
+
})) {
|
|
64
|
+
if (resource[field] !== undefined && resource[field] !== expected)
|
|
65
|
+
throw new Error("Inspector repository resource and finding scope do not match.");
|
|
66
|
+
}
|
|
67
|
+
const { codeRepository } = record(resource["details"] ?? {}, "Inspector resource details");
|
|
68
|
+
const repo = record(codeRepository ?? {}, "Inspector codeRepository");
|
|
69
|
+
const optional = (field) => repo[field] === undefined
|
|
70
|
+
? undefined
|
|
71
|
+
: requiredText(repo[field], `Inspector codeRepository.${field}`);
|
|
72
|
+
const nativeId = requiredText(resource["id"], "Inspector repository resource ID");
|
|
73
|
+
let integration = optional("integrationArn");
|
|
74
|
+
if (integration !== undefined &&
|
|
75
|
+
(!integration.startsWith(issuer + ":") || !integrationArn.test(integration)))
|
|
76
|
+
throw new Error("Inspector integration ARN does not match the finding scope.");
|
|
77
|
+
if (nativeId.startsWith("arn:")) {
|
|
78
|
+
const parent = projectIntegration(nativeId);
|
|
79
|
+
if (!parent.startsWith(issuer + ":") ||
|
|
80
|
+
(integration !== undefined && parent !== integration))
|
|
81
|
+
throw new Error("Inspector repository resource ARN does not match its project or integration.");
|
|
82
|
+
integration = parent;
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
project: JSON.stringify([issuer, nativeId]),
|
|
86
|
+
integration,
|
|
87
|
+
provider: optional("providerType"),
|
|
88
|
+
nativeId,
|
|
89
|
+
name: optional("projectName"),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function checkRepositoryMapping({ nativeId, name }, source, provider, target, projectMap) {
|
|
93
|
+
const hostname = new URL(source).hostname;
|
|
94
|
+
const knownGitHub = isGitHubCloudHost(hostname);
|
|
95
|
+
const gitlab = provider === "GITLAB_SELF_MANAGED";
|
|
96
|
+
const github = provider === "GITHUB" || knownGitHub;
|
|
97
|
+
if (hostname === "gitlab.com" ||
|
|
98
|
+
(gitlab && knownGitHub) ||
|
|
99
|
+
(provider !== undefined && !gitlab && provider !== "GITHUB"))
|
|
100
|
+
throw new Error("Inspector repository provider does not match the selected mapping.");
|
|
101
|
+
if (target === "cloud" && !github)
|
|
102
|
+
throw new Error("Inspector Cloud requires a GitHub repository provider; self-managed GitLab is local only.");
|
|
103
|
+
const urls = [nativeId, name].filter((url) => !!url && absoluteUrl.test(url));
|
|
104
|
+
const key = github && !projectMap ? cloudRepositoryUrlKey : repositoryUrlKey;
|
|
105
|
+
const path = new URL((github ? cloudRepositoryUrlKey : repositoryUrlKey)(source)).pathname.slice(1);
|
|
106
|
+
const slug = github ? name?.toLowerCase() : name;
|
|
107
|
+
const matchesSlug = !slug ||
|
|
108
|
+
absoluteUrl.test(slug) ||
|
|
109
|
+
slug === path ||
|
|
110
|
+
slug === posix.basename(path) ||
|
|
111
|
+
(gitlab && projectMap && path.endsWith("/" + slug));
|
|
112
|
+
if (!matchesSlug ||
|
|
113
|
+
urls.some((url) => key(repositoryUrl(url)) !== key(source)))
|
|
114
|
+
throw new Error("Inspector native repository does not match --source-repository-url.");
|
|
115
|
+
if (projectMap) {
|
|
116
|
+
// repositoryClaim validated this ARN and its issuer before the lookup.
|
|
117
|
+
const trustedUrl = nativeId.startsWith("arn:")
|
|
118
|
+
? projectMap.get(nativeId)
|
|
119
|
+
: undefined;
|
|
120
|
+
if (trustedUrl === undefined)
|
|
121
|
+
throw new Error("Inspector project ARN is missing from the trusted mapping.");
|
|
122
|
+
if (repositoryUrlKey(repositoryUrl(trustedUrl)) !== repositoryUrlKey(source))
|
|
123
|
+
throw new Error("Inspector project ARN mapping does not match the source repository URL.");
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
return urls.length > 0;
|
|
127
|
+
}
|
|
128
|
+
function repositoryClaims(finding) {
|
|
129
|
+
if (!isRecord(finding) || !Array.isArray(finding["resources"]))
|
|
130
|
+
return [];
|
|
131
|
+
const claims = [];
|
|
132
|
+
let origin;
|
|
133
|
+
for (const resource of finding["resources"]) {
|
|
134
|
+
if (!isRecord(resource) || resource["type"] !== "CODE_REPOSITORY")
|
|
135
|
+
continue;
|
|
136
|
+
origin ??= identity(finding);
|
|
137
|
+
claims.push(repositoryClaim(origin, resource));
|
|
138
|
+
}
|
|
139
|
+
return claims;
|
|
140
|
+
}
|
|
141
|
+
/** Claims from the whole export must identify one project, including excluded rows. */
|
|
142
|
+
function checkReportScope(rows, target, projectMap, exclude = (_, error) => {
|
|
143
|
+
throw error;
|
|
144
|
+
}) {
|
|
145
|
+
const claims = rows.flatMap((row) => row.claims);
|
|
146
|
+
function shared(field) {
|
|
147
|
+
const values = new Set(claims.map((claim) => claim[field]));
|
|
148
|
+
values.delete(undefined);
|
|
149
|
+
if (values.size > 1)
|
|
150
|
+
throw new Error("Inspector export identifies more than one repository project or integration.");
|
|
151
|
+
return values.values().next().value;
|
|
152
|
+
}
|
|
153
|
+
shared("project");
|
|
154
|
+
shared("integration");
|
|
155
|
+
const provider = shared("provider");
|
|
156
|
+
// A bare project ID can recur across integrations in the same account and Region.
|
|
157
|
+
const sharedProvider = claims.find((claim) => claim.integration && claim.provider)?.provider;
|
|
158
|
+
const providerFor = (claim) => claim.provider ?? (claim.integration ? sharedProvider : undefined);
|
|
159
|
+
const missingHost = () => new Error("Inspector needs a matching native repository URL or a trusted project ARN mapping to identify the Git host.");
|
|
160
|
+
const needHost = [];
|
|
161
|
+
let sharedHost = false;
|
|
162
|
+
for (const row of rows) {
|
|
163
|
+
try {
|
|
164
|
+
// Only a fully verified row can supply evidence to another row.
|
|
165
|
+
const scopedMatches = row.claims.flatMap((claim) => {
|
|
166
|
+
const proven = checkRepositoryMapping(claim, row.source, providerFor(claim), target, projectMap);
|
|
167
|
+
if (claim.integration)
|
|
168
|
+
return [proven];
|
|
169
|
+
if (!proven)
|
|
170
|
+
throw missingHost();
|
|
171
|
+
return [];
|
|
172
|
+
});
|
|
173
|
+
if (scopedMatches.includes(true))
|
|
174
|
+
sharedHost = true;
|
|
175
|
+
else if (scopedMatches.length)
|
|
176
|
+
needHost.push(row);
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
exclude(row, error);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (!sharedHost)
|
|
183
|
+
for (const row of needHost)
|
|
184
|
+
exclude(row, missingHost());
|
|
185
|
+
return claims.every((claim) => providerFor(claim) === provider)
|
|
186
|
+
? provider
|
|
187
|
+
: undefined;
|
|
188
|
+
}
|
|
189
|
+
const nonempty = z.string().regex(/\S/u, "Expected nonempty text.");
|
|
190
|
+
const optionalValue = z.unknown().optional();
|
|
191
|
+
const absent = z.never().optional();
|
|
192
|
+
const vulnerablePackage = z.object({
|
|
193
|
+
name: nonempty,
|
|
194
|
+
version: nonempty,
|
|
195
|
+
packageManager: optionalValue,
|
|
196
|
+
epoch: optionalValue,
|
|
197
|
+
release: optionalValue,
|
|
198
|
+
fixedInVersion: optionalValue,
|
|
199
|
+
filePath: optionalValue,
|
|
200
|
+
sourceLayerHash: absent,
|
|
201
|
+
sourceLambdaLayerArn: absent,
|
|
202
|
+
});
|
|
203
|
+
const repositoryFinding = z.object({
|
|
204
|
+
type: z.enum(["PACKAGE_VULNERABILITY", "CODE_VULNERABILITY"]),
|
|
205
|
+
resources: z
|
|
206
|
+
.array(z.object({
|
|
207
|
+
type: z.literal("CODE_REPOSITORY"),
|
|
208
|
+
details: z.strictObject({ codeRepository: optionalValue }).nullish(),
|
|
209
|
+
}))
|
|
210
|
+
.min(1),
|
|
211
|
+
networkReachabilityDetails: absent,
|
|
212
|
+
packageVulnerabilityDetails: z
|
|
213
|
+
.object({
|
|
214
|
+
vulnerabilityId: nonempty,
|
|
215
|
+
source: nonempty,
|
|
216
|
+
sourceUrl: optionalValue,
|
|
217
|
+
relatedVulnerabilities: z.array(nonempty).nullish(),
|
|
218
|
+
vulnerablePackages: z.array(vulnerablePackage).nullish(),
|
|
219
|
+
})
|
|
220
|
+
.optional(),
|
|
221
|
+
codeVulnerabilityDetails: z
|
|
222
|
+
.object({
|
|
223
|
+
detectorName: nonempty,
|
|
224
|
+
detectorId: nonempty,
|
|
225
|
+
cwes: z.array(z.unknown()),
|
|
226
|
+
filePath: z.object({
|
|
227
|
+
fileName: optionalValue,
|
|
228
|
+
filePath: optionalValue,
|
|
229
|
+
startLine: optionalValue,
|
|
230
|
+
}),
|
|
231
|
+
sourceLambdaLayerArn: absent,
|
|
232
|
+
})
|
|
233
|
+
.optional(),
|
|
234
|
+
});
|
|
235
|
+
function selectedFinding(value) {
|
|
236
|
+
const native = record(value, "Inspector finding");
|
|
237
|
+
const parsed = repositoryFinding.safeParse(native);
|
|
238
|
+
if (!parsed.success)
|
|
239
|
+
throw new Error(`Expected an Inspector vulnerability on CODE_REPOSITORY resources. ${z.prettifyError(parsed.error)}`);
|
|
240
|
+
const { type, packageVulnerabilityDetails: pkg, codeVulnerabilityDetails: code, } = parsed.data;
|
|
241
|
+
if ((pkg && type !== "PACKAGE_VULNERABILITY") ||
|
|
242
|
+
(code && type !== "CODE_VULNERABILITY"))
|
|
243
|
+
throw new Error("Inspector finding contains details for a different finding type.");
|
|
244
|
+
return { native, pkg, code };
|
|
245
|
+
}
|
|
246
|
+
function isInspectorFinding(value, occurrenceId) {
|
|
247
|
+
return (isRecord(value) &&
|
|
248
|
+
typeof value["findingArn"] === "string" &&
|
|
249
|
+
findingArn.test(value["findingArn"]) &&
|
|
250
|
+
(occurrenceId === undefined || value["findingArn"] === occurrenceId) &&
|
|
251
|
+
Array.isArray(value["resources"]));
|
|
252
|
+
}
|
|
253
|
+
function hasInspectorEvidence(sourceData, occurrenceId) {
|
|
254
|
+
return (isRecord(sourceData) &&
|
|
255
|
+
(sourceData["format"] === format ||
|
|
256
|
+
isInspectorFinding(sourceData["finding"], occurrenceId) ||
|
|
257
|
+
isInspectorFinding(sourceData, occurrenceId)));
|
|
258
|
+
}
|
|
259
|
+
export function inspectorReportRepository(provider, findings, target, projectMap) {
|
|
260
|
+
if (provider !== "inspector") {
|
|
261
|
+
if (findings.some(({ evidence, source_finding_id }) => hasInspectorEvidence(evidence.source_data, source_finding_id)))
|
|
262
|
+
throw new CodexSecurityError("Retained Inspector evidence requires the inspector provider.");
|
|
263
|
+
return undefined;
|
|
264
|
+
}
|
|
265
|
+
const retained = [];
|
|
266
|
+
for (const { source_finding_id: id, evidence } of findings) {
|
|
267
|
+
const data = evidence.source_data;
|
|
268
|
+
if (!isRecord(data) || data["format"] !== format) {
|
|
269
|
+
if (projectMap || hasInspectorEvidence(data) || findingArn.test(id))
|
|
270
|
+
throw new Error("Expected retained Inspector ListFindings evidence for the finding ARN.");
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
const source = repositoryUrl(data["sourceRepositoryUrl"]);
|
|
274
|
+
const { native: finding } = selectedFinding(data["finding"]);
|
|
275
|
+
if (finding["findingArn"] !== id)
|
|
276
|
+
throw new Error("Inspector source_finding_id does not match the retained finding ARN.");
|
|
277
|
+
retained.push({
|
|
278
|
+
source,
|
|
279
|
+
claims: repositoryClaims(finding),
|
|
280
|
+
id,
|
|
281
|
+
declared: evidence.details?.repository?.url,
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
const first = retained[0];
|
|
285
|
+
if (!first)
|
|
286
|
+
return undefined;
|
|
287
|
+
// A supplied map owns the path casing on custom hosts.
|
|
288
|
+
const github = checkReportScope(retained, target, projectMap) === "GITHUB" && !projectMap;
|
|
289
|
+
const key = github || target === "cloud" ? cloudRepositoryUrlKey : repositoryUrlKey;
|
|
290
|
+
const repository = key(first.source);
|
|
291
|
+
for (const { source, declared } of retained) {
|
|
292
|
+
if (key(source) !== repository)
|
|
293
|
+
throw new Error("Inspector export identifies more than one source repository.");
|
|
294
|
+
if (declared && key(declared) !== repository)
|
|
295
|
+
throw new Error("Retained scanner repository does not match the normalized evidence repository.");
|
|
296
|
+
}
|
|
297
|
+
return {
|
|
298
|
+
findingId: first.id,
|
|
299
|
+
url: first.source,
|
|
300
|
+
...(github && { platform: "github" }),
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
function timestamp(value) {
|
|
304
|
+
const seconds = typeof value === "number"
|
|
305
|
+
? value
|
|
306
|
+
: typeof value === "string" &&
|
|
307
|
+
/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.\d+)?(?:Z|[+-]\d\d:\d\d)$/u.test(value)
|
|
308
|
+
? Date.parse(value) / 1000
|
|
309
|
+
: NaN;
|
|
310
|
+
if (!Number.isFinite(seconds))
|
|
311
|
+
throw new Error("Invalid Inspector timestamp.");
|
|
312
|
+
return Math.floor(seconds);
|
|
313
|
+
}
|
|
314
|
+
const ecosystems = new Map(Object.entries({
|
|
315
|
+
BUNDLER: "rubygems",
|
|
316
|
+
GEMSPEC: "rubygems",
|
|
317
|
+
CARGO: "cargo",
|
|
318
|
+
COMPOSER: "composer",
|
|
319
|
+
NPM: "npm",
|
|
320
|
+
YARN: "npm",
|
|
321
|
+
NODEPKG: "npm",
|
|
322
|
+
NUGET: "nuget",
|
|
323
|
+
DOTNET_CORE: "nuget",
|
|
324
|
+
GOBINARY: "go",
|
|
325
|
+
GOMOD: "go",
|
|
326
|
+
JAR: "java",
|
|
327
|
+
POM: "maven",
|
|
328
|
+
PIP: "pypi",
|
|
329
|
+
PIPENV: "pypi",
|
|
330
|
+
POETRY: "pypi",
|
|
331
|
+
PYTHONPKG: "pypi",
|
|
332
|
+
}));
|
|
333
|
+
const manifests = new Set([
|
|
334
|
+
"package.json",
|
|
335
|
+
"package-lock.json",
|
|
336
|
+
"npm-shrinkwrap.json",
|
|
337
|
+
"yarn.lock",
|
|
338
|
+
"pnpm-lock.yaml",
|
|
339
|
+
"Cargo.toml",
|
|
340
|
+
"Cargo.lock",
|
|
341
|
+
"composer.json",
|
|
342
|
+
"composer.lock",
|
|
343
|
+
"Gemfile",
|
|
344
|
+
"Gemfile.lock",
|
|
345
|
+
"go.mod",
|
|
346
|
+
"go.sum",
|
|
347
|
+
"pom.xml",
|
|
348
|
+
"build.gradle",
|
|
349
|
+
"build.gradle.kts",
|
|
350
|
+
"gradle.lockfile",
|
|
351
|
+
"Pipfile",
|
|
352
|
+
"Pipfile.lock",
|
|
353
|
+
"poetry.lock",
|
|
354
|
+
"pyproject.toml",
|
|
355
|
+
"uv.lock",
|
|
356
|
+
"packages.config",
|
|
357
|
+
"packages.lock.json",
|
|
358
|
+
]);
|
|
359
|
+
function manifestPath(path) {
|
|
360
|
+
if (!path)
|
|
361
|
+
return null;
|
|
362
|
+
const name = posix.basename(path);
|
|
363
|
+
return manifests.has(name) ||
|
|
364
|
+
/^requirements(?:[-_.].*)?\.txt$/u.test(name) ||
|
|
365
|
+
/\.(?:csproj|fsproj|vbproj|gemspec)$/u.test(name)
|
|
366
|
+
? path
|
|
367
|
+
: null;
|
|
368
|
+
}
|
|
369
|
+
function concreteVersion(value, ecosystem, osPackage) {
|
|
370
|
+
const version = text(value);
|
|
371
|
+
if (!version)
|
|
372
|
+
return null;
|
|
373
|
+
// Debian versions use internal tildes for prereleases and backports.
|
|
374
|
+
if (osPackage && version.includes("~"))
|
|
375
|
+
return /^(?:\d+:)?\d[a-z\d.+~]*(?:-[a-z\d.+~]+)*$/iu.test(version)
|
|
376
|
+
? version
|
|
377
|
+
: null;
|
|
378
|
+
if (validSemver(version))
|
|
379
|
+
return version;
|
|
380
|
+
if (ecosystem === "npm" || ecosystem === "cargo")
|
|
381
|
+
return null;
|
|
382
|
+
if (ecosystem === "java" || ecosystem === "maven") {
|
|
383
|
+
if (version === "LATEST" ||
|
|
384
|
+
version === "RELEASE" ||
|
|
385
|
+
version.startsWith("latest."))
|
|
386
|
+
return null;
|
|
387
|
+
return /^[a-z\d][\w.+-]*$/iu.test(version) && !version.endsWith("+")
|
|
388
|
+
? version
|
|
389
|
+
: null;
|
|
390
|
+
}
|
|
391
|
+
if (!ecosystem && version.endsWith("+"))
|
|
392
|
+
return null;
|
|
393
|
+
const publicVersion = ecosystem === "pypi" ? version.split("+", 1)[0] : version;
|
|
394
|
+
return /\d/u.test(version) &&
|
|
395
|
+
/^(?:\d+:)?[a-z\d][\w.+!-]*$/iu.test(version) &&
|
|
396
|
+
!/(?:^|\.)x(?:\.|$)/iu.test(publicVersion)
|
|
397
|
+
? version
|
|
398
|
+
: null;
|
|
399
|
+
}
|
|
400
|
+
function evidence({ native: finding, pkg, code }, id, source, target) {
|
|
401
|
+
const { description, severity, remediation, firstObservedAt, lastObservedAt, updatedAt, status, } = finding;
|
|
402
|
+
const { recommendation } = record(remediation, "Inspector remediation");
|
|
403
|
+
record(recommendation ?? {}, "Inspector recommendation");
|
|
404
|
+
requiredText(status, "Inspector status");
|
|
405
|
+
timestamp(firstObservedAt);
|
|
406
|
+
timestamp(lastObservedAt);
|
|
407
|
+
const level = requiredText(severity, "Inspector severity").toLowerCase();
|
|
408
|
+
const paths = new Set();
|
|
409
|
+
const packages = (pkg?.vulnerablePackages ?? []).map((item) => {
|
|
410
|
+
const path = repositoryFilePath(item.filePath);
|
|
411
|
+
if (path)
|
|
412
|
+
paths.add(path);
|
|
413
|
+
const ecosystem = ecosystems.get(text(item.packageManager) ?? "") ?? null;
|
|
414
|
+
const version = (value) => concreteVersion(value, ecosystem, item.packageManager === "OS");
|
|
415
|
+
const fixed = version(item.fixedInVersion);
|
|
416
|
+
const splitVersion = item.packageManager === "OS" &&
|
|
417
|
+
(item.epoch != null || item.release != null);
|
|
418
|
+
return {
|
|
419
|
+
name: item.name,
|
|
420
|
+
ecosystem,
|
|
421
|
+
installed_version: splitVersion ? null : version(item.version),
|
|
422
|
+
manifest_path: manifestPath(path),
|
|
423
|
+
fixed_versions: fixed ? [fixed] : [],
|
|
424
|
+
};
|
|
425
|
+
});
|
|
426
|
+
const locations = [...paths].map((path) => ({ path, line: null }));
|
|
427
|
+
if (code) {
|
|
428
|
+
const { fileName, filePath, startLine } = code.filePath;
|
|
429
|
+
const path = repositoryFilePath(filePath);
|
|
430
|
+
if (path && posix.basename(path) === fileName)
|
|
431
|
+
locations.push({
|
|
432
|
+
path,
|
|
433
|
+
line: typeof startLine === "number" &&
|
|
434
|
+
Number.isSafeInteger(startLine) &&
|
|
435
|
+
startLine > 0
|
|
436
|
+
? startLine
|
|
437
|
+
: null,
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
return validateExternalEvidence({
|
|
441
|
+
title: text(finding["title"]) ??
|
|
442
|
+
pkg?.vulnerabilityId ??
|
|
443
|
+
code?.detectorName ??
|
|
444
|
+
id,
|
|
445
|
+
description: requiredText(description, "Inspector description"),
|
|
446
|
+
severity: ["critical", "high", "medium", "low", "informational"].includes(level)
|
|
447
|
+
? level
|
|
448
|
+
: "unknown",
|
|
449
|
+
url: text(pkg?.sourceUrl),
|
|
450
|
+
advisory_ids: pkg
|
|
451
|
+
? [
|
|
452
|
+
...new Set([
|
|
453
|
+
pkg.vulnerabilityId,
|
|
454
|
+
...(pkg.relatedVulnerabilities ?? []),
|
|
455
|
+
]),
|
|
456
|
+
]
|
|
457
|
+
: [],
|
|
458
|
+
packages,
|
|
459
|
+
locations,
|
|
460
|
+
source_updated_at: updatedAt === undefined ? null : timestamp(updatedAt),
|
|
461
|
+
source_data: {
|
|
462
|
+
format,
|
|
463
|
+
sourceRepositoryUrl: source,
|
|
464
|
+
finding: structuredClone(finding),
|
|
465
|
+
},
|
|
466
|
+
}, target);
|
|
467
|
+
}
|
|
468
|
+
export function normalizeInspectorFindings(input, sourceRepositoryUrl, target = "cloud", projectMap) {
|
|
469
|
+
const source = repositoryUrl(sourceRepositoryUrl);
|
|
470
|
+
if (isRecord(input) &&
|
|
471
|
+
(Object.hasOwn(input, "NextToken") || Object.hasOwn(input, "nextToken")))
|
|
472
|
+
throw new Error("Inspector export has a continuation key; supply the complete paginated CLI JSON output.");
|
|
473
|
+
const report = listFindings.safeParse(input);
|
|
474
|
+
if (!report.success)
|
|
475
|
+
throw new Error("Expected only a complete native Inspector ListFindings response with a findings array.");
|
|
476
|
+
const rows = report.data.findings.map((finding, i) => ({
|
|
477
|
+
finding,
|
|
478
|
+
source,
|
|
479
|
+
position: i + 1,
|
|
480
|
+
claims: repositoryClaims(finding),
|
|
481
|
+
}));
|
|
482
|
+
checkReportScope(rows, target, projectMap);
|
|
483
|
+
function checkRetainedScope(result, removedIds) {
|
|
484
|
+
if (!result.excluded.length || !result.findings.length)
|
|
485
|
+
return;
|
|
486
|
+
// Only surviving rows can supply shared provider and host evidence on replay.
|
|
487
|
+
const skipped = new Set(result.excluded.map((row) => row.position));
|
|
488
|
+
const retained = rows.filter((row) => !skipped.has(row.position));
|
|
489
|
+
checkReportScope(retained, target, projectMap, (row, error) => {
|
|
490
|
+
skipped.add(row.position);
|
|
491
|
+
result.excluded.push({
|
|
492
|
+
position: row.position,
|
|
493
|
+
source_finding_id: identity(record(row.finding, "Inspector finding"))
|
|
494
|
+
.arn,
|
|
495
|
+
reason: errorMessage(error),
|
|
496
|
+
});
|
|
497
|
+
});
|
|
498
|
+
result.findings = result.findings.filter((finding, i) => {
|
|
499
|
+
if (!skipped.has(retained[i].position))
|
|
500
|
+
return true;
|
|
501
|
+
removedIds?.add(finding.source_finding_id);
|
|
502
|
+
return false;
|
|
503
|
+
});
|
|
504
|
+
result.excluded.sort((a, b) => a.position - b.position);
|
|
505
|
+
}
|
|
506
|
+
return normalizeRecords(rows, ({ finding }, id) => evidence(selectedFinding(finding), id, source, target), ({ finding }) => identity(record(finding, "Inspector finding")).arn, target, { filter: checkRetainedScope });
|
|
507
|
+
}
|
|
508
|
+
export async function readInspectorFindings(path, sourceRepositoryUrl, target = "cloud", projectMap) {
|
|
509
|
+
const mapping = projectMap && new Map(projectMap);
|
|
510
|
+
return normalizeInspectorFindings(await readScannerJson(path), sourceRepositoryUrl, target, mapping);
|
|
511
|
+
}
|
|
512
|
+
//# sourceMappingURL=inspector-findings.js.map
|