@openai/codex-security 0.8.3 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -746
- package/_bundled_plugin/.codex-plugin/plugin.json +2 -0
- package/_bundled_plugin/.mcp.json +7 -1
- package/_bundled_plugin/examples/completed-scan/findings.json +16 -4
- package/_bundled_plugin/examples/completed-scan/report.md +11 -8
- package/_bundled_plugin/examples/completed-scan/scan-manifest.json +4 -2
- package/_bundled_plugin/mcp/fzstd-LICENSE.txt +21 -0
- package/_bundled_plugin/mcp/helpers.mjs +2 -11
- package/_bundled_plugin/mcp/helpers.mjs.br +0 -0
- package/_bundled_plugin/mcp/native/THIRD_PARTY_NOTICES.txt +3 -210
- package/_bundled_plugin/mcp/native/darwin-arm64/unix.node +0 -0
- package/_bundled_plugin/mcp/native/darwin-x64/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-arm64-gnu/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-arm64-musl/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-x64-gnu/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-x64-musl/unix.node +0 -0
- package/_bundled_plugin/mcp/native/win32-arm64/windows.node +0 -0
- package/_bundled_plugin/mcp/native/win32-x64/windows.node +0 -0
- package/_bundled_plugin/mcp/package.json +1 -0
- package/_bundled_plugin/mcp/permission-profile-preflight.mjs +5 -2
- package/_bundled_plugin/mcp/server.mjs +2 -11
- package/_bundled_plugin/mcp/server.mjs.br +0 -0
- package/_bundled_plugin/mcp/session-decompression.mjs +712 -0
- package/_bundled_plugin/references/artifact-storage.md +1 -1
- package/_bundled_plugin/references/baseline-auditor.md +18 -0
- package/_bundled_plugin/references/core-scan.md +5 -42
- package/_bundled_plugin/references/default-severity-rubric.md +9 -4
- package/_bundled_plugin/references/final-report.md +5 -3
- package/_bundled_plugin/references/finding-detail-fields.md +18 -18
- package/_bundled_plugin/references/focused-investigator.md +13 -0
- package/_bundled_plugin/references/sarif-adapter.md +8 -2
- package/_bundled_plugin/references/scan-artifacts.md +21 -12
- package/_bundled_plugin/references/scan-contract.md +27 -33
- package/_bundled_plugin/references/scan-prologue.md +2 -2
- package/_bundled_plugin/references/scan-runtime.md +4 -2
- package/_bundled_plugin/references/security-guidance.md +14 -1
- package/_bundled_plugin/references/validate-scan-findings.md +3 -0
- package/_bundled_plugin/schemas/tools/scan-draft.schema.json +2 -2
- package/_bundled_plugin/scripts/check_deep_scan_target.py +97 -0
- package/_bundled_plugin/scripts/codex_profile.mjs +7 -1
- package/_bundled_plugin/scripts/deep_scan_config.py +20 -1
- package/_bundled_plugin/scripts/deep_scan_workbench.py +192 -352
- package/_bundled_plugin/scripts/dispatch_inventory_tool +7 -0
- package/_bundled_plugin/scripts/filesystem_identity.py +1 -0
- package/_bundled_plugin/scripts/finalize_scan_contract.py +182 -230
- package/_bundled_plugin/scripts/finding_preview.py +20 -0
- package/_bundled_plugin/scripts/launch_codex_security_mcp +55 -16
- package/_bundled_plugin/scripts/legacy_findings.py +148 -0
- package/_bundled_plugin/scripts/posix_scan_local_files.py +37 -1
- package/_bundled_plugin/scripts/read_codex_session.mjs +21 -0
- package/_bundled_plugin/scripts/report_projection.py +81 -43
- package/_bundled_plugin/scripts/review_state.py +8 -2
- package/_bundled_plugin/scripts/servicenow_avit.py +20 -0
- package/_bundled_plugin/scripts/snapshot_sqlite.py +9 -2
- package/_bundled_plugin/scripts/threat_model_projection.py +22 -26
- package/_bundled_plugin/scripts/validate_scan_contract.py +7 -1
- package/_bundled_plugin/scripts/windows_scan_local_files.py +582 -20
- package/_bundled_plugin/scripts/workbench/__init__.py +1 -1
- package/_bundled_plugin/scripts/workbench/handoff.py +100 -23
- package/_bundled_plugin/scripts/workbench/retained_coverage.py +30 -51
- package/_bundled_plugin/scripts/workbench/retained_records.py +18 -30
- package/_bundled_plugin/scripts/workbench/runtime_toml.py +4 -1
- package/_bundled_plugin/scripts/workbench/saved_coverage.py +9 -17
- package/_bundled_plugin/scripts/workbench/saved_outputs.py +9 -0
- package/_bundled_plugin/scripts/workbench/saved_sources.py +47 -40
- package/_bundled_plugin/scripts/workbench/storage.py +91 -7
- package/_bundled_plugin/scripts/workbench_cli.py +54 -14
- package/_bundled_plugin/scripts/workbench_constants.py +12 -0
- package/_bundled_plugin/scripts/workbench_coverage_receipts.py +3 -3
- package/_bundled_plugin/scripts/workbench_db.py +562 -303
- package/_bundled_plugin/scripts/workbench_feedback.py +57 -11
- package/_bundled_plugin/scripts/workbench_finding_index.py +1 -0
- package/_bundled_plugin/scripts/workbench_finding_workflows.py +4 -0
- package/_bundled_plugin/scripts/workbench_native_indexes.py +238 -41
- package/_bundled_plugin/scripts/workbench_progress.py +169 -4
- package/_bundled_plugin/scripts/workbench_publication.py +16 -13
- package/_bundled_plugin/scripts/workbench_remediation.py +155 -2
- package/_bundled_plugin/scripts/workbench_saved_results.py +176 -81
- package/_bundled_plugin/scripts/workbench_scan_history.py +398 -174
- package/_bundled_plugin/scripts/workbench_scan_start.py +224 -31
- package/_bundled_plugin/scripts/workbench_scan_usage.py +675 -73
- package/_bundled_plugin/scripts/workbench_schema.py +258 -63
- package/_bundled_plugin/scripts/workbench_setup.py +14 -2
- package/_bundled_plugin/scripts/workbench_source_excerpt.py +13 -0
- package/_bundled_plugin/scripts/workbench_source_scopes.py +18 -0
- package/_bundled_plugin/scripts/workbench_target.py +594 -136
- package/_bundled_plugin/scripts/workbench_target_state.py +1110 -21
- package/_bundled_plugin/scripts/workbench_validation.py +43 -3
- package/_bundled_plugin/shared/workbench-history-repairs.json +77 -35
- package/_bundled_plugin/shared/workbench-migrations.json +100 -0
- package/_bundled_plugin/skills/cloud-findings/SKILL.md +5 -5
- package/_bundled_plugin/skills/deep-security-scan/SKILL.md +7 -50
- package/_bundled_plugin/skills/fix-finding/SKILL.md +2 -1
- package/_bundled_plugin/skills/publish-findings/SKILL.md +24 -153
- package/_bundled_plugin/skills/publish-findings/agents/openai.yaml +2 -2
- package/_bundled_plugin/skills/publish-findings/references/checkmarx-import.md +37 -0
- package/_bundled_plugin/skills/publish-findings/references/wiz-import.md +3 -3
- package/_bundled_plugin/skills/publish-findings/scripts/collect_checkmarx.py +409 -0
- package/_bundled_plugin/skills/publish-findings/scripts/collect_continuum.py +224 -0
- package/_bundled_plugin/skills/publish-findings/scripts/collector_paths.py +63 -0
- package/_bundled_plugin/skills/security-scan/SKILL.md +9 -46
- package/_bundled_plugin/skills/security-scan/agents/openai.yaml +2 -2
- package/_bundled_plugin/skills/security-scan/references/desktop-scan.md +3 -21
- package/_bundled_plugin/skills/security-scan/references/managed-scan.md +11 -0
- package/_bundled_plugin/skills/security-scan/references/scan-results.md +15 -0
- package/_bundled_plugin/skills/security-scan/references/scoped-paths.md +23 -0
- package/_bundled_plugin/skills/security-scan/references/sdk-files.md +24 -0
- package/_bundled_plugin/skills/threat-model-visualize/scripts/build_explorer.py +22 -1
- package/_bundled_plugin/skills/triage-finding/references/ticket-intake.md +6 -2
- package/bin/codex-security.mjs +2 -2
- package/dist/api.d.ts +45 -5
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +1192 -427
- package/dist/api.js.map +1 -1
- package/dist/armorcode-findings.d.ts +9 -0
- package/dist/armorcode-findings.d.ts.map +1 -0
- package/dist/armorcode-findings.js +145 -0
- package/dist/armorcode-findings.js.map +1 -0
- package/dist/artifact-export.d.ts +2 -0
- package/dist/artifact-export.d.ts.map +1 -1
- package/dist/artifact-export.js +29 -13
- package/dist/artifact-export.js.map +1 -1
- package/dist/auth.d.ts +6 -2
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +37 -18
- package/dist/auth.js.map +1 -1
- package/dist/batch-cost.d.ts +18 -0
- package/dist/batch-cost.d.ts.map +1 -0
- package/dist/batch-cost.js +41 -0
- package/dist/batch-cost.js.map +1 -0
- package/dist/bedrock-oss-pricing.d.ts +6 -0
- package/dist/bedrock-oss-pricing.d.ts.map +1 -0
- package/dist/bedrock-oss-pricing.js +58 -0
- package/dist/bedrock-oss-pricing.js.map +1 -0
- package/dist/bedrock-pricing.d.ts +15 -0
- package/dist/bedrock-pricing.d.ts.map +1 -0
- package/dist/bedrock-pricing.js +117 -0
- package/dist/bedrock-pricing.js.map +1 -0
- package/dist/blackduck-findings.d.ts +1 -1
- package/dist/blackduck-findings.d.ts.map +1 -1
- package/dist/blackduck-findings.js +24 -22
- package/dist/blackduck-findings.js.map +1 -1
- package/dist/bulk-scan-discovery.d.ts.map +1 -1
- package/dist/bulk-scan-discovery.js +4 -4
- package/dist/bulk-scan-discovery.js.map +1 -1
- package/dist/bundled-plugin.d.ts +4 -0
- package/dist/bundled-plugin.d.ts.map +1 -0
- package/dist/bundled-plugin.js +23 -0
- package/dist/bundled-plugin.js.map +1 -0
- package/dist/checkmarx-evidence.d.ts +19 -0
- package/dist/checkmarx-evidence.d.ts.map +1 -0
- package/dist/checkmarx-evidence.js +36 -0
- package/dist/checkmarx-evidence.js.map +1 -0
- package/dist/checkmarx-findings.d.ts +4 -0
- package/dist/checkmarx-findings.d.ts.map +1 -0
- package/dist/checkmarx-findings.js +27 -0
- package/dist/checkmarx-findings.js.map +1 -0
- package/dist/checkmarx-one.d.ts +4 -0
- package/dist/checkmarx-one.d.ts.map +1 -0
- package/dist/checkmarx-one.js +53 -0
- package/dist/checkmarx-one.js.map +1 -0
- package/dist/checkmarx-repository.d.ts +12 -0
- package/dist/checkmarx-repository.d.ts.map +1 -0
- package/dist/checkmarx-repository.js +181 -0
- package/dist/checkmarx-repository.js.map +1 -0
- package/dist/checkmarx-xml.d.ts +12 -0
- package/dist/checkmarx-xml.d.ts.map +1 -0
- package/dist/checkmarx-xml.js +196 -0
- package/dist/checkmarx-xml.js.map +1 -0
- package/dist/classify-scan-severity.d.ts +1 -1
- package/dist/classify-scan-severity.d.ts.map +1 -1
- package/dist/classify-scan-severity.js +11 -3
- package/dist/classify-scan-severity.js.map +1 -1
- package/dist/classify-severity-records.d.ts +1 -9
- package/dist/classify-severity-records.d.ts.map +1 -1
- package/dist/classify-severity-records.js +3 -13
- package/dist/classify-severity-records.js.map +1 -1
- package/dist/classify-severity.d.ts.map +1 -1
- package/dist/classify-severity.js +11 -10
- package/dist/classify-severity.js.map +1 -1
- package/dist/cli-argument.d.ts +4 -0
- package/dist/cli-argument.d.ts.map +1 -0
- package/dist/cli-argument.js +17 -0
- package/dist/cli-argument.js.map +1 -0
- package/dist/cli-help.d.ts +1 -1
- package/dist/cli-help.d.ts.map +1 -1
- package/dist/cli-help.js +71 -29
- package/dist/cli-help.js.map +1 -1
- package/dist/cli-hook.d.ts +3 -0
- package/dist/cli-hook.d.ts.map +1 -0
- package/dist/cli-hook.js +87 -0
- package/dist/cli-hook.js.map +1 -0
- package/dist/cli-integrations.d.ts +13 -0
- package/dist/cli-integrations.d.ts.map +1 -0
- package/dist/cli-integrations.js +333 -0
- package/dist/cli-integrations.js.map +1 -0
- package/dist/cli-mcp.d.ts +15 -0
- package/dist/cli-mcp.d.ts.map +1 -0
- package/dist/cli-mcp.js +178 -0
- package/dist/cli-mcp.js.map +1 -0
- package/dist/cli-token-view.d.ts +10 -0
- package/dist/cli-token-view.d.ts.map +1 -0
- package/dist/cli-token-view.js +41 -0
- package/dist/cli-token-view.js.map +1 -0
- package/dist/cli.d.ts +16 -8
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +3382 -2017
- package/dist/cli.js.map +1 -1
- package/dist/cloud-publish.d.ts.map +1 -1
- package/dist/cloud-publish.js +35 -33
- package/dist/cloud-publish.js.map +1 -1
- package/dist/codex-sdk-environment.d.ts +6 -0
- package/dist/codex-sdk-environment.d.ts.map +1 -1
- package/dist/codex-sdk-environment.js +19 -0
- package/dist/codex-sdk-environment.js.map +1 -1
- package/dist/command-words.d.ts +3 -0
- package/dist/command-words.d.ts.map +1 -0
- package/dist/command-words.js +46 -0
- package/dist/command-words.js.map +1 -0
- package/dist/component-scan.d.ts +19 -4
- package/dist/component-scan.d.ts.map +1 -1
- package/dist/component-scan.js +67 -9
- package/dist/component-scan.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +130 -67
- package/dist/config.js.map +1 -1
- package/dist/continuum-findings.d.ts +1 -1
- package/dist/continuum-findings.d.ts.map +1 -1
- package/dist/continuum-findings.js +149 -19
- package/dist/continuum-findings.js.map +1 -1
- package/dist/contract-values.d.ts +2 -0
- package/dist/contract-values.d.ts.map +1 -1
- package/dist/contract-values.js +12 -9
- package/dist/contract-values.js.map +1 -1
- package/dist/cost-model.d.ts +13 -1
- package/dist/cost-model.d.ts.map +1 -1
- package/dist/cost-model.js +66 -112
- package/dist/cost-model.js.map +1 -1
- package/dist/cost.d.ts +42 -3
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +484 -149
- package/dist/cost.js.map +1 -1
- package/dist/custom-publish.d.ts +4 -0
- package/dist/custom-publish.d.ts.map +1 -1
- package/dist/custom-publish.js +40 -3
- package/dist/custom-publish.js.map +1 -1
- package/dist/custom-validation-prompt.d.ts +1 -1
- package/dist/custom-validation-prompt.d.ts.map +1 -1
- package/dist/custom-validation-prompt.js +29 -19
- package/dist/custom-validation-prompt.js.map +1 -1
- package/dist/deduplication/local.d.ts +4 -2
- package/dist/deduplication/local.d.ts.map +1 -1
- package/dist/deduplication/local.js +9 -2
- package/dist/deduplication/local.js.map +1 -1
- package/dist/deduplication/refusal.d.ts.map +1 -1
- package/dist/deduplication/refusal.js +26 -5
- package/dist/deduplication/refusal.js.map +1 -1
- package/dist/deduplication/scan.d.ts +5 -0
- package/dist/deduplication/scan.d.ts.map +1 -1
- package/dist/deduplication/scan.js +24 -7
- package/dist/deduplication/scan.js.map +1 -1
- package/dist/deep-config.d.ts +0 -1
- package/dist/deep-config.d.ts.map +1 -1
- package/dist/deep-config.js +22 -33
- package/dist/deep-config.js.map +1 -1
- package/dist/deep-scan-defaults.d.ts +2 -0
- package/dist/deep-scan-defaults.d.ts.map +1 -1
- package/dist/deep-scan-defaults.js +28 -1
- package/dist/deep-scan-defaults.js.map +1 -1
- package/dist/deep-scan.d.ts +2 -0
- package/dist/deep-scan.d.ts.map +1 -1
- package/dist/deep-scan.js +44 -19
- package/dist/deep-scan.js.map +1 -1
- package/dist/default-severity-rubric.d.ts +1 -1
- package/dist/default-severity-rubric.d.ts.map +1 -1
- package/dist/default-severity-rubric.js +1 -1
- package/dist/default-severity-rubric.js.map +1 -1
- package/dist/endor-findings.d.ts +3 -1
- package/dist/endor-findings.d.ts.map +1 -1
- package/dist/endor-findings.js +86 -45
- package/dist/endor-findings.js.map +1 -1
- package/dist/errors.d.ts +4 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +15 -4
- package/dist/errors.js.map +1 -1
- package/dist/executable-path.d.ts +3 -0
- package/dist/executable-path.d.ts.map +1 -1
- package/dist/executable-path.js +26 -0
- package/dist/executable-path.js.map +1 -1
- package/dist/external-findings-import.d.ts +5 -3
- package/dist/external-findings-import.d.ts.map +1 -1
- package/dist/external-findings-import.js +19 -7
- package/dist/external-findings-import.js.map +1 -1
- package/dist/external-findings-local.d.ts +69 -5
- package/dist/external-findings-local.d.ts.map +1 -1
- package/dist/external-findings-local.js +537 -108
- package/dist/external-findings-local.js.map +1 -1
- package/dist/external-findings-publish.d.ts +13 -6
- package/dist/external-findings-publish.d.ts.map +1 -1
- package/dist/external-findings-publish.js +895 -1142
- package/dist/external-findings-publish.js.map +1 -1
- package/dist/external-findings-read.d.ts +21 -2
- package/dist/external-findings-read.d.ts.map +1 -1
- package/dist/external-findings-read.js +130 -68
- package/dist/external-findings-read.js.map +1 -1
- package/dist/external-findings.d.ts +15 -3
- package/dist/external-findings.d.ts.map +1 -1
- package/dist/external-findings.js +54 -2
- package/dist/external-findings.js.map +1 -1
- package/dist/external-import-contract.d.ts +8 -12
- package/dist/external-import-contract.d.ts.map +1 -1
- package/dist/external-import-contract.js +51 -184
- package/dist/external-import-contract.js.map +1 -1
- package/dist/external-import-models.d.ts +1 -1
- package/dist/external-import-models.d.ts.map +1 -1
- package/dist/external-import-models.js.map +1 -1
- package/dist/feedback.d.ts.map +1 -1
- package/dist/feedback.js +5 -4
- package/dist/feedback.js.map +1 -1
- package/dist/finding-prompt.d.ts +5 -0
- package/dist/finding-prompt.d.ts.map +1 -0
- package/dist/finding-prompt.js +32 -0
- package/dist/finding-prompt.js.map +1 -0
- package/dist/findings-client.d.ts +1 -0
- package/dist/findings-client.d.ts.map +1 -1
- package/dist/findings-client.js +27 -3
- package/dist/findings-client.js.map +1 -1
- package/dist/github-advisories.d.ts.map +1 -1
- package/dist/github-advisories.js +0 -2
- package/dist/github-advisories.js.map +1 -1
- package/dist/github-dependabot-findings.d.ts.map +1 -1
- package/dist/github-dependabot-findings.js +18 -8
- package/dist/github-dependabot-findings.js.map +1 -1
- package/dist/github-findings.d.ts +4 -1
- package/dist/github-findings.d.ts.map +1 -1
- package/dist/github-findings.js +73 -316
- package/dist/github-findings.js.map +1 -1
- package/dist/hosted-git-remotes.d.ts +5 -0
- package/dist/hosted-git-remotes.d.ts.map +1 -0
- package/dist/hosted-git-remotes.js +285 -0
- package/dist/hosted-git-remotes.js.map +1 -0
- package/dist/hosted-git-repository.d.ts +28 -0
- package/dist/hosted-git-repository.d.ts.map +1 -0
- package/dist/hosted-git-repository.js +222 -0
- package/dist/hosted-git-repository.js.map +1 -0
- package/dist/hosted-remediation.d.ts +1 -0
- package/dist/hosted-remediation.d.ts.map +1 -1
- package/dist/hosted-remediation.js +23 -3
- package/dist/hosted-remediation.js.map +1 -1
- package/dist/hosted-scan-protocol.js +2 -2
- package/dist/hosted-scan-protocol.js.map +1 -1
- package/dist/hosted-scan.d.ts.map +1 -1
- package/dist/hosted-scan.js +16 -11
- package/dist/hosted-scan.js.map +1 -1
- package/dist/hosted-scanner-http.d.ts +21 -0
- package/dist/hosted-scanner-http.d.ts.map +1 -0
- package/dist/hosted-scanner-http.js +204 -0
- package/dist/hosted-scanner-http.js.map +1 -0
- package/dist/import-scan.d.ts.map +1 -1
- package/dist/import-scan.js +3 -0
- package/dist/import-scan.js.map +1 -1
- package/dist/index.d.ts +21 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/inspector-findings.d.ts.map +1 -1
- package/dist/inspector-findings.js +52 -86
- package/dist/inspector-findings.js.map +1 -1
- package/dist/knowledge-base.d.ts +1 -1
- package/dist/knowledge-base.d.ts.map +1 -1
- package/dist/knowledge-base.js +102 -32
- package/dist/knowledge-base.js.map +1 -1
- package/dist/linear.d.ts +11 -0
- package/dist/linear.d.ts.map +1 -1
- package/dist/linear.js.map +1 -1
- package/dist/local-git-metadata.d.ts +5 -2
- package/dist/local-git-metadata.d.ts.map +1 -1
- package/dist/local-git-metadata.js +8 -5
- package/dist/local-git-metadata.js.map +1 -1
- package/dist/multiscan.d.ts +10 -4
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +217 -102
- package/dist/multiscan.js.map +1 -1
- package/dist/native-json-findings.d.ts +2 -1
- package/dist/native-json-findings.d.ts.map +1 -1
- package/dist/native-json-findings.js +12 -2
- package/dist/native-json-findings.js.map +1 -1
- package/dist/opengrep-findings.d.ts +5 -2
- package/dist/opengrep-findings.d.ts.map +1 -1
- package/dist/opengrep-findings.js +54 -33
- package/dist/opengrep-findings.js.map +1 -1
- package/dist/operation-telemetry.d.ts +104 -0
- package/dist/operation-telemetry.d.ts.map +1 -0
- package/dist/operation-telemetry.js +293 -0
- package/dist/operation-telemetry.js.map +1 -0
- package/dist/plugin-python-probe.d.ts +4 -0
- package/dist/plugin-python-probe.d.ts.map +1 -0
- package/dist/plugin-python-probe.js +10 -0
- package/dist/plugin-python-probe.js.map +1 -0
- package/dist/private-finding-import.d.ts +99 -9
- package/dist/private-finding-import.d.ts.map +1 -1
- package/dist/private-finding-import.js +116 -152
- package/dist/private-finding-import.js.map +1 -1
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +53 -13
- package/dist/project-config.js.map +1 -1
- package/dist/prompt-files.d.ts +7 -2
- package/dist/prompt-files.d.ts.map +1 -1
- package/dist/prompt-files.js +42 -20
- package/dist/prompt-files.js.map +1 -1
- package/dist/provider-profile.d.ts +1 -1
- package/dist/provider-profile.d.ts.map +1 -1
- package/dist/provider-profile.js +12 -10
- package/dist/provider-profile.js.map +1 -1
- package/dist/publication-telemetry.d.ts +45 -0
- package/dist/publication-telemetry.d.ts.map +1 -0
- package/dist/publication-telemetry.js +50 -0
- package/dist/publication-telemetry.js.map +1 -0
- package/dist/publication.d.ts +1 -1
- package/dist/publication.d.ts.map +1 -1
- package/dist/publication.js.map +1 -1
- package/dist/publish.d.ts +4 -0
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +42 -2
- package/dist/publish.js.map +1 -1
- package/dist/record.d.ts +1 -5
- package/dist/record.d.ts.map +1 -1
- package/dist/record.js +3 -51
- package/dist/record.js.map +1 -1
- package/dist/remediation.d.ts +1 -4
- package/dist/remediation.d.ts.map +1 -1
- package/dist/remediation.js +6 -8
- package/dist/remediation.js.map +1 -1
- package/dist/request-metadata.d.ts +3 -0
- package/dist/request-metadata.d.ts.map +1 -1
- package/dist/request-metadata.js +9 -0
- package/dist/request-metadata.js.map +1 -1
- package/dist/result.d.ts +4 -0
- package/dist/result.d.ts.map +1 -1
- package/dist/result.js +1 -1
- package/dist/result.js.map +1 -1
- package/dist/retry-windows-rename.d.ts +8 -0
- package/dist/retry-windows-rename.d.ts.map +1 -0
- package/dist/retry-windows-rename.js +24 -0
- package/dist/retry-windows-rename.js.map +1 -0
- package/dist/runtime.d.ts +54 -6
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +1084 -256
- package/dist/runtime.js.map +1 -1
- package/dist/saved-scan-bootstrap.d.ts +7 -1
- package/dist/saved-scan-bootstrap.d.ts.map +1 -1
- package/dist/saved-scan-bootstrap.js +269 -114
- package/dist/saved-scan-bootstrap.js.map +1 -1
- package/dist/scan-activity.d.ts.map +1 -1
- package/dist/scan-activity.js +141 -56
- package/dist/scan-activity.js.map +1 -1
- package/dist/scan-archive-path.d.ts +2 -0
- package/dist/scan-archive-path.d.ts.map +1 -0
- package/dist/scan-archive-path.js +5 -0
- package/dist/scan-archive-path.js.map +1 -0
- package/dist/scan-comparison.d.ts +10 -5
- package/dist/scan-comparison.d.ts.map +1 -1
- package/dist/scan-comparison.js +66 -17
- package/dist/scan-comparison.js.map +1 -1
- package/dist/scan-dashboard.d.ts +7 -6
- package/dist/scan-dashboard.d.ts.map +1 -1
- package/dist/scan-dashboard.js +92 -43
- package/dist/scan-dashboard.js.map +1 -1
- package/dist/scan-executor.d.ts +10 -1
- package/dist/scan-executor.d.ts.map +1 -1
- package/dist/scan-executor.js +24 -2
- package/dist/scan-executor.js.map +1 -1
- package/dist/scan-history-renderer.d.ts +1 -0
- package/dist/scan-history-renderer.d.ts.map +1 -1
- package/dist/scan-history-renderer.js +34 -28
- package/dist/scan-history-renderer.js.map +1 -1
- package/dist/scan-logs.d.ts +12 -0
- package/dist/scan-logs.d.ts.map +1 -1
- package/dist/scan-logs.js +131 -78
- package/dist/scan-logs.js.map +1 -1
- package/dist/scan-measurement.d.ts +26 -0
- package/dist/scan-measurement.d.ts.map +1 -0
- package/dist/scan-measurement.js +77 -0
- package/dist/scan-measurement.js.map +1 -0
- package/dist/scan-progress.d.ts +1 -0
- package/dist/scan-progress.d.ts.map +1 -1
- package/dist/scan-progress.js +3 -0
- package/dist/scan-progress.js.map +1 -1
- package/dist/scan-sessions.d.ts.map +1 -1
- package/dist/scan-sessions.js +4 -1
- package/dist/scan-sessions.js.map +1 -1
- package/dist/scan-settings.d.ts +1 -1
- package/dist/scan-settings.d.ts.map +1 -1
- package/dist/scan-settings.js +1 -24
- package/dist/scan-settings.js.map +1 -1
- package/dist/scanner-import.d.ts +25 -13
- package/dist/scanner-import.d.ts.map +1 -1
- package/dist/scanner-import.js +216 -97
- package/dist/scanner-import.js.map +1 -1
- package/dist/scanner-repository-url.d.ts +4 -1
- package/dist/scanner-repository-url.d.ts.map +1 -1
- package/dist/scanner-repository-url.js +10 -6
- package/dist/scanner-repository-url.js.map +1 -1
- package/dist/security-policy.d.ts +1 -1
- package/dist/security-policy.d.ts.map +1 -1
- package/dist/security-policy.js +26 -6
- package/dist/security-policy.js.map +1 -1
- package/dist/semgrep-findings.d.ts +6 -3
- package/dist/semgrep-findings.d.ts.map +1 -1
- package/dist/semgrep-findings.js +72 -42
- package/dist/semgrep-findings.js.map +1 -1
- package/dist/semgrep-guardian-findings.d.ts +38 -0
- package/dist/semgrep-guardian-findings.d.ts.map +1 -0
- package/dist/semgrep-guardian-findings.js +165 -0
- package/dist/semgrep-guardian-findings.js.map +1 -0
- package/dist/semgrep-platform-collector.d.ts +26 -0
- package/dist/semgrep-platform-collector.d.ts.map +1 -0
- package/dist/semgrep-platform-collector.js +108 -0
- package/dist/semgrep-platform-collector.js.map +1 -0
- package/dist/semgrep-platform-findings.d.ts +157 -6
- package/dist/semgrep-platform-findings.d.ts.map +1 -1
- package/dist/semgrep-platform-findings.js +766 -103
- package/dist/semgrep-platform-findings.js.map +1 -1
- package/dist/server/api.d.ts +1 -1
- package/dist/server/api.d.ts.map +1 -1
- package/dist/server/api.js.map +1 -1
- package/dist/server/embedding-tokenizer.cdx.json +33 -0
- package/dist/server/embedding-tokenizer.d.ts +2 -0
- package/dist/server/embedding-tokenizer.d.ts.map +1 -0
- package/dist/server/embedding-tokenizer.js +322 -0
- package/dist/server/embedding-tokenizer.js.map +6 -0
- package/dist/server/embeddings.d.ts +16 -2
- package/dist/server/embeddings.d.ts.map +1 -1
- package/dist/server/embeddings.js +35 -5
- package/dist/server/embeddings.js.map +1 -1
- package/dist/session-lines.d.ts +5 -0
- package/dist/session-lines.d.ts.map +1 -0
- package/dist/session-lines.js +60 -0
- package/dist/session-lines.js.map +1 -0
- package/dist/severity-review.d.ts +3 -1
- package/dist/severity-review.d.ts.map +1 -1
- package/dist/severity-review.js +3 -2
- package/dist/severity-review.js.map +1 -1
- package/dist/skill-authentication.d.ts +1 -0
- package/dist/skill-authentication.d.ts.map +1 -1
- package/dist/skill-authentication.js +1 -0
- package/dist/skill-authentication.js.map +1 -1
- package/dist/snyk-findings.d.ts +9 -2
- package/dist/snyk-findings.d.ts.map +1 -1
- package/dist/snyk-findings.js +90 -70
- package/dist/snyk-findings.js.map +1 -1
- package/dist/snyk-rest-findings.d.ts +59 -0
- package/dist/snyk-rest-findings.d.ts.map +1 -0
- package/dist/snyk-rest-findings.js +879 -0
- package/dist/snyk-rest-findings.js.map +1 -0
- package/dist/snyk-token-origin.d.ts +4 -0
- package/dist/snyk-token-origin.d.ts.map +1 -0
- package/dist/snyk-token-origin.js +82 -0
- package/dist/snyk-token-origin.js.map +1 -0
- package/dist/sonar-collector.d.ts.map +1 -1
- package/dist/sonar-collector.js +0 -3
- package/dist/sonar-collector.js.map +1 -1
- package/dist/sonar-findings.d.ts +1 -1
- package/dist/sonar-findings.d.ts.map +1 -1
- package/dist/sonar-findings.js +2 -4
- package/dist/sonar-findings.js.map +1 -1
- package/dist/sonar-import.d.ts +3 -0
- package/dist/sonar-import.d.ts.map +1 -1
- package/dist/sonar-import.js +30 -34
- package/dist/sonar-import.js.map +1 -1
- package/dist/stored-finding-projection.d.ts +6 -0
- package/dist/stored-finding-projection.d.ts.map +1 -0
- package/dist/stored-finding-projection.js +104 -0
- package/dist/stored-finding-projection.js.map +1 -0
- package/dist/stored-findings-publication.d.ts +23 -0
- package/dist/stored-findings-publication.d.ts.map +1 -0
- package/dist/stored-findings-publication.js +169 -0
- package/dist/stored-findings-publication.js.map +1 -0
- package/dist/target-drift.d.ts +9 -0
- package/dist/target-drift.d.ts.map +1 -0
- package/dist/target-drift.js +27 -0
- package/dist/target-drift.js.map +1 -0
- package/dist/targets.d.ts +8 -1
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +131 -42
- package/dist/targets.js.map +1 -1
- package/dist/tenable-findings.d.ts +6 -0
- package/dist/tenable-findings.d.ts.map +1 -0
- package/dist/tenable-findings.js +122 -0
- package/dist/tenable-findings.js.map +1 -0
- package/dist/terminal-stream.d.ts +13 -0
- package/dist/terminal-stream.d.ts.map +1 -0
- package/dist/terminal-stream.js +35 -0
- package/dist/terminal-stream.js.map +1 -0
- package/dist/trivy-findings.d.ts +19 -0
- package/dist/trivy-findings.d.ts.map +1 -0
- package/dist/trivy-findings.js +424 -0
- package/dist/trivy-findings.js.map +1 -0
- package/dist/trivy-import.d.ts +19 -0
- package/dist/trivy-import.d.ts.map +1 -0
- package/dist/trivy-import.js +151 -0
- package/dist/trivy-import.js.map +1 -0
- package/dist/trusted-executable.d.ts +6 -0
- package/dist/trusted-executable.d.ts.map +1 -1
- package/dist/trusted-executable.js +140 -37
- package/dist/trusted-executable.js.map +1 -1
- package/dist/validation-records.js +1 -1
- package/dist/validation-records.js.map +1 -1
- package/dist/veracode-findings.d.ts +1 -1
- package/dist/veracode-findings.d.ts.map +1 -1
- package/dist/veracode-findings.js +19 -6
- package/dist/veracode-findings.js.map +1 -1
- package/dist/version.d.ts +3 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +184 -32
- package/dist/version.js.map +1 -1
- package/dist/vertex-pricing.d.ts +8 -0
- package/dist/vertex-pricing.d.ts.map +1 -0
- package/dist/vertex-pricing.js +20 -0
- package/dist/vertex-pricing.js.map +1 -0
- package/dist/windows-path.d.ts +1 -0
- package/dist/windows-path.d.ts.map +1 -1
- package/dist/windows-path.js +26 -1
- package/dist/windows-path.js.map +1 -1
- package/dist/wiz-findings.d.ts +6 -2
- package/dist/wiz-findings.d.ts.map +1 -1
- package/dist/wiz-findings.js +65 -89
- package/dist/wiz-findings.js.map +1 -1
- package/docs/classify-severity-records.md +27 -12
- package/docs/cli.md +853 -639
- package/docs/dedupe-records.md +44 -24
- package/docs/findings-service.md +84 -44
- package/docs/hosted-remediation.md +27 -11
- package/docs/hosted-scans.md +50 -42
- package/docs/sdk.md +903 -0
- package/docs/telemetry.md +236 -0
- package/docs/validate-records.md +78 -44
- package/package.json +23 -16
- package/schemas/external-findings.schema.json +4 -1
- package/_bundled_plugin/mcp/helpers.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/helpers.mjs.br.part-001 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-001 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-002 +0 -0
- package/_bundled_plugin/schemas/tools/deep-reducer.schema.json +0 -96
- package/dist/external-imports-feature.d.ts +0 -6
- package/dist/external-imports-feature.d.ts.map +0 -1
- package/dist/external-imports-feature.js +0 -51
- package/dist/external-imports-feature.js.map +0 -1
- package/dist/finding-normalization.d.ts +0 -5
- package/dist/finding-normalization.d.ts.map +0 -1
- package/dist/finding-normalization.js +0 -155
- package/dist/finding-normalization.js.map +0 -1
- package/dist/reader-selection.d.ts +0 -13
- package/dist/reader-selection.d.ts.map +0 -1
- package/dist/reader-selection.js +0 -81
- package/dist/reader-selection.js.map +0 -1
package/dist/errors.js
CHANGED
|
@@ -21,6 +21,8 @@ export class DeduplicationReviewError extends CodexSecurityError {
|
|
|
21
21
|
this.metadata = metadata;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
export class CodexConnectionError extends CodexSecurityError {
|
|
25
|
+
}
|
|
24
26
|
export class ConfigurationError extends CodexSecurityError {
|
|
25
27
|
}
|
|
26
28
|
export class AuthenticationRequiredError extends CodexSecurityError {
|
|
@@ -40,9 +42,11 @@ export class OutputDirectoryError extends CodexSecurityError {
|
|
|
40
42
|
export class OutputDirectoryNotEmptyError extends OutputDirectoryError {
|
|
41
43
|
directory;
|
|
42
44
|
constructor(directory, operation = "scan") {
|
|
43
|
-
super(operation === "
|
|
44
|
-
? `
|
|
45
|
-
:
|
|
45
|
+
super(operation === "component"
|
|
46
|
+
? `Component output directory is not empty: ${directory}. Choose a new or empty directory with --output-dir.`
|
|
47
|
+
: operation === "policy"
|
|
48
|
+
? `Policy output directory is not empty: ${directory}. Choose a new or empty directory.`
|
|
49
|
+
: `Scan output directory is not empty: ${directory}. To keep the existing results and start a new scan, add --archive-existing.`);
|
|
46
50
|
this.directory = directory;
|
|
47
51
|
}
|
|
48
52
|
}
|
|
@@ -51,7 +55,14 @@ export class OutputInsideProtectedRootError extends OutputDirectoryError {
|
|
|
51
55
|
protectedRoot;
|
|
52
56
|
pathKind;
|
|
53
57
|
constructor(outputDirectory, protectedRoot, pathKind = "output") {
|
|
54
|
-
super(
|
|
58
|
+
super(pathKind === "state"
|
|
59
|
+
? [
|
|
60
|
+
"Codex Security state directory must be outside the protected scan root and cannot contain it.",
|
|
61
|
+
` Resolved path: ${outputDirectory}`,
|
|
62
|
+
` Protected root: ${protectedRoot}`,
|
|
63
|
+
"Set CODEX_SECURITY_STATE_DIR to a private directory that does not overlap the protected root. For hosted scans, set stateDirectory on the request.",
|
|
64
|
+
].join("\n")
|
|
65
|
+
: `Scan ${pathKind} directory must be outside the protected scan root: ${outputDirectory}`);
|
|
55
66
|
this.outputDirectory = outputDirectory;
|
|
56
67
|
this.protectedRoot = protectedRoot;
|
|
57
68
|
this.pathKind = pathKind;
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAiB,MAAM,iBAAiB,CAAC;AAE3E,wEAAwE;AACxE,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAmB;IAC7C,OAAO,CACL,MAAM,CAAC,MAAM;QACb,IAAI,YAAY,CAAC,4BAA4B,EAAE,YAAY,CAAC,CAC7D,CAAC;AACJ,CAAC;AAED,kDAAkD;AAClD,MAAM,OAAO,kB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";\n\n/** Returns the original error message without altering its contents. */\nexport function errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\nexport function abortReason(signal: AbortSignal): unknown {\n return (\n signal.reason ??\n new DOMException(\"The operation was aborted.\", \"AbortError\")\n );\n}\n\n/** Base error for Codex Security SDK failures. */\nexport class CodexSecurityError extends Error {\n public constructor(message: string, options?: ErrorOptions) {\n super(message, options);\n this.name = new.target.name;\n }\n}\n\nexport type DeduplicationReviewStage = \"screening\" | \"pair-review\";\nexport type DeduplicationReviewFailureCategory =\n \"validation\" | \"no-submission\" | \"model\" | \"transport\" | \"refusal\";\n\nexport interface DeduplicationReviewFailureMetadata {\n stage: DeduplicationReviewStage;\n model: string;\n category: DeduplicationReviewFailureCategory;\n attempts: number;\n reason: string;\n}\n\nexport class DeduplicationReviewError extends CodexSecurityError {\n public constructor(\n public readonly metadata: Readonly<DeduplicationReviewFailureMetadata>,\n displayReason: string = metadata.reason,\n ) {\n super(\n `Codex did not complete a validated deduplication review. Findings are unchanged; retry the command. Reason: ${displayReason}`,\n );\n }\n}\n\nexport class CodexConnectionError extends CodexSecurityError {}\nexport class ConfigurationError extends CodexSecurityError {}\nexport class AuthenticationRequiredError extends CodexSecurityError {}\nexport class PluginBootstrapError extends CodexSecurityError {}\nexport class LocalPluginBootstrapError extends PluginBootstrapError {}\nexport class PluginPythonUnavailableError extends PluginBootstrapError {}\nexport class SandboxUnavailableError extends CodexSecurityError {}\nexport class InvalidTargetError extends CodexSecurityError {}\nexport class OutputDirectoryError extends CodexSecurityError {}\nexport class OutputDirectoryNotEmptyError extends OutputDirectoryError {\n public constructor(\n public readonly directory: string,\n operation: \"scan\" | \"policy\" | \"component\" = \"scan\",\n ) {\n super(\n operation === \"component\"\n ? `Component output directory is not empty: ${directory}. Choose a new or empty directory with --output-dir.`\n : operation === \"policy\"\n ? `Policy output directory is not empty: ${directory}. Choose a new or empty directory.`\n : `Scan output directory is not empty: ${directory}. To keep the existing results and start a new scan, add --archive-existing.`,\n );\n }\n}\nexport type ProtectedScanPathKind =\n \"output\" | \"state\" | \"temporary\" | \"runtime\";\n\nexport class OutputInsideProtectedRootError extends OutputDirectoryError {\n public constructor(\n public readonly outputDirectory: string,\n public readonly protectedRoot: string,\n public readonly pathKind: ProtectedScanPathKind = \"output\",\n ) {\n super(\n pathKind === \"state\"\n ? [\n \"Codex Security state directory must be outside the protected scan root and cannot contain it.\",\n ` Resolved path: ${outputDirectory}`,\n ` Protected root: ${protectedRoot}`,\n \"Set CODEX_SECURITY_STATE_DIR to a private directory that does not overlap the protected root. For hosted scans, set stateDirectory on the request.\",\n ].join(\"\\n\")\n : `Scan ${pathKind} directory must be outside the protected scan root: ${outputDirectory}`,\n );\n }\n}\nexport class IncompleteScanError extends CodexSecurityError {}\nexport class ContractValidationError extends CodexSecurityError {}\nexport class ScanInterruptedError extends CodexSecurityError {\n public readonly scanDir: string;\n\n public constructor(message: string, scanDir: string, options?: ErrorOptions) {\n super(message, options);\n this.scanDir = scanDir;\n }\n}\n\nexport class ScanCostLimitExceededError extends ScanInterruptedError {\n public readonly maxCostUsd: number;\n public readonly cost: Readonly<ScanCost>;\n\n public constructor(\n maxCostUsd: number,\n cost: Readonly<ScanCost>,\n scanDir: string,\n ) {\n super(\n `Scan stopped: short-context budget baseline ${formatUsd(cost.estimatedUsd)} exceeded the ${formatUsd(maxCostUsd)} limit; estimated cost ${formatScanCost(cost)}; scan output directory: ${scanDir}.`,\n scanDir,\n );\n this.maxCostUsd = maxCostUsd;\n this.cost = cost;\n }\n}\n"]}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export declare function executablePathForSpawn(command: string): string;
|
|
2
|
+
export declare function isExecutableFile(value: string): boolean;
|
|
3
|
+
export declare function isExplicitPathWithTrailingWhitespace(value: string, platform: NodeJS.Platform): boolean;
|
|
4
|
+
export declare function configuredExecutableValue(value: string | undefined, platform: NodeJS.Platform, literalIsExecutable: (value: string) => boolean): string | undefined;
|
|
2
5
|
//# sourceMappingURL=executable-path.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executable-path.d.ts","sourceRoot":"","sources":["../src/executable-path.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"executable-path.d.ts","sourceRoot":"","sources":["../src/executable-path.ts"],"names":[],"mappings":"AAIA,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAQ9D;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAQvD;AAED,wBAAgB,oCAAoC,CAClD,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,CAAC,QAAQ,GACxB,OAAO,CAQT;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAC9C,MAAM,GAAG,SAAS,CAMpB"}
|
package/dist/executable-path.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* Generated from plugin executable-path.ts. Run `pnpm generate:models`. */
|
|
2
|
+
import { accessSync, constants, statSync } from "node:fs";
|
|
2
3
|
import { win32 } from "node:path";
|
|
3
4
|
export function executablePathForSpawn(command) {
|
|
4
5
|
if (process.platform !== "win32" || !win32.isAbsolute(command))
|
|
@@ -9,4 +10,29 @@ export function executablePathForSpawn(command) {
|
|
|
9
10
|
? command
|
|
10
11
|
: win32.toNamespacedPath(command);
|
|
11
12
|
}
|
|
13
|
+
export function isExecutableFile(value) {
|
|
14
|
+
try {
|
|
15
|
+
if (!statSync(value).isFile())
|
|
16
|
+
return false;
|
|
17
|
+
accessSync(value, constants.X_OK);
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function isExplicitPathWithTrailingWhitespace(value, platform) {
|
|
25
|
+
// Bare names keep their usual PATH precedence. Leading padding can change the path's root.
|
|
26
|
+
return (platform !== "win32" &&
|
|
27
|
+
value.includes("/") &&
|
|
28
|
+
value.trimStart() === value &&
|
|
29
|
+
value.trimEnd() !== value);
|
|
30
|
+
}
|
|
31
|
+
export function configuredExecutableValue(value, platform, literalIsExecutable) {
|
|
32
|
+
return value &&
|
|
33
|
+
isExplicitPathWithTrailingWhitespace(value, platform) &&
|
|
34
|
+
literalIsExecutable(value)
|
|
35
|
+
? value
|
|
36
|
+
: value?.trim();
|
|
37
|
+
}
|
|
12
38
|
//# sourceMappingURL=executable-path.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executable-path.js","sourceRoot":"","sources":["../src/executable-path.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC,MAAM,UAAU,sBAAsB,CAAC,OAAe;IACpD,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;QAC5D,OAAO,OAAO,CAAC;IACjB,+EAA+E;IAC/E,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC;IACvC,OAAO,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,GAAG;QAClC,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC","sourcesContent":["/* Generated from plugin executable-path.ts. Run `pnpm generate:models`. */\nimport { win32 } from \"node:path\";\n\nexport function executablePathForSpawn(command: string): string {\n if (process.platform !== \"win32\" || !win32.isAbsolute(command))\n return command;\n // Root-relative paths still depend on the child's drive and working directory.\n const root = win32.parse(command).root;\n return root === \"\\\\\" || root === \"/\"\n ? command\n : win32.toNamespacedPath(command);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"executable-path.js","sourceR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CAAC,KAAK,EAAE,QAAQ,CAAC;QACrD,mBAAmB,CAAC,KAAK,CAAC;QAC1B,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC;AACpB,CAAC","sourcesContent":["/* Generated from plugin executable-path.ts. Run `pnpm generate:models`. */\nimport { accessSync, constants, statSync } from \"node:fs\";\nimport { win32 } from \"node:path\";\n\nexport function executablePathForSpawn(command: string): string {\n if (process.platform !== \"win32\" || !win32.isAbsolute(command))\n return command;\n // Root-relative paths still depend on the child's drive and working directory.\n const root = win32.parse(command).root;\n return root === \"\\\\\" || root === \"/\"\n ? command\n : win32.toNamespacedPath(command);\n}\n\nexport function isExecutableFile(value: string): boolean {\n try {\n if (!statSync(value).isFile()) return false;\n accessSync(value, constants.X_OK);\n return true;\n } catch {\n return false;\n }\n}\n\nexport function isExplicitPathWithTrailingWhitespace(\n value: string,\n platform: NodeJS.Platform,\n): boolean {\n // Bare names keep their usual PATH precedence. Leading padding can change the path's root.\n return (\n platform !== \"win32\" &&\n value.includes(\"/\") &&\n value.trimStart() === value &&\n value.trimEnd() !== value\n );\n}\n\nexport function configuredExecutableValue(\n value: string | undefined,\n platform: NodeJS.Platform,\n literalIsExecutable: (value: string) => boolean,\n): string | undefined {\n return value &&\n isExplicitPathWithTrailingWhitespace(value, platform) &&\n literalIsExecutable(value)\n ? value\n : value?.trim();\n}\n"]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { type LocalExternalImportDependencies } from "./external-findings-local.js";
|
|
1
|
+
import { type ExternalFindingsReaderOptions } from "./external-findings-read.js";
|
|
2
|
+
import { type LocalExternalImportDependencies, type NormalizedLocalImportOptions } from "./external-findings-local.js";
|
|
3
|
+
export interface LocalExternalImportOptions extends Omit<NormalizedLocalImportOptions, "provider">, ExternalFindingsReaderOptions {
|
|
4
|
+
}
|
|
3
5
|
/** Read an installed vendor format and prepare it for the local workbench. */
|
|
4
|
-
export declare function prepareLocalExternalImport(path: string, options:
|
|
6
|
+
export declare function prepareLocalExternalImport(path: string, options: LocalExternalImportOptions, dependencies?: LocalExternalImportDependencies): Promise<import("./external-findings-local.js").PreparedLocalExternalImport>;
|
|
5
7
|
//# sourceMappingURL=external-findings-import.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-findings-import.d.ts","sourceRoot":"","sources":["../src/external-findings-import.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"external-findings-import.d.ts","sourceRoot":"","sources":["../src/external-findings-import.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,6BAA6B,EAEnC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,KAAK,+BAA+B,EACpC,KAAK,4BAA4B,EAClC,MAAM,8BAA8B,CAAC;AAQtC,MAAM,WAAW,0BACf,SACE,IAAI,CAAC,4BAA4B,EAAE,UAAU,CAAC,EAC9C,6BAA6B;CAAG;AAEpC,8EAA8E;AAC9E,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,0BAA0B,EACnC,YAAY,GAAE,+BAAoC,+EA4EnD"}
|
|
@@ -1,28 +1,34 @@
|
|
|
1
|
+
import { stat } from "node:fs/promises";
|
|
2
|
+
import { InvalidTargetError } from "./errors.js";
|
|
1
3
|
import { cloudRepositoryUrlKey, repositoryUrlKey, } from "./external-import-contract.js";
|
|
2
4
|
import { EXTERNAL_FINDINGS_PROVIDERS, readExternalFindings, } from "./external-findings-read.js";
|
|
3
|
-
import { prepareLocalImport, } from "./external-findings-local.js";
|
|
5
|
+
import { distinctSourceRepositories, prepareLocalImport, } from "./external-findings-local.js";
|
|
4
6
|
import { snapshotImportOptions, snapshotSourceRepositories, } from "./external-findings.js";
|
|
7
|
+
import { resolveInputPath } from "./runtime.js";
|
|
5
8
|
import { abortable } from "./targets.js";
|
|
6
|
-
import { requireExternalImports } from "./external-imports-feature.js";
|
|
7
9
|
/** Read an installed vendor format and prepare it for the local workbench. */
|
|
8
10
|
export async function prepareLocalExternalImport(path, options, dependencies = {}) {
|
|
9
11
|
dependencies.signal?.throwIfAborted();
|
|
10
|
-
requireExternalImports(dependencies.environment);
|
|
11
12
|
const settings = snapshotImportOptions(options);
|
|
12
|
-
const readerSources = snapshotSourceRepositories(dependencies.sourceRepositories);
|
|
13
|
-
const
|
|
13
|
+
const readerSources = distinctSourceRepositories(snapshotSourceRepositories(dependencies.sourceRepositories));
|
|
14
|
+
const requested = resolveInputPath(settings.repository, process.cwd(), dependencies.environment);
|
|
15
|
+
const selected = await abortable(() => stat(requested, { bigint: true }).catch(() => null), dependencies.signal);
|
|
16
|
+
const parsed = await abortable(() => readExternalFindings(path, settings, "local", readerSources), dependencies.signal);
|
|
14
17
|
const normalizedOptions = {
|
|
15
18
|
...settings,
|
|
16
19
|
provider: EXTERNAL_FINDINGS_PROVIDERS[settings.provider],
|
|
17
20
|
};
|
|
18
21
|
let sourceRepositories = parsed.sourceRepositories ?? [];
|
|
19
|
-
if (normalizedOptions.provider === "semgrep"
|
|
22
|
+
if (normalizedOptions.provider === "semgrep" &&
|
|
23
|
+
parsed.sourceRepositories &&
|
|
24
|
+
settings.sourceRepositoryUrl) {
|
|
20
25
|
// The Cloud reader allows custom GitHub casing. Local provenance must also
|
|
21
26
|
// agree with the caller's source URL when the checkout has no remote.
|
|
22
27
|
const source = settings.sourceRepositoryUrl;
|
|
23
28
|
const knownGitHub = readerSources.some(({ url, platform }) => platform === "github" &&
|
|
24
29
|
cloudRepositoryUrlKey(url) === cloudRepositoryUrlKey(source));
|
|
25
30
|
const key = knownGitHub ? cloudRepositoryUrlKey : repositoryUrlKey;
|
|
31
|
+
sourceRepositories = distinctSourceRepositories(sourceRepositories);
|
|
26
32
|
for (const reference of sourceRepositories) {
|
|
27
33
|
if (key(reference.url) !== key(source))
|
|
28
34
|
throw new Error("SARIF source repository does not match the declared source repository URL.");
|
|
@@ -37,6 +43,12 @@ export async function prepareLocalExternalImport(path, options, dependencies = {
|
|
|
37
43
|
];
|
|
38
44
|
}
|
|
39
45
|
const { environment, runWorkbench, signal } = dependencies;
|
|
40
|
-
|
|
46
|
+
const prepared = await prepareLocalImport(parsed.findings, normalizedOptions, { environment, runWorkbench, signal }, readerSources, sourceRepositories);
|
|
47
|
+
const destination = await abortable(() => stat(prepared.preview.repository, { bigint: true }), dependencies.signal);
|
|
48
|
+
if (!selected ||
|
|
49
|
+
selected.dev !== destination.dev ||
|
|
50
|
+
selected.ino !== destination.ino)
|
|
51
|
+
throw new InvalidTargetError(`Repository path changed while reading external findings: ${requested}`);
|
|
52
|
+
return prepared;
|
|
41
53
|
}
|
|
42
54
|
//# sourceMappingURL=external-findings-import.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-findings-import.js","sourceRoot":"","sources":["../src/external-findings-import.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"external-findings-import.js","sourceRoot":"","sources":["../src/external-findings-import.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EACL,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,2BAA2B,EAE3B,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,GAGnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAOzC,8EAA8E;AAC9E,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,IAAY,EACZ,OAAmC,EACnC,YAAY,GAAoC,EAAE;IAElD,YAAY,CAAC,MAAM,EAAE,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AClB,CAAC","sourcesContent":["import { stat } from \"node:fs/promises\";\nimport { InvalidTargetError } from \"./errors.js\";\nimport {\n cloudRepositoryUrlKey,\n repositoryUrlKey,\n} from \"./external-import-contract.js\";\nimport {\n EXTERNAL_FINDINGS_PROVIDERS,\n type ExternalFindingsReaderOptions,\n readExternalFindings,\n} from \"./external-findings-read.js\";\nimport {\n distinctSourceRepositories,\n prepareLocalImport,\n type LocalExternalImportDependencies,\n type NormalizedLocalImportOptions,\n} from \"./external-findings-local.js\";\nimport {\n snapshotImportOptions,\n snapshotSourceRepositories,\n} from \"./external-findings.js\";\nimport { resolveInputPath } from \"./runtime.js\";\nimport { abortable } from \"./targets.js\";\n\nexport interface LocalExternalImportOptions\n extends\n Omit<NormalizedLocalImportOptions, \"provider\">,\n ExternalFindingsReaderOptions {}\n\n/** Read an installed vendor format and prepare it for the local workbench. */\nexport async function prepareLocalExternalImport(\n path: string,\n options: LocalExternalImportOptions,\n dependencies: LocalExternalImportDependencies = {},\n) {\n dependencies.signal?.throwIfAborted();\n const settings = snapshotImportOptions(options);\n const readerSources = distinctSourceRepositories(\n snapshotSourceRepositories(dependencies.sourceRepositories),\n );\n const requested = resolveInputPath(\n settings.repository,\n process.cwd(),\n dependencies.environment,\n );\n const selected = await abortable(\n () => stat(requested, { bigint: true }).catch(() => null),\n dependencies.signal,\n );\n const parsed = await abortable(\n () => readExternalFindings(path, settings, \"local\", readerSources),\n dependencies.signal,\n );\n const normalizedOptions = {\n ...settings,\n provider: EXTERNAL_FINDINGS_PROVIDERS[settings.provider],\n };\n let sourceRepositories = parsed.sourceRepositories ?? [];\n if (\n normalizedOptions.provider === \"semgrep\" &&\n parsed.sourceRepositories &&\n settings.sourceRepositoryUrl\n ) {\n // The Cloud reader allows custom GitHub casing. Local provenance must also\n // agree with the caller's source URL when the checkout has no remote.\n const source = settings.sourceRepositoryUrl;\n const knownGitHub = readerSources.some(\n ({ url, platform }) =>\n platform === \"github\" &&\n cloudRepositoryUrlKey(url) === cloudRepositoryUrlKey(source),\n );\n const key = knownGitHub ? cloudRepositoryUrlKey : repositoryUrlKey;\n sourceRepositories = distinctSourceRepositories(sourceRepositories);\n for (const reference of sourceRepositories) {\n if (key(reference.url) !== key(source))\n throw new Error(\n \"SARIF source repository does not match the declared source repository URL.\",\n );\n }\n if (knownGitHub)\n sourceRepositories = [\n { url: source, platform: \"github\" },\n ...sourceRepositories.map((reference) => ({\n ...reference,\n platform: \"github\" as const,\n })),\n ];\n }\n const { environment, runWorkbench, signal } = dependencies;\n const prepared = await prepareLocalImport(\n parsed.findings,\n normalizedOptions,\n { environment, runWorkbench, signal },\n readerSources,\n sourceRepositories,\n );\n const destination = await abortable(\n () => stat(prepared.preview.repository, { bigint: true }),\n dependencies.signal,\n );\n if (\n !selected ||\n selected.dev !== destination.dev ||\n selected.ino !== destination.ino\n )\n throw new InvalidTargetError(\n `Repository path changed while reading external findings: ${requested}`,\n );\n return prepared;\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type ExternalFindings, type ExternalSourceRepository } from "./external-findings.js";
|
|
2
|
-
import type { ExternalFindingEvidence
|
|
2
|
+
import type { ExternalFindingEvidence } from "./external-import-models.js";
|
|
3
3
|
import { runWorkbench } from "./runtime.js";
|
|
4
4
|
/** A scanner source record, independent of a Codex assessment or completed scan. */
|
|
5
5
|
export interface StoredExternalFinding {
|
|
6
6
|
id: string;
|
|
7
7
|
repository: string;
|
|
8
|
-
provider:
|
|
8
|
+
provider: string;
|
|
9
9
|
sourceKey: string;
|
|
10
10
|
sourceFindingId: string;
|
|
11
11
|
evidence: ExternalFindingEvidence;
|
|
@@ -15,14 +15,56 @@ export interface StoredExternalFinding {
|
|
|
15
15
|
version: number;
|
|
16
16
|
createdAt: string;
|
|
17
17
|
updatedAt: string;
|
|
18
|
+
/** Reader context required to publish this version without the original file. */
|
|
19
|
+
provenance?: ExternalFindingProvenance;
|
|
20
|
+
}
|
|
21
|
+
export interface ExternalFindingProvenance {
|
|
22
|
+
sourceRepositories?: ExternalSourceRepository[];
|
|
23
|
+
inspectorProjectMap?: [string, string][];
|
|
24
|
+
}
|
|
25
|
+
export type LocalExternalFindingSelection = {
|
|
26
|
+
repository: string;
|
|
27
|
+
} & ({
|
|
28
|
+
importId: string;
|
|
29
|
+
findings?: never;
|
|
30
|
+
/** Return an empty selection if the import is missing or any pinned version has changed. */
|
|
31
|
+
ifCurrent?: boolean;
|
|
32
|
+
} | {
|
|
33
|
+
findings: readonly Pick<StoredExternalFinding, "id" | "version">[];
|
|
34
|
+
importId?: never;
|
|
35
|
+
});
|
|
36
|
+
export interface SelectedLocalExternalFindings extends Omit<ExternalFindings, "findings"> {
|
|
37
|
+
findings: StoredExternalFinding[];
|
|
38
|
+
}
|
|
39
|
+
export interface StoredExternalImport {
|
|
40
|
+
importId: string;
|
|
41
|
+
createdAt: string;
|
|
42
|
+
provider: string;
|
|
43
|
+
sourceKey: string;
|
|
44
|
+
count: number;
|
|
45
|
+
}
|
|
46
|
+
export interface LocalFindingReceipt {
|
|
47
|
+
id: string;
|
|
48
|
+
version: number;
|
|
49
|
+
receiptId: string;
|
|
50
|
+
outcome: "created" | "updated" | "unchanged" | "private_job";
|
|
51
|
+
cloudFindingId?: string;
|
|
52
|
+
}
|
|
53
|
+
interface CloudFindingDestination {
|
|
54
|
+
cloudApiUrl: string;
|
|
55
|
+
accountId: string;
|
|
56
|
+
destinationId: string;
|
|
57
|
+
}
|
|
58
|
+
export interface StoredFindingPublication extends LocalFindingReceipt, CloudFindingDestination {
|
|
59
|
+
createdAt: string;
|
|
18
60
|
}
|
|
19
61
|
export interface NormalizedLocalImportOptions {
|
|
20
62
|
/** Local checkout or source directory to associate with these records. */
|
|
21
63
|
repository: string;
|
|
22
|
-
provider:
|
|
64
|
+
provider: string;
|
|
23
65
|
/** Stable scanner organization/project/branch namespace across imports. */
|
|
24
66
|
sourceKey: string;
|
|
25
|
-
/**
|
|
67
|
+
/** Verified Git repository URL for readers that bind a finding to a checkout. */
|
|
26
68
|
sourceRepositoryUrl?: string;
|
|
27
69
|
/** Full Inspector project ARNs mapped to independently verified repository URLs. */
|
|
28
70
|
inspectorProjectMap?: ReadonlyMap<string, string>;
|
|
@@ -37,11 +79,13 @@ export interface LocalExternalImportDependencies {
|
|
|
37
79
|
export interface LocalExternalImportPreview extends ExternalFindings {
|
|
38
80
|
repository: string;
|
|
39
81
|
source: {
|
|
40
|
-
provider:
|
|
82
|
+
provider: string;
|
|
41
83
|
source_key: string;
|
|
42
84
|
};
|
|
43
85
|
}
|
|
44
86
|
export interface LocalExternalImportResult {
|
|
87
|
+
/** Present when the import saved a nonempty selection, including unchanged rows. */
|
|
88
|
+
importId?: string;
|
|
45
89
|
repository: string;
|
|
46
90
|
read: number;
|
|
47
91
|
report?: ExternalFindings["report"];
|
|
@@ -67,9 +111,29 @@ export declare function boundSonarWorktree(repository: string, protectedRoots: s
|
|
|
67
111
|
export declare function sonarCheckoutMatchesSource(repository: string, url: string, protectedRoots: readonly string[], environment: NodeJS.ProcessEnv, signal?: AbortSignal): Promise<boolean>;
|
|
68
112
|
/** Prepare scanner evidence without writing state or performing a security assessment. */
|
|
69
113
|
export declare function prepareNormalizedLocalImport(input: ExternalFindings, options: NormalizedLocalImportOptions, dependencies?: LocalExternalImportDependencies): Promise<PreparedLocalExternalImport>;
|
|
114
|
+
export declare function distinctSourceRepositories(sources: readonly ExternalSourceRepository[]): ExternalSourceRepository[];
|
|
70
115
|
/** Read imported source records, including evidence that has not been assessed by Codex. */
|
|
71
116
|
export declare function listLocalExternalFindings(selection: {
|
|
72
117
|
repository: string;
|
|
73
118
|
id?: string;
|
|
74
119
|
}, dependencies?: LocalExternalImportDependencies): Promise<StoredExternalFinding[]>;
|
|
120
|
+
export declare function readLocalExternalFindings(selection: {
|
|
121
|
+
repository: string;
|
|
122
|
+
id?: string;
|
|
123
|
+
}, dependencies: LocalExternalImportDependencies): Promise<{
|
|
124
|
+
repository: string;
|
|
125
|
+
findings: StoredExternalFinding[];
|
|
126
|
+
}>;
|
|
127
|
+
/** Read the precise versions selected by the caller or captured by an earlier import. */
|
|
128
|
+
export declare function selectLocalExternalFindings(selection: LocalExternalFindingSelection, dependencies?: LocalExternalImportDependencies): Promise<SelectedLocalExternalFindings>;
|
|
129
|
+
/** List this checkout's nonempty imports, most recent first. */
|
|
130
|
+
export declare function listLocalExternalImports({ repository }: {
|
|
131
|
+
repository: string;
|
|
132
|
+
}, dependencies?: LocalExternalImportDependencies): Promise<StoredExternalImport[]>;
|
|
133
|
+
/** Read the destination and receipt for each acknowledged finding version. */
|
|
134
|
+
export declare function listLocalFindingPublications({ repository, id }: {
|
|
135
|
+
repository: string;
|
|
136
|
+
id?: string;
|
|
137
|
+
}, dependencies?: LocalExternalImportDependencies): Promise<StoredFindingPublication[]>;
|
|
138
|
+
export {};
|
|
75
139
|
//# sourceMappingURL=external-findings-local.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external-findings-local.d.ts","sourceRoot":"","sources":["../src/external-findings-local.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"external-findings-local.d.ts","sourceRoot":"","sources":["../src/external-findings-local.ts"],"names":[],"mappings":"AA2BA,OAAO,EAQL,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC9B,MAAM,wBAAwB,CAAC;AAOhC,OAAO,KAAK,EACV,uBAAuB,EAExB,MAAM,6BAA6B,CAAC;AA8CrC,OAAO,EAOL,YAAY,EAGb,MAAM,cAAc,CAAC;AAQtB,oFAAoF;AACpF,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,uBAAuB,CAAC;IAClC,UAAU,EAAE;QAAE,KAAK,EAAE,cAAc,CAAA;KAAE,CAAC;IACtC,OAAO,EAAE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