@openai/codex-security 0.8.2 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +201 -178
- package/_bundled_plugin/.app.json +4 -0
- package/_bundled_plugin/.mcp.json +6 -1
- package/_bundled_plugin/examples/completed-scan/findings.json +16 -4
- package/_bundled_plugin/examples/completed-scan/report.md +11 -8
- package/_bundled_plugin/examples/completed-scan/scan-manifest.json +4 -2
- package/_bundled_plugin/mcp/fzstd-LICENSE.txt +21 -0
- package/_bundled_plugin/mcp/helpers.mjs +2 -11
- package/_bundled_plugin/mcp/helpers.mjs.br +0 -0
- package/_bundled_plugin/mcp/native/THIRD_PARTY_NOTICES.txt +3 -210
- package/_bundled_plugin/mcp/native/darwin-arm64/unix.node +0 -0
- package/_bundled_plugin/mcp/native/darwin-x64/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-arm64-gnu/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-arm64-musl/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-x64-gnu/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-x64-musl/unix.node +0 -0
- package/_bundled_plugin/mcp/native/win32-arm64/windows.node +0 -0
- package/_bundled_plugin/mcp/native/win32-x64/windows.node +0 -0
- package/_bundled_plugin/mcp/package.json +1 -0
- package/_bundled_plugin/mcp/permission-profile-preflight.mjs +51 -14
- package/_bundled_plugin/mcp/server.mjs +2 -11
- package/_bundled_plugin/mcp/server.mjs.br +0 -0
- package/_bundled_plugin/mcp/session-decompression.mjs +712 -0
- package/_bundled_plugin/references/artifact-storage.md +1 -1
- package/_bundled_plugin/references/core-scan.md +14 -5
- package/_bundled_plugin/references/default-severity-rubric.md +33 -0
- package/_bundled_plugin/references/final-report.md +5 -3
- package/_bundled_plugin/references/finding-detail-fields.md +19 -18
- package/_bundled_plugin/references/sarif-adapter.md +8 -2
- package/_bundled_plugin/references/scan-artifacts.md +21 -12
- package/_bundled_plugin/references/scan-contract.md +27 -33
- package/_bundled_plugin/references/threat-model.md +1 -0
- package/_bundled_plugin/schemas/tools/scan-draft.schema.json +2 -2
- package/_bundled_plugin/scripts/check_deep_scan_target.py +97 -0
- package/_bundled_plugin/scripts/codex_profile.mjs +7 -1
- package/_bundled_plugin/scripts/deep_scan_config.py +20 -1
- package/_bundled_plugin/scripts/deep_scan_workbench.py +188 -454
- package/_bundled_plugin/scripts/filesystem_identity.py +1 -0
- package/_bundled_plugin/scripts/finalize_scan_contract.py +317 -377
- package/_bundled_plugin/scripts/finding_preview.py +25 -29
- package/_bundled_plugin/scripts/launch_codex_security_mcp +1 -0
- package/_bundled_plugin/scripts/legacy_findings.py +148 -0
- package/_bundled_plugin/scripts/posix_scan_local_files.py +198 -0
- package/_bundled_plugin/scripts/read_codex_session.mjs +21 -0
- package/_bundled_plugin/scripts/report_projection.py +167 -178
- package/_bundled_plugin/scripts/review_state.py +8 -2
- package/_bundled_plugin/scripts/servicenow_avit.py +20 -0
- package/_bundled_plugin/scripts/snapshot_sqlite.py +1 -0
- package/_bundled_plugin/scripts/threat_model_projection.py +22 -26
- package/_bundled_plugin/scripts/validate_scan_contract.py +9 -7
- package/_bundled_plugin/scripts/windows_scan_local_files.py +600 -72
- package/_bundled_plugin/scripts/workbench/__init__.py +1 -1
- package/_bundled_plugin/scripts/workbench/handoff.py +47 -0
- package/_bundled_plugin/scripts/workbench/retained_coverage.py +38 -75
- package/_bundled_plugin/scripts/workbench/retained_records.py +18 -30
- package/_bundled_plugin/scripts/workbench/runtime_toml.py +4 -1
- package/_bundled_plugin/scripts/workbench/saved_coverage.py +152 -248
- package/_bundled_plugin/scripts/workbench/saved_outputs.py +9 -0
- package/_bundled_plugin/scripts/workbench/saved_sources.py +47 -40
- package/_bundled_plugin/scripts/workbench/storage.py +71 -7
- package/_bundled_plugin/scripts/workbench_cli.py +121 -14
- package/_bundled_plugin/scripts/workbench_constants.py +19 -0
- package/_bundled_plugin/scripts/workbench_coverage_receipts.py +3 -3
- package/_bundled_plugin/scripts/workbench_db.py +550 -492
- package/_bundled_plugin/scripts/workbench_feedback.py +8 -7
- package/_bundled_plugin/scripts/workbench_finding_index.py +1 -0
- package/_bundled_plugin/scripts/workbench_finding_workflows.py +90 -4
- package/_bundled_plugin/scripts/workbench_native_indexes.py +29 -33
- package/_bundled_plugin/scripts/workbench_progress.py +10 -1
- package/_bundled_plugin/scripts/workbench_publication.py +14 -10
- package/_bundled_plugin/scripts/workbench_remediation.py +508 -11
- package/_bundled_plugin/scripts/workbench_saved_results.py +132 -77
- package/_bundled_plugin/scripts/workbench_scan_history.py +139 -80
- package/_bundled_plugin/scripts/workbench_scan_start.py +84 -25
- package/_bundled_plugin/scripts/workbench_scan_usage.py +666 -117
- package/_bundled_plugin/scripts/workbench_schema.py +44 -55
- package/_bundled_plugin/scripts/workbench_setup.py +251 -0
- package/_bundled_plugin/scripts/workbench_source_excerpt.py +13 -0
- package/_bundled_plugin/scripts/workbench_source_scopes.py +33 -23
- package/_bundled_plugin/scripts/workbench_target.py +330 -66
- package/_bundled_plugin/scripts/workbench_target_state.py +3 -0
- package/_bundled_plugin/scripts/workbench_validation.py +44 -12
- package/_bundled_plugin/shared/workbench-history-repairs.json +19 -16
- package/_bundled_plugin/shared/workbench-migrations.json +53 -0
- package/_bundled_plugin/skills/attack-path-analysis/SKILL.md +1 -1
- package/_bundled_plugin/skills/attack-path-analysis/references/severity-policy.md +4 -68
- package/_bundled_plugin/skills/check-skills/SKILL.md +43 -0
- package/_bundled_plugin/skills/check-skills/agents/openai.yaml +4 -0
- package/_bundled_plugin/skills/cloud-findings/SKILL.md +6 -4
- package/_bundled_plugin/skills/deep-security-scan/SKILL.md +7 -50
- package/_bundled_plugin/skills/fix-finding/SKILL.md +19 -2
- package/_bundled_plugin/skills/publish-findings/SKILL.md +81 -45
- package/_bundled_plugin/skills/publish-findings/references/checkmarx-import.md +37 -0
- package/_bundled_plugin/skills/publish-findings/references/wiz-import.md +5 -24
- package/_bundled_plugin/skills/publish-findings/scripts/collect_checkmarx.py +464 -0
- package/_bundled_plugin/skills/threat-model-visualize/scripts/build_explorer.py +36 -9
- package/_bundled_plugin/skills/track-findings/SKILL.md +5 -3
- package/_bundled_plugin/skills/triage-finding/references/github-rest-intake.md +22 -68
- package/_bundled_plugin/skills/triage-finding/references/ticket-intake.md +12 -6
- package/dist/api.d.ts +45 -5
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +1144 -411
- package/dist/api.js.map +1 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +10 -7
- package/dist/auth.js.map +1 -1
- package/dist/bedrock-oss-pricing.d.ts +6 -0
- package/dist/bedrock-oss-pricing.d.ts.map +1 -0
- package/dist/bedrock-oss-pricing.js +58 -0
- package/dist/bedrock-oss-pricing.js.map +1 -0
- package/dist/bedrock-pricing.d.ts +15 -0
- package/dist/bedrock-pricing.d.ts.map +1 -0
- package/dist/bedrock-pricing.js +117 -0
- package/dist/bedrock-pricing.js.map +1 -0
- package/dist/blackduck-findings.d.ts +8 -0
- package/dist/blackduck-findings.d.ts.map +1 -0
- package/dist/blackduck-findings.js +320 -0
- package/dist/blackduck-findings.js.map +1 -0
- package/dist/bulk-scan-discovery.d.ts.map +1 -1
- package/dist/bulk-scan-discovery.js +51 -36
- package/dist/bulk-scan-discovery.js.map +1 -1
- package/dist/checkmarx-evidence.d.ts +19 -0
- package/dist/checkmarx-evidence.d.ts.map +1 -0
- package/dist/checkmarx-evidence.js +36 -0
- package/dist/checkmarx-evidence.js.map +1 -0
- package/dist/checkmarx-findings.d.ts +4 -0
- package/dist/checkmarx-findings.d.ts.map +1 -0
- package/dist/checkmarx-findings.js +27 -0
- package/dist/checkmarx-findings.js.map +1 -0
- package/dist/checkmarx-one.d.ts +4 -0
- package/dist/checkmarx-one.d.ts.map +1 -0
- package/dist/checkmarx-one.js +53 -0
- package/dist/checkmarx-one.js.map +1 -0
- package/dist/checkmarx-repository.d.ts +12 -0
- package/dist/checkmarx-repository.d.ts.map +1 -0
- package/dist/checkmarx-repository.js +181 -0
- package/dist/checkmarx-repository.js.map +1 -0
- package/dist/checkmarx-xml.d.ts +12 -0
- package/dist/checkmarx-xml.d.ts.map +1 -0
- package/dist/checkmarx-xml.js +196 -0
- package/dist/checkmarx-xml.js.map +1 -0
- package/dist/classify-severity-records.d.ts +6 -9
- package/dist/classify-severity-records.d.ts.map +1 -1
- package/dist/classify-severity-records.js +9 -21
- package/dist/classify-severity-records.js.map +1 -1
- package/dist/classify-severity.d.ts +4 -1
- package/dist/classify-severity.d.ts.map +1 -1
- package/dist/classify-severity.js +30 -13
- package/dist/classify-severity.js.map +1 -1
- package/dist/cli.d.ts +14 -5
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2112 -1266
- package/dist/cli.js.map +1 -1
- package/dist/cloud-publish.js +2 -2
- package/dist/cloud-publish.js.map +1 -1
- package/dist/codex-prompt.d.ts +2 -0
- package/dist/codex-prompt.d.ts.map +1 -1
- package/dist/codex-prompt.js +6 -0
- package/dist/codex-prompt.js.map +1 -1
- package/dist/component-scan.d.ts +16 -3
- package/dist/component-scan.d.ts.map +1 -1
- package/dist/component-scan.js +32 -6
- package/dist/component-scan.js.map +1 -1
- package/dist/config.d.ts +2 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +221 -65
- package/dist/config.js.map +1 -1
- package/dist/continuum-findings.d.ts +7 -0
- package/dist/continuum-findings.d.ts.map +1 -0
- package/dist/continuum-findings.js +225 -0
- package/dist/continuum-findings.js.map +1 -0
- package/dist/contract-values.d.ts +30 -0
- package/dist/contract-values.d.ts.map +1 -0
- package/dist/contract-values.js +78 -0
- package/dist/contract-values.js.map +1 -0
- package/dist/contract.d.ts +2 -20
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +58 -669
- package/dist/contract.js.map +1 -1
- package/dist/cost-model.d.ts +13 -1
- package/dist/cost-model.d.ts.map +1 -1
- package/dist/cost-model.js +66 -115
- package/dist/cost-model.js.map +1 -1
- package/dist/cost.d.ts +61 -4
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +2560 -100
- package/dist/cost.js.map +1 -1
- package/dist/custom-publish.d.ts +4 -0
- package/dist/custom-publish.d.ts.map +1 -1
- package/dist/custom-publish.js +40 -3
- package/dist/custom-publish.js.map +1 -1
- package/dist/custom-validation-prompt.d.ts +1 -1
- package/dist/custom-validation-prompt.d.ts.map +1 -1
- package/dist/custom-validation-prompt.js +5 -0
- package/dist/custom-validation-prompt.js.map +1 -1
- package/dist/custom-validation.d.ts +2 -0
- package/dist/custom-validation.d.ts.map +1 -1
- package/dist/custom-validation.js +4 -0
- package/dist/custom-validation.js.map +1 -1
- package/dist/deduplication/deduplication-prompts.d.ts +4 -4
- package/dist/deduplication/deduplication-prompts.d.ts.map +1 -1
- package/dist/deduplication/deduplication-prompts.js +2 -2
- package/dist/deduplication/deduplication-prompts.js.map +1 -1
- package/dist/deduplication/deduplication-reviewer.d.ts +14 -11
- package/dist/deduplication/deduplication-reviewer.d.ts.map +1 -1
- package/dist/deduplication/deduplication-reviewer.js +11 -4
- package/dist/deduplication/deduplication-reviewer.js.map +1 -1
- package/dist/deduplication/deduplication.js.map +1 -1
- package/dist/deduplication/finding-schema.d.ts +19 -1
- package/dist/deduplication/finding-schema.d.ts.map +1 -1
- package/dist/deduplication/finding-schema.js +25 -0
- package/dist/deduplication/finding-schema.js.map +1 -1
- package/dist/deduplication/local.d.ts +2 -2
- package/dist/deduplication/local.d.ts.map +1 -1
- package/dist/deduplication/local.js +5 -10
- package/dist/deduplication/local.js.map +1 -1
- package/dist/deduplication/records.d.ts +8 -2
- package/dist/deduplication/records.d.ts.map +1 -1
- package/dist/deduplication/records.js +36 -8
- package/dist/deduplication/records.js.map +1 -1
- package/dist/deduplication/refusal.d.ts.map +1 -1
- package/dist/deduplication/refusal.js +25 -5
- package/dist/deduplication/refusal.js.map +1 -1
- package/dist/deduplication/scan.d.ts +3 -0
- package/dist/deduplication/scan.d.ts.map +1 -1
- package/dist/deduplication/scan.js +1 -1
- package/dist/deduplication/scan.js.map +1 -1
- package/dist/deep-config.d.ts +0 -1
- package/dist/deep-config.d.ts.map +1 -1
- package/dist/deep-config.js +22 -33
- package/dist/deep-config.js.map +1 -1
- package/dist/deep-scan-defaults.d.ts +2 -0
- package/dist/deep-scan-defaults.d.ts.map +1 -1
- package/dist/deep-scan-defaults.js +28 -1
- package/dist/deep-scan-defaults.js.map +1 -1
- package/dist/deep-scan.d.ts +13 -0
- package/dist/deep-scan.d.ts.map +1 -1
- package/dist/deep-scan.js +262 -7
- package/dist/deep-scan.js.map +1 -1
- package/dist/default-severity-rubric.d.ts +1 -2
- package/dist/default-severity-rubric.d.ts.map +1 -1
- package/dist/default-severity-rubric.js +2 -66
- package/dist/default-severity-rubric.js.map +1 -1
- package/dist/endor-findings.d.ts +3 -1
- package/dist/endor-findings.d.ts.map +1 -1
- package/dist/endor-findings.js +108 -80
- package/dist/endor-findings.js.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +9 -2
- package/dist/errors.js.map +1 -1
- package/dist/external-findings-import.d.ts +5 -3
- package/dist/external-findings-import.d.ts.map +1 -1
- package/dist/external-findings-import.js +11 -16
- package/dist/external-findings-import.js.map +1 -1
- package/dist/external-findings-local.d.ts +15 -4
- package/dist/external-findings-local.d.ts.map +1 -1
- package/dist/external-findings-local.js +619 -225
- package/dist/external-findings-local.js.map +1 -1
- package/dist/external-findings-publish.d.ts +20 -6
- package/dist/external-findings-publish.d.ts.map +1 -1
- package/dist/external-findings-publish.js +2356 -308
- package/dist/external-findings-publish.js.map +1 -1
- package/dist/external-findings-read.d.ts +28 -2
- package/dist/external-findings-read.d.ts.map +1 -1
- package/dist/external-findings-read.js +174 -81
- package/dist/external-findings-read.js.map +1 -1
- package/dist/external-findings.d.ts +17 -3
- package/dist/external-findings.d.ts.map +1 -1
- package/dist/external-findings.js +153 -1
- package/dist/external-findings.js.map +1 -1
- package/dist/external-import-contract.d.ts +33 -1
- package/dist/external-import-contract.d.ts.map +1 -1
- package/dist/external-import-contract.js +335 -51
- package/dist/external-import-contract.js.map +1 -1
- package/dist/external-import-models.d.ts +1 -1
- package/dist/external-import-models.d.ts.map +1 -1
- package/dist/external-import-models.js.map +1 -1
- package/dist/feedback.d.ts.map +1 -1
- package/dist/feedback.js +5 -4
- package/dist/feedback.js.map +1 -1
- package/dist/finding-prompt.d.ts +5 -0
- package/dist/finding-prompt.d.ts.map +1 -0
- package/dist/finding-prompt.js +32 -0
- package/dist/finding-prompt.js.map +1 -0
- package/dist/finding-retrieval.d.ts +3 -3
- package/dist/finding-retrieval.d.ts.map +1 -1
- package/dist/finding-retrieval.js.map +1 -1
- package/dist/finding-workflow.d.ts +6 -1
- package/dist/finding-workflow.d.ts.map +1 -1
- package/dist/finding-workflow.js +2 -2
- package/dist/finding-workflow.js.map +1 -1
- package/dist/findings-client.d.ts +1 -0
- package/dist/findings-client.d.ts.map +1 -1
- package/dist/findings-client.js +27 -3
- package/dist/findings-client.js.map +1 -1
- package/dist/git-remote.d.ts +4 -0
- package/dist/git-remote.d.ts.map +1 -1
- package/dist/git-remote.js +20 -0
- package/dist/git-remote.js.map +1 -1
- package/dist/github-advisories.d.ts +3 -12
- package/dist/github-advisories.d.ts.map +1 -1
- package/dist/github-advisories.js +9 -31
- package/dist/github-advisories.js.map +1 -1
- package/dist/github-dependabot-findings.d.ts.map +1 -1
- package/dist/github-dependabot-findings.js +22 -20
- package/dist/github-dependabot-findings.js.map +1 -1
- package/dist/github-findings.d.ts +4 -1
- package/dist/github-findings.d.ts.map +1 -1
- package/dist/github-findings.js +392 -79
- package/dist/github-findings.js.map +1 -1
- package/dist/github.d.ts +17 -7
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +43 -30
- package/dist/github.js.map +1 -1
- package/dist/host-protocol.d.ts +2 -2
- package/dist/host-protocol.d.ts.map +1 -1
- package/dist/host-protocol.js.map +1 -1
- package/dist/host-records-protocol.d.ts +10 -11
- package/dist/host-records-protocol.d.ts.map +1 -1
- package/dist/host-records-protocol.js +69 -9
- package/dist/host-records-protocol.js.map +1 -1
- package/dist/hosted-git-remotes.d.ts +5 -0
- package/dist/hosted-git-remotes.d.ts.map +1 -0
- package/dist/hosted-git-remotes.js +285 -0
- package/dist/hosted-git-remotes.js.map +1 -0
- package/dist/hosted-git-repository.d.ts +28 -0
- package/dist/hosted-git-repository.d.ts.map +1 -0
- package/dist/hosted-git-repository.js +222 -0
- package/dist/hosted-git-repository.js.map +1 -0
- package/dist/hosted-scan-protocol.js +2 -2
- package/dist/hosted-scan-protocol.js.map +1 -1
- package/dist/hosted-scan.d.ts +15 -0
- package/dist/hosted-scan.d.ts.map +1 -1
- package/dist/hosted-scan.js +71 -44
- package/dist/hosted-scan.js.map +1 -1
- package/dist/hosted-scanner-http.d.ts +21 -0
- package/dist/hosted-scanner-http.d.ts.map +1 -0
- package/dist/hosted-scanner-http.js +204 -0
- package/dist/hosted-scanner-http.js.map +1 -0
- package/dist/hosted-scanner-v1.d.ts +6 -0
- package/dist/hosted-scanner-v1.d.ts.map +1 -0
- package/dist/hosted-scanner-v1.js +60 -0
- package/dist/hosted-scanner-v1.js.map +1 -0
- package/dist/import-scan.d.ts.map +1 -1
- package/dist/import-scan.js +3 -0
- package/dist/import-scan.js.map +1 -1
- package/dist/index.d.ts +24 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/inspector-findings.d.ts.map +1 -1
- package/dist/inspector-findings.js +58 -81
- package/dist/inspector-findings.js.map +1 -1
- package/dist/knowledge-base.d.ts.map +1 -1
- package/dist/knowledge-base.js +86 -10
- package/dist/knowledge-base.js.map +1 -1
- package/dist/local-git-metadata.d.ts +5 -0
- package/dist/local-git-metadata.d.ts.map +1 -0
- package/dist/local-git-metadata.js +130 -0
- package/dist/local-git-metadata.js.map +1 -0
- package/dist/multiscan.d.ts +6 -4
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +160 -77
- package/dist/multiscan.js.map +1 -1
- package/dist/native-json-findings.d.ts +2 -1
- package/dist/native-json-findings.d.ts.map +1 -1
- package/dist/native-json-findings.js +12 -2
- package/dist/native-json-findings.js.map +1 -1
- package/dist/opengrep-findings.d.ts +1 -0
- package/dist/opengrep-findings.d.ts.map +1 -1
- package/dist/opengrep-findings.js +49 -31
- package/dist/opengrep-findings.js.map +1 -1
- package/dist/operation-telemetry.d.ts +104 -0
- package/dist/operation-telemetry.d.ts.map +1 -0
- package/dist/operation-telemetry.js +293 -0
- package/dist/operation-telemetry.js.map +1 -0
- package/dist/patch-tui.d.ts.map +1 -1
- package/dist/patch-tui.js +90 -35
- package/dist/patch-tui.js.map +1 -1
- package/dist/plugin-python-probe.d.ts +4 -0
- package/dist/plugin-python-probe.d.ts.map +1 -0
- package/dist/plugin-python-probe.js +10 -0
- package/dist/plugin-python-probe.js.map +1 -0
- package/dist/private-finding-import.d.ts +341 -0
- package/dist/private-finding-import.d.ts.map +1 -0
- package/dist/private-finding-import.js +411 -0
- package/dist/private-finding-import.js.map +1 -0
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +2 -2
- package/dist/project-config.js.map +1 -1
- package/dist/provider-profile.d.ts +11 -3
- package/dist/provider-profile.d.ts.map +1 -1
- package/dist/provider-profile.js +80 -11
- package/dist/provider-profile.js.map +1 -1
- package/dist/publication-telemetry.d.ts +45 -0
- package/dist/publication-telemetry.d.ts.map +1 -0
- package/dist/publication-telemetry.js +50 -0
- package/dist/publication-telemetry.js.map +1 -0
- package/dist/publication.js +7 -1
- package/dist/publication.js.map +1 -1
- package/dist/publish.d.ts +4 -0
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +42 -2
- package/dist/publish.js.map +1 -1
- package/dist/reader-selection.d.ts +15 -0
- package/dist/reader-selection.d.ts.map +1 -0
- package/dist/reader-selection.js +89 -0
- package/dist/reader-selection.js.map +1 -0
- package/dist/record.d.ts +6 -1
- package/dist/record.d.ts.map +1 -1
- package/dist/record.js +53 -2
- package/dist/record.js.map +1 -1
- package/dist/remediation.d.ts +3 -1
- package/dist/remediation.d.ts.map +1 -1
- package/dist/remediation.js +28 -2
- package/dist/remediation.js.map +1 -1
- package/dist/request-metadata.d.ts +3 -0
- package/dist/request-metadata.d.ts.map +1 -1
- package/dist/request-metadata.js +9 -0
- package/dist/request-metadata.js.map +1 -1
- package/dist/result.d.ts +6 -0
- package/dist/result.d.ts.map +1 -1
- package/dist/result.js +3 -1
- package/dist/result.js.map +1 -1
- package/dist/retry-windows-rename.d.ts +8 -0
- package/dist/retry-windows-rename.d.ts.map +1 -0
- package/dist/retry-windows-rename.js +24 -0
- package/dist/retry-windows-rename.js.map +1 -0
- package/dist/runtime.d.ts +22 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +408 -162
- package/dist/runtime.js.map +1 -1
- package/dist/saved-scan-bootstrap.d.ts +1 -0
- package/dist/saved-scan-bootstrap.d.ts.map +1 -1
- package/dist/saved-scan-bootstrap.js +18 -15
- package/dist/saved-scan-bootstrap.js.map +1 -1
- package/dist/scan-activity.d.ts.map +1 -1
- package/dist/scan-activity.js +172 -64
- package/dist/scan-activity.js.map +1 -1
- package/dist/scan-comparison.d.ts +10 -5
- package/dist/scan-comparison.d.ts.map +1 -1
- package/dist/scan-comparison.js +68 -25
- package/dist/scan-comparison.js.map +1 -1
- package/dist/scan-dashboard.d.ts +7 -6
- package/dist/scan-dashboard.d.ts.map +1 -1
- package/dist/scan-dashboard.js +91 -79
- package/dist/scan-dashboard.js.map +1 -1
- package/dist/scan-executor.d.ts +12 -1
- package/dist/scan-executor.d.ts.map +1 -1
- package/dist/scan-executor.js +22 -2
- package/dist/scan-executor.js.map +1 -1
- package/dist/scan-history-renderer.d.ts.map +1 -1
- package/dist/scan-history-renderer.js +31 -28
- package/dist/scan-history-renderer.js.map +1 -1
- package/dist/scan-logs.d.ts +12 -0
- package/dist/scan-logs.d.ts.map +1 -1
- package/dist/scan-logs.js +106 -77
- package/dist/scan-logs.js.map +1 -1
- package/dist/scan-measurement.d.ts +26 -0
- package/dist/scan-measurement.d.ts.map +1 -0
- package/dist/scan-measurement.js +77 -0
- package/dist/scan-measurement.js.map +1 -0
- package/dist/scan-progress.d.ts +1 -0
- package/dist/scan-progress.d.ts.map +1 -1
- package/dist/scan-progress.js +3 -0
- package/dist/scan-progress.js.map +1 -1
- package/dist/scan-sessions.d.ts.map +1 -1
- package/dist/scan-sessions.js +4 -1
- package/dist/scan-sessions.js.map +1 -1
- package/dist/scan-settings.d.ts +1 -1
- package/dist/scan-settings.d.ts.map +1 -1
- package/dist/scan-settings.js +1 -24
- package/dist/scan-settings.js.map +1 -1
- package/dist/scanner-import.d.ts +64 -6
- package/dist/scanner-import.d.ts.map +1 -1
- package/dist/scanner-import.js +406 -48
- package/dist/scanner-import.js.map +1 -1
- package/dist/scanner-repository-url.d.ts +17 -0
- package/dist/scanner-repository-url.d.ts.map +1 -0
- package/dist/scanner-repository-url.js +71 -0
- package/dist/scanner-repository-url.js.map +1 -0
- package/dist/security-policy.d.ts +1 -1
- package/dist/security-policy.d.ts.map +1 -1
- package/dist/security-policy.js.map +1 -1
- package/dist/semgrep-findings.d.ts +6 -3
- package/dist/semgrep-findings.d.ts.map +1 -1
- package/dist/semgrep-findings.js +124 -88
- package/dist/semgrep-findings.js.map +1 -1
- package/dist/semgrep-guardian-findings.d.ts +38 -0
- package/dist/semgrep-guardian-findings.d.ts.map +1 -0
- package/dist/semgrep-guardian-findings.js +165 -0
- package/dist/semgrep-guardian-findings.js.map +1 -0
- package/dist/semgrep-platform-collector.d.ts +26 -0
- package/dist/semgrep-platform-collector.d.ts.map +1 -0
- package/dist/semgrep-platform-collector.js +108 -0
- package/dist/semgrep-platform-collector.js.map +1 -0
- package/dist/semgrep-platform-findings.d.ts +213 -0
- package/dist/semgrep-platform-findings.d.ts.map +1 -0
- package/dist/semgrep-platform-findings.js +1078 -0
- package/dist/semgrep-platform-findings.js.map +1 -0
- package/dist/semgrep-platform-v1.d.ts +6 -0
- package/dist/semgrep-platform-v1.d.ts.map +1 -0
- package/dist/semgrep-platform-v1.js +83 -0
- package/dist/semgrep-platform-v1.js.map +1 -0
- package/dist/server/api.d.ts +1 -1
- package/dist/server/api.d.ts.map +1 -1
- package/dist/server/api.js.map +1 -1
- package/dist/server/embedding-tokenizer.cdx.json +33 -0
- package/dist/server/embedding-tokenizer.d.ts +2 -0
- package/dist/server/embedding-tokenizer.d.ts.map +1 -0
- package/dist/server/embedding-tokenizer.js +322 -0
- package/dist/server/embedding-tokenizer.js.map +6 -0
- package/dist/server/embeddings.d.ts +16 -2
- package/dist/server/embeddings.d.ts.map +1 -1
- package/dist/server/embeddings.js +35 -5
- package/dist/server/embeddings.js.map +1 -1
- package/dist/session-lines.d.ts +5 -0
- package/dist/session-lines.d.ts.map +1 -0
- package/dist/session-lines.js +60 -0
- package/dist/session-lines.js.map +1 -0
- package/dist/severity-review.d.ts +3 -1
- package/dist/severity-review.d.ts.map +1 -1
- package/dist/severity-review.js +3 -2
- package/dist/severity-review.js.map +1 -1
- package/dist/severity-rubric.d.ts +20 -0
- package/dist/severity-rubric.d.ts.map +1 -0
- package/dist/severity-rubric.js +73 -0
- package/dist/severity-rubric.js.map +1 -0
- package/dist/severity-store.js +15 -5
- package/dist/severity-store.js.map +1 -1
- package/dist/skill-authentication.d.ts +1 -0
- package/dist/skill-authentication.d.ts.map +1 -1
- package/dist/skill-authentication.js +1 -0
- package/dist/skill-authentication.js.map +1 -1
- package/dist/snyk-findings.d.ts +7 -2
- package/dist/snyk-findings.d.ts.map +1 -1
- package/dist/snyk-findings.js +108 -84
- package/dist/snyk-findings.js.map +1 -1
- package/dist/snyk-rest-findings.d.ts +76 -0
- package/dist/snyk-rest-findings.d.ts.map +1 -0
- package/dist/snyk-rest-findings.js +1051 -0
- package/dist/snyk-rest-findings.js.map +1 -0
- package/dist/snyk-rest-v1.d.ts +28 -0
- package/dist/snyk-rest-v1.d.ts.map +1 -0
- package/dist/snyk-rest-v1.js +132 -0
- package/dist/snyk-rest-v1.js.map +1 -0
- package/dist/snyk-token-origin.d.ts +4 -0
- package/dist/snyk-token-origin.d.ts.map +1 -0
- package/dist/snyk-token-origin.js +82 -0
- package/dist/snyk-token-origin.js.map +1 -0
- package/dist/sonar-collector.d.ts +16 -0
- package/dist/sonar-collector.d.ts.map +1 -0
- package/dist/sonar-collector.js +380 -0
- package/dist/sonar-collector.js.map +1 -0
- package/dist/sonar-findings.d.ts +49 -0
- package/dist/sonar-findings.d.ts.map +1 -0
- package/dist/sonar-findings.js +288 -0
- package/dist/sonar-findings.js.map +1 -0
- package/dist/sonar-import.d.ts +111 -0
- package/dist/sonar-import.d.ts.map +1 -0
- package/dist/sonar-import.js +277 -0
- package/dist/sonar-import.js.map +1 -0
- package/dist/suggest-owners.d.ts.map +1 -1
- package/dist/suggest-owners.js +2 -1
- package/dist/suggest-owners.js.map +1 -1
- package/dist/target-drift.d.ts +9 -0
- package/dist/target-drift.d.ts.map +1 -0
- package/dist/target-drift.js +27 -0
- package/dist/target-drift.js.map +1 -0
- package/dist/targets.d.ts +5 -0
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +73 -31
- package/dist/targets.js.map +1 -1
- package/dist/tenable-findings.d.ts +9 -0
- package/dist/tenable-findings.d.ts.map +1 -0
- package/dist/tenable-findings.js +122 -0
- package/dist/tenable-findings.js.map +1 -0
- package/dist/terminal-columns.d.ts +4 -0
- package/dist/terminal-columns.d.ts.map +1 -0
- package/dist/terminal-columns.js +19 -0
- package/dist/terminal-columns.js.map +1 -0
- package/dist/terminal-stream.d.ts +13 -0
- package/dist/terminal-stream.d.ts.map +1 -0
- package/dist/terminal-stream.js +35 -0
- package/dist/terminal-stream.js.map +1 -0
- package/dist/trivy-findings.d.ts +19 -0
- package/dist/trivy-findings.d.ts.map +1 -0
- package/dist/trivy-findings.js +435 -0
- package/dist/trivy-findings.js.map +1 -0
- package/dist/trivy-import.d.ts +19 -0
- package/dist/trivy-import.d.ts.map +1 -0
- package/dist/trivy-import.js +151 -0
- package/dist/trivy-import.js.map +1 -0
- package/dist/validation-records.d.ts +0 -3
- package/dist/validation-records.d.ts.map +1 -1
- package/dist/validation-records.js +1 -17
- package/dist/validation-records.js.map +1 -1
- package/dist/veracode-findings.d.ts +9 -0
- package/dist/veracode-findings.d.ts.map +1 -0
- package/dist/veracode-findings.js +409 -0
- package/dist/veracode-findings.js.map +1 -0
- package/dist/vertex-pricing.d.ts +8 -0
- package/dist/vertex-pricing.d.ts.map +1 -0
- package/dist/vertex-pricing.js +20 -0
- package/dist/vertex-pricing.js.map +1 -0
- package/dist/windows-path.d.ts +1 -0
- package/dist/windows-path.d.ts.map +1 -1
- package/dist/windows-path.js +27 -1
- package/dist/windows-path.js.map +1 -1
- package/dist/wiz-csv.d.ts +2 -2
- package/dist/wiz-csv.d.ts.map +1 -1
- package/dist/wiz-csv.js +1 -3
- package/dist/wiz-csv.js.map +1 -1
- package/dist/wiz-findings.d.ts +14 -2
- package/dist/wiz-findings.d.ts.map +1 -1
- package/dist/wiz-findings.js +143 -50
- package/dist/wiz-findings.js.map +1 -1
- package/docs/classify-severity-records.md +28 -13
- package/docs/cli.md +623 -843
- package/docs/dedupe-records.md +54 -24
- package/docs/findings-service.md +87 -47
- package/docs/hosted-remediation.md +14 -7
- package/docs/hosted-scans.md +64 -41
- package/docs/telemetry.md +236 -0
- package/docs/validate-records.md +78 -44
- package/package.json +19 -17
- package/schemas/external-findings.schema.json +14 -1
- package/schemas/hosted-scan-v2.fixture.json +16 -1
- package/_bundled_plugin/mcp/helpers.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/helpers.mjs.br.part-001 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-001 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-002 +0 -0
- package/_bundled_plugin/schemas/tools/deep-reducer.schema.json +0 -96
- package/_bundled_plugin/scripts/validate_tracking_source.py +0 -82
- package/_bundled_plugin/scripts/workbench_local_dedupe.py +0 -136
- package/dist/deduplication/records-protocol.d.ts +0 -4
- package/dist/deduplication/records-protocol.d.ts.map +0 -1
- package/dist/deduplication/records-protocol.js +0 -49
- package/dist/deduplication/records-protocol.js.map +0 -1
- package/dist/external-imports-feature.d.ts +0 -6
- package/dist/external-imports-feature.d.ts.map +0 -1
- package/dist/external-imports-feature.js +0 -51
- package/dist/external-imports-feature.js.map +0 -1
- package/dist/finding-normalization.d.ts +0 -5
- package/dist/finding-normalization.d.ts.map +0 -1
- package/dist/finding-normalization.js +0 -120
- package/dist/finding-normalization.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated from the plugin
|
|
1
|
+
// Generated from the plugin Deep Scan defaults and settings. Run pnpm build.
|
|
2
2
|
export const DEFAULT_DEEP_SCAN_SETTINGS = {
|
|
3
3
|
workers: 4,
|
|
4
4
|
subagents: 3,
|
|
@@ -7,4 +7,31 @@ export const DEFAULT_DEEP_SCAN_SETTINGS = {
|
|
|
7
7
|
maxDiscoveryRuns: 40,
|
|
8
8
|
maxTimeHours: 96,
|
|
9
9
|
};
|
|
10
|
+
// SDK name, legacy TOML key, project key, and CLI flag (when exposed).
|
|
11
|
+
export const DEEP_SCAN_SETTINGS = [
|
|
12
|
+
["workers", "workers", "workers", "--workers"],
|
|
13
|
+
["subagents", "subagents", "subagents_per_worker", "--subagents"],
|
|
14
|
+
[
|
|
15
|
+
"stopAfterNoNew",
|
|
16
|
+
"stop_after_no_new",
|
|
17
|
+
"stop_after_no_new",
|
|
18
|
+
"--stop-after-no-new",
|
|
19
|
+
],
|
|
20
|
+
[
|
|
21
|
+
"stopAfterConsecutiveErrors",
|
|
22
|
+
"stop_after_consecutive_errors",
|
|
23
|
+
"stop_after_consecutive_errors",
|
|
24
|
+
null,
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
"maxDiscoveryRuns",
|
|
28
|
+
"max_discovery_runs",
|
|
29
|
+
"max_discovery_runs",
|
|
30
|
+
"--max-discovery-runs",
|
|
31
|
+
],
|
|
32
|
+
["maxTimeHours", "max_time_hours", "max_time_hours", "--max-time-hours"],
|
|
33
|
+
];
|
|
34
|
+
export function hoursConflict(hours, prior = hours) {
|
|
35
|
+
return Math.abs(prior - hours) > Number.EPSILON * Math.max(prior, hours);
|
|
36
|
+
}
|
|
10
37
|
//# sourceMappingURL=deep-scan-defaults.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deep-scan-defaults.js","sourceRoot":"","sources":["../src/deep-scan-defaults.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"deep-scan-defaults.js","sourceRoot":"","sources":["../src/deep-scan-defaults.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,OAAO,EAAE,CAAC;IACV,SAAS,EAAE,CAAC;IACZ,cAAc,EAAE,CAAC;IACjB,0BAA0B,EAAE,CAAC;IAC7B,gBAAgB,EAAE,EAAE;IACpB,YAAY,EAAE,EAAE;CACR,CAAC;AAEX,uEAAuE;AACvE,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC;IAC9C,CAAC,WAAW,EAAE,WAAW,EAAE,sBAAsB,EAAE,aAAa,CAAC;IACjE;QACE,gBAAgB;QAChB,mBAAmB;QACnB,mBAAmB;QACnB,qBAAqB;KACtB;IACD;QACE,4BAA4B;QAC5B,+BAA+B;QAC/B,+BAA+B;QAC/B,IAAI;KACL;IACD;QACE,kBAAkB;QAClB,oBAAoB;QACpB,oBAAoB;QACpB,sBAAsB;KACvB;IACD,CAAC,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,CAAC;CAChE,CAAC;AAEX,MAAM,UAAU,aAAa,CAAC,KAAa,EAAE,KAAK,GAAG,KAAK;IACxD,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC3E,CAAC","sourcesContent":["// Generated from the plugin Deep Scan defaults and settings. Run pnpm build.\nexport const DEFAULT_DEEP_SCAN_SETTINGS = {\n workers: 4,\n subagents: 3,\n stopAfterNoNew: 4,\n stopAfterConsecutiveErrors: 3,\n maxDiscoveryRuns: 40,\n maxTimeHours: 96,\n} as const;\n\n// SDK name, legacy TOML key, project key, and CLI flag (when exposed).\nexport const DEEP_SCAN_SETTINGS = [\n [\"workers\", \"workers\", \"workers\", \"--workers\"],\n [\"subagents\", \"subagents\", \"subagents_per_worker\", \"--subagents\"],\n [\n \"stopAfterNoNew\",\n \"stop_after_no_new\",\n \"stop_after_no_new\",\n \"--stop-after-no-new\",\n ],\n [\n \"stopAfterConsecutiveErrors\",\n \"stop_after_consecutive_errors\",\n \"stop_after_consecutive_errors\",\n null,\n ],\n [\n \"maxDiscoveryRuns\",\n \"max_discovery_runs\",\n \"max_discovery_runs\",\n \"--max-discovery-runs\",\n ],\n [\"maxTimeHours\", \"max_time_hours\", \"max_time_hours\", \"--max-time-hours\"],\n] as const;\n\nexport function hoursConflict(hours: number, prior = hours) {\n return Math.abs(prior - hours) > Number.EPSILON * Math.max(prior, hours);\n}\n"]}
|
package/dist/deep-scan.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { CodexOptions } from "@openai/codex-sdk";
|
|
2
|
+
import { type JsonObject } from "./config.js";
|
|
2
3
|
import { type CodexCommand } from "./runtime.js";
|
|
4
|
+
export type DeepScanDiagnostic = Readonly<Record<string, string | number>>;
|
|
3
5
|
export interface DirectDeepScanOptions {
|
|
6
|
+
onDiagnostic?: (event: DeepScanDiagnostic) => void;
|
|
4
7
|
codexOptions: CodexOptions & {
|
|
5
8
|
nativeProfile?: string;
|
|
6
9
|
};
|
|
@@ -12,6 +15,16 @@ export interface DirectDeepScanOptions {
|
|
|
12
15
|
prompt: string;
|
|
13
16
|
signal: AbortSignal;
|
|
14
17
|
}
|
|
18
|
+
/** Read the same native layers and CLI overrides as the parent before adding its tool. */
|
|
19
|
+
export declare function readDeepScanParentConfig(options: Pick<DirectDeepScanOptions, "codexOptions" | "preflightCommand" | "scanDir" | "signal"> & {
|
|
20
|
+
plugin?: {
|
|
21
|
+
marketplacePath: string;
|
|
22
|
+
pluginName: string;
|
|
23
|
+
};
|
|
24
|
+
pluginServers?: Record<string, unknown>;
|
|
25
|
+
}): Promise<JsonObject | undefined>;
|
|
26
|
+
/** Keep direct dispatch scoped to the original SDK coordinator turn and MCP server. */
|
|
27
|
+
export declare function deepScanParentToolOverrides(config: JsonObject, pluginServers: Record<string, unknown>): string[];
|
|
15
28
|
export declare const DIRECT_DEEP_SCAN_CONTROL_USAGE: {
|
|
16
29
|
readonly input_tokens: 0;
|
|
17
30
|
readonly cached_input_tokens: 0;
|
package/dist/deep-scan.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deep-scan.d.ts","sourceRoot":"","sources":["../src/deep-scan.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deep-scan.d.ts","sourceRoot":"","sources":["../src/deep-scan.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOtD,OAAO,EAGL,KAAK,UAAU,EAEhB,MAAM,aAAa,CAAC;AAErB,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AAQtB,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;AAE3E,MAAM,WAAW,qBAAqB;IACpC,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACnD,YAAY,EA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9
|
import { spawn } from "node:child_process";
|
|
10
|
-
import {
|
|
10
|
+
import { realpathSync } from "node:fs";
|
|
11
|
+
import { join, resolve } from "node:path";
|
|
11
12
|
import { pathToFileURL } from "node:url";
|
|
12
|
-
import {
|
|
13
|
+
import { parse } from "smol-toml";
|
|
14
|
+
import { bundledCodexSdkEnvironment, resolveBundledCodexExecutable, } from "./codex-sdk-environment.js";
|
|
13
15
|
import { CodexSecurityError } from "./errors.js";
|
|
14
|
-
import {
|
|
16
|
+
import { deepMerge, inlineToml, } from "./config.js";
|
|
17
|
+
import { isRecord } from "./record.js";
|
|
18
|
+
import { executablePathForSpawn, isDisconnectedChildStdin, PLUGIN_NAME, runCodexCommand, } from "./runtime.js";
|
|
15
19
|
import { resolveTrustedExecutable } from "./trusted-executable.js";
|
|
16
|
-
import { withCodexPreflightLock } from "./provider-profile.js";
|
|
20
|
+
import { nativePermissionPreflight, nativeProfileClient, withCodexPreflightLock, } from "./provider-profile.js";
|
|
21
|
+
// The stock SDK emits one flag per leaf, including literal dotted keys in order.
|
|
22
|
+
function sdkConfigFlags(config, prefix = "") {
|
|
23
|
+
return Object.entries(config).flatMap(([key, value]) => {
|
|
24
|
+
const path = prefix ? `${prefix}.${key}` : key;
|
|
25
|
+
return isRecord(value) && Object.keys(value).length
|
|
26
|
+
? sdkConfigFlags(value, path)
|
|
27
|
+
: [`${path}=${inlineToml(value)}`];
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
// An older custom launcher must start in the caller's directory. Only use
|
|
31
|
+
// supplied routing when its app-server cannot read the scan at startup.
|
|
32
|
+
function suppliedParentRouting(overrides) {
|
|
33
|
+
try {
|
|
34
|
+
const config = Object.create(null);
|
|
35
|
+
for (const override of overrides) {
|
|
36
|
+
const equals = override.indexOf("=");
|
|
37
|
+
const key = override.slice(0, equals).trim();
|
|
38
|
+
if (!/^(?:features|mcp_servers)(?:\.|$)/u.test(key))
|
|
39
|
+
continue;
|
|
40
|
+
const path = key.split(".");
|
|
41
|
+
const leaf = path.pop();
|
|
42
|
+
let table = config;
|
|
43
|
+
for (const part of path) {
|
|
44
|
+
const next = Object.hasOwn(table, part) ? table[part] : undefined;
|
|
45
|
+
const child = table === config["features"] && part === "code_mode"
|
|
46
|
+
? codeModeTable(next)
|
|
47
|
+
: next;
|
|
48
|
+
table = table[part] = Object.assign(Object.create(null), isRecord(child) ? child : {});
|
|
49
|
+
}
|
|
50
|
+
const value = parse(`value=${override.slice(equals + 1)}`)["value"];
|
|
51
|
+
const priorMode = key === "features.code_mode" ? codeModeTable(table[leaf]) : undefined;
|
|
52
|
+
const newMode = priorMode && codeModeTable(value);
|
|
53
|
+
table[leaf] =
|
|
54
|
+
priorMode && newMode ? deepMerge({ ...priorMode }, newMode) : value;
|
|
55
|
+
}
|
|
56
|
+
const servers = config["mcp_servers"];
|
|
57
|
+
const owner = isRecord(servers) ? servers[PLUGIN_NAME] : undefined;
|
|
58
|
+
// Even a supplied transport can inherit a machine-level direct opt-out.
|
|
59
|
+
if (isRecord(owner) && !Array.isArray(owner["omit_tools_from"]))
|
|
60
|
+
return;
|
|
61
|
+
return config;
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// Leave malformed settings for exec's own parser.
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Codex merges a structured Code Mode setting with its boolean shorthand.
|
|
69
|
+
function codeModeTable(value) {
|
|
70
|
+
if (typeof value === "boolean")
|
|
71
|
+
return { enabled: value };
|
|
72
|
+
return isRecord(value) ? value : undefined;
|
|
73
|
+
}
|
|
74
|
+
/** Read the same native layers and CLI overrides as the parent before adding its tool. */
|
|
75
|
+
export async function readDeepScanParentConfig(options) {
|
|
76
|
+
const { codexOptions, preflightCommand: command } = options;
|
|
77
|
+
const config = codexOptions.config ?? {};
|
|
78
|
+
// The provider-profile launcher emits whole top-level tables instead.
|
|
79
|
+
const overrides = codexOptions.nativeProfile === undefined
|
|
80
|
+
? sdkConfigFlags(config)
|
|
81
|
+
: (await nativeProfileClient()).profileConfigOverrides(config);
|
|
82
|
+
const environment = bundledCodexSdkEnvironment(command.command, {
|
|
83
|
+
...codexOptions.env,
|
|
84
|
+
...(codexOptions.apiKey === undefined
|
|
85
|
+
? {}
|
|
86
|
+
: { CODEX_API_KEY: codexOptions.apiKey }),
|
|
87
|
+
});
|
|
88
|
+
const configOverrides = [
|
|
89
|
+
...overrides,
|
|
90
|
+
...(codexOptions.configOverrides ?? []),
|
|
91
|
+
];
|
|
92
|
+
// Subcommand help does not load a project. A global --cd is ignored by
|
|
93
|
+
// older app-servers, so require support on the subcommand itself.
|
|
94
|
+
const help = await runCodexCommand(command, ["app-server", "--cd", options.scanDir, "--help"], environment, undefined, options.signal);
|
|
95
|
+
const supportsCd = help.success && /^\s*(?:-C,\s*)?--cd\s+<[^>\n]+>/mu.test(help.stdout);
|
|
96
|
+
if (!supportsCd) {
|
|
97
|
+
// The bundled command is the native executable itself. A custom launcher
|
|
98
|
+
// can use its own working directory to resolve scripts and other inputs.
|
|
99
|
+
if (resolve(options.scanDir) !== process.cwd() &&
|
|
100
|
+
!isBundledExecutable(command.command))
|
|
101
|
+
return options.plugin
|
|
102
|
+
? undefined
|
|
103
|
+
: suppliedParentRouting(configOverrides);
|
|
104
|
+
if (environment["CODEX_HOME"])
|
|
105
|
+
environment["CODEX_HOME"] = resolve(environment["CODEX_HOME"]);
|
|
106
|
+
}
|
|
107
|
+
const native = await nativePermissionPreflight();
|
|
108
|
+
return withCodexPreflightLock(environment, options.signal, () => native.readDeepScanRuntimeConfig({
|
|
109
|
+
codexPath: command.command,
|
|
110
|
+
commandArgs: command.args,
|
|
111
|
+
cwd: supportsCd ? process.cwd() : options.scanDir,
|
|
112
|
+
...(supportsCd && { configCwd: options.scanDir }),
|
|
113
|
+
configOverrides,
|
|
114
|
+
env: environment,
|
|
115
|
+
signal: options.signal,
|
|
116
|
+
context: "parent-config",
|
|
117
|
+
plugin: options.plugin,
|
|
118
|
+
}, (config, hasEmptyCatalog) => inspectFilteredPeers(config, options.pluginServers, hasEmptyCatalog)));
|
|
119
|
+
}
|
|
120
|
+
function isBundledExecutable(command) {
|
|
121
|
+
try {
|
|
122
|
+
return (realpathSync.native(command) ===
|
|
123
|
+
realpathSync.native(resolveBundledCodexExecutable()));
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return false; // An installation may supply only an external launcher.
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async function inspectFilteredPeers(config, pluginServers, hasEmptyCatalog) {
|
|
130
|
+
const configured = isRecord(config["mcp_servers"])
|
|
131
|
+
? config["mcp_servers"]
|
|
132
|
+
: {};
|
|
133
|
+
const owner = configured[PLUGIN_NAME];
|
|
134
|
+
if (isRecord(owner) &&
|
|
135
|
+
(owner["command"] ||
|
|
136
|
+
owner["url"] ||
|
|
137
|
+
Array.isArray(owner["omit_tools_from"])))
|
|
138
|
+
return config;
|
|
139
|
+
const servers = { ...pluginServers, ...configured };
|
|
140
|
+
const registration = servers[PLUGIN_NAME];
|
|
141
|
+
if (!isRecord(registration) || registration["enabled"] === false)
|
|
142
|
+
return config;
|
|
143
|
+
const routing = { ...configured };
|
|
144
|
+
for (const [name, settings] of Object.entries(servers)) {
|
|
145
|
+
if (name === PLUGIN_NAME ||
|
|
146
|
+
!isRecord(settings) ||
|
|
147
|
+
settings["enabled"] === false ||
|
|
148
|
+
!["codex_security", "mcp__codex_security"].includes(normalizedServerName(name)))
|
|
149
|
+
continue;
|
|
150
|
+
if (![settings["enabled_tools"], settings["disabled_tools"]].some((tools) => Array.isArray(tools) && tools.length > 0))
|
|
151
|
+
continue;
|
|
152
|
+
if (await hasEmptyCatalog(name)) {
|
|
153
|
+
// This view is used only to select a namespace. Never change the peer's config.
|
|
154
|
+
routing[name] = { enabled_tools: [] };
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return { ...config, mcp_servers: routing };
|
|
158
|
+
}
|
|
159
|
+
function normalizedServerName(server) {
|
|
160
|
+
return server.replace(/[-.:@/]/gu, "_");
|
|
161
|
+
}
|
|
162
|
+
/** Keep direct dispatch scoped to the original SDK coordinator turn and MCP server. */
|
|
163
|
+
export function deepScanParentToolOverrides(config, pluginServers) {
|
|
164
|
+
const features = config["features"] ?? {};
|
|
165
|
+
if (!isRecord(features))
|
|
166
|
+
return [];
|
|
167
|
+
const mode = features["code_mode"];
|
|
168
|
+
if (mode !== undefined && typeof mode !== "boolean" && !isRecord(mode))
|
|
169
|
+
return [];
|
|
170
|
+
const direct = (isRecord(mode) ? mode["direct_only_tool_namespaces"] : undefined) ?? [];
|
|
171
|
+
if (!Array.isArray(direct))
|
|
172
|
+
return [];
|
|
173
|
+
const owner = PLUGIN_NAME;
|
|
174
|
+
const bare = "codex_security";
|
|
175
|
+
const prefixed = "mcp__codex_security";
|
|
176
|
+
let required = [prefixed, bare];
|
|
177
|
+
const overrides = [];
|
|
178
|
+
const configured = config["mcp_servers"];
|
|
179
|
+
// Native registrations take precedence over the selected plugin's entries.
|
|
180
|
+
const servers = {
|
|
181
|
+
...pluginServers,
|
|
182
|
+
...(isRecord(configured) ? configured : {}),
|
|
183
|
+
};
|
|
184
|
+
const ownerConfig = servers[owner];
|
|
185
|
+
if (!isRecord(ownerConfig) || ownerConfig["enabled"] === false)
|
|
186
|
+
return [];
|
|
187
|
+
const omitted = ownerConfig["omit_tools_from"];
|
|
188
|
+
if (Array.isArray(omitted) && omitted.includes("direct"))
|
|
189
|
+
return [];
|
|
190
|
+
// A raw transport or an existing omission leaf can be updated in place.
|
|
191
|
+
// Adding a new registration would shadow a plugin's transport and policy.
|
|
192
|
+
if (isRecord(configured) &&
|
|
193
|
+
Object.hasOwn(configured, owner) &&
|
|
194
|
+
(Array.isArray(omitted) ||
|
|
195
|
+
typeof ownerConfig["command"] === "string" ||
|
|
196
|
+
typeof ownerConfig["url"] === "string")) {
|
|
197
|
+
if (omitted != null && !Array.isArray(omitted))
|
|
198
|
+
return [];
|
|
199
|
+
const surfaces = omitted ?? [];
|
|
200
|
+
if (surfaces.includes("code_mode") && surfaces.includes("deferred"))
|
|
201
|
+
return [];
|
|
202
|
+
return [
|
|
203
|
+
`mcp_servers.${owner}.omit_tools_from=${inlineToml([...new Set([...surfaces, "code_mode", "deferred"])])}`,
|
|
204
|
+
];
|
|
205
|
+
}
|
|
206
|
+
const option = features["non_prefixed_mcp_tool_names"];
|
|
207
|
+
const enabled = option === true || (isRecord(option) && option["enabled"] === true);
|
|
208
|
+
const selected = isRecord(option) ? option["server_names"] : undefined;
|
|
209
|
+
function namespace(server) {
|
|
210
|
+
const name = normalizedServerName(server);
|
|
211
|
+
const omitPrefix = enabled && (!Array.isArray(selected) || selected.includes(server));
|
|
212
|
+
return omitPrefix || name.startsWith("mcp__") ? name : `mcp__${name}`;
|
|
213
|
+
}
|
|
214
|
+
const occupied = new Set(Object.entries(servers)
|
|
215
|
+
.filter(([server, settings]) => server !== owner &&
|
|
216
|
+
isRecord(settings) &&
|
|
217
|
+
settings["enabled"] !== false &&
|
|
218
|
+
(!Array.isArray(settings["enabled_tools"]) ||
|
|
219
|
+
settings["enabled_tools"].length > 0))
|
|
220
|
+
.map(([server]) => namespace(server)));
|
|
221
|
+
const current = namespace(owner);
|
|
222
|
+
if (occupied.has(current)) {
|
|
223
|
+
const excluded = isRecord(mode) ? mode["excluded_tool_namespaces"] : null;
|
|
224
|
+
const routed = Array.isArray(excluded) ? [...direct, ...excluded] : direct;
|
|
225
|
+
// Moving the owner also renames its peers. Keep names that the caller
|
|
226
|
+
// explicitly routed or excluded from Code Mode.
|
|
227
|
+
if (current === bare ||
|
|
228
|
+
occupied.has(bare) ||
|
|
229
|
+
routed.some((name) => name === current ||
|
|
230
|
+
(typeof name === "string" &&
|
|
231
|
+
/^mcp__codex_security_[0-9a-f]{12}$/u.test(name))) ||
|
|
232
|
+
(option != null && !enabled))
|
|
233
|
+
return [];
|
|
234
|
+
overrides.push(`features.non_prefixed_mcp_tool_names=${inlineToml({
|
|
235
|
+
enabled: true,
|
|
236
|
+
server_names: [...(Array.isArray(selected) ? selected : []), owner],
|
|
237
|
+
})}`);
|
|
238
|
+
required = [bare];
|
|
239
|
+
}
|
|
240
|
+
else if (occupied.has(prefixed) || occupied.has(bare)) {
|
|
241
|
+
required = [current];
|
|
242
|
+
}
|
|
243
|
+
if (!required.every((name) => direct.includes(name))) {
|
|
244
|
+
overrides.push(`features.code_mode.direct_only_tool_namespaces=${inlineToml([...new Set([...direct, ...required])])}`);
|
|
245
|
+
}
|
|
246
|
+
return overrides;
|
|
247
|
+
}
|
|
17
248
|
// The direct coordinator records context but never calls a model itself.
|
|
18
249
|
export const DIRECT_DEEP_SCAN_CONTROL_USAGE = {
|
|
19
250
|
input_tokens: 0,
|
|
@@ -55,7 +286,11 @@ export async function* runDeepScan(options) {
|
|
|
55
286
|
: undefined;
|
|
56
287
|
if (node === null)
|
|
57
288
|
throw new CodexSecurityError("Node.js is not available on PATH.");
|
|
58
|
-
const output = await runEngine(node?.executable ?? process.execPath, [join(options.pluginRoot, "mcp", "server.mjs"), "--deep-scan-engine"], node?.environment ?? environment, JSON.stringify({
|
|
289
|
+
const output = await runEngine(node?.executable ?? process.execPath, [join(options.pluginRoot, "mcp", "server.mjs"), "--deep-scan-engine"], node?.environment ?? environment, JSON.stringify({
|
|
290
|
+
scanId: options.scanId,
|
|
291
|
+
...session,
|
|
292
|
+
...(options.onDiagnostic && { diagnosticsVersion: 1 }),
|
|
293
|
+
}), options.signal, options.onDiagnostic);
|
|
59
294
|
const completed = JSON.parse(output);
|
|
60
295
|
if (completed.scanId !== options.scanId ||
|
|
61
296
|
completed.manifestPath !== join(options.scanDir, "scan-manifest.json")) {
|
|
@@ -68,12 +303,32 @@ export async function* runDeepScan(options) {
|
|
|
68
303
|
usage: { ...DIRECT_DEEP_SCAN_CONTROL_USAGE },
|
|
69
304
|
};
|
|
70
305
|
}
|
|
71
|
-
function runEngine(command, args, env, request, signal) {
|
|
306
|
+
function runEngine(command, args, env, request, signal, onDiagnostic) {
|
|
72
307
|
signal.throwIfAborted();
|
|
73
308
|
const child = spawn(executablePathForSpawn(command), args, {
|
|
74
309
|
env,
|
|
75
310
|
windowsHide: true,
|
|
311
|
+
serialization: "json",
|
|
312
|
+
stdio: onDiagnostic ? ["pipe", "pipe", "pipe", "ipc"] : "pipe",
|
|
76
313
|
});
|
|
314
|
+
if (onDiagnostic) {
|
|
315
|
+
child.on("message", (message) => {
|
|
316
|
+
if (!isRecord(message) || typeof message["event"] !== "string")
|
|
317
|
+
return;
|
|
318
|
+
const fields = {};
|
|
319
|
+
for (const [name, value] of Object.entries(message)) {
|
|
320
|
+
if (/^[a-zA-Z][a-zA-Z0-9]*$/u.test(name) &&
|
|
321
|
+
(typeof value === "number" || typeof value === "string"))
|
|
322
|
+
fields[name] = value;
|
|
323
|
+
}
|
|
324
|
+
try {
|
|
325
|
+
void Promise.resolve(onDiagnostic(fields)).catch(() => { });
|
|
326
|
+
}
|
|
327
|
+
catch {
|
|
328
|
+
// The optional diagnostic sink cannot stop the scan.
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
}
|
|
77
332
|
// EOF requests graceful coordinator/worker cleanup on Windows as well as Unix.
|
|
78
333
|
// Keep the control pipe open until completion or explicit cancellation.
|
|
79
334
|
const cancel = () => child.stdin.end();
|
|
@@ -90,7 +345,7 @@ function runEngine(command, args, env, request, signal) {
|
|
|
90
345
|
processError = error;
|
|
91
346
|
});
|
|
92
347
|
child.stdin.on("error", (error) => {
|
|
93
|
-
if (!
|
|
348
|
+
if (!isDisconnectedChildStdin(error))
|
|
94
349
|
processError = error;
|
|
95
350
|
});
|
|
96
351
|
const result = new Promise((resolve, reject) => {
|
package/dist/deep-scan.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deep-scan.js","sourceRoot":"","sources":["../src/deep-scan.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,I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,CAAC;AAChB,CAAC","sourcesContent":["import { spawn } from \"node:child_process\";\nimport { join } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport type { CodexOptions } from \"@openai/codex-sdk\";\nimport { bundledCodexSdkEnvironment } from \"./codex-sdk-environment.js\";\nimport { CodexSecurityError } from \"./errors.js\";\nimport { executablePathForSpawn, type CodexCommand } from \"./runtime.js\";\nimport { resolveTrustedExecutable } from \"./trusted-executable.js\";\nimport { withCodexPreflightLock } from \"./provider-profile.js\";\n\nexport interface DirectDeepScanOptions {\n codexOptions: CodexOptions & { nativeProfile?: string };\n preflightCommand: CodexCommand;\n pluginRoot: string;\n repository: string;\n scanDir: string;\n scanId: string;\n prompt: string;\n signal: AbortSignal;\n}\n\n// The direct coordinator records context but never calls a model itself.\nexport const DIRECT_DEEP_SCAN_CONTROL_USAGE = {\n input_tokens: 0,\n cached_input_tokens: 0,\n cache_write_input_tokens: 0,\n output_tokens: 0,\n} as const;\n\n/** Run the same coordinator as the plugin, without a parent model turn. */\nexport async function* runDeepScan(\n options: DirectDeepScanOptions,\n): AsyncGenerator<{\n type: string;\n [key: string]: unknown;\n}> {\n const native = await import(\n pathToFileURL(\n join(options.pluginRoot, \"mcp\", \"permission-profile-preflight.mjs\"),\n ).href\n );\n const profile = await import(\n pathToFileURL(join(options.pluginRoot, \"scripts\", \"codex_profile.mjs\")).href\n );\n const configured = options.codexOptions;\n const command = options.preflightCommand;\n const environment = bundledCodexSdkEnvironment(command.command, {\n ...configured.env,\n ...(configured.apiKey === undefined\n ? {}\n : { CODEX_API_KEY: configured.apiKey }),\n });\n const session = (await withCodexPreflightLock(\n environment,\n options.signal,\n () =>\n native.prepareCliDeepScanSession({\n codexPath: command.command,\n commandArgs: command.args,\n cwd: options.scanDir,\n env: environment,\n configOverrides: [\n ...profile.profileConfigOverrides(configured.config ?? {}),\n ...(configured.configOverrides ?? []),\n // This session only records native context; workers keep their own snapshot.\n \"features.plugins=false\",\n ],\n signal: options.signal,\n prompt:\n options.prompt +\n \"\\n\\nThe host runs this Deep Scan coordinator directly and owns finalization. This saved request supplies context for later follow-up; do not start a replacement scan.\",\n }),\n )) as {\n threadId: string;\n model: string;\n reasoningEffort?: string;\n permissionProfile: unknown;\n };\n yield { type: \"thread.started\", thread_id: session.threadId };\n options.signal.throwIfAborted();\n const node = process.versions[\"bun\"]\n ? await resolveTrustedExecutable(\"node\", environment, [options.repository])\n : undefined;\n if (node === null)\n throw new CodexSecurityError(\"Node.js is not available on PATH.\");\n const output = await runEngine(\n node?.executable ?? process.execPath,\n [join(options.pluginRoot, \"mcp\", \"server.mjs\"), \"--deep-scan-engine\"],\n node?.environment ?? environment,\n JSON.stringify({ scanId: options.scanId, ...session }),\n options.signal,\n );\n const completed = JSON.parse(output);\n if (\n completed.scanId !== options.scanId ||\n completed.manifestPath !== join(options.scanDir, \"scan-manifest.json\")\n ) {\n throw new CodexSecurityError(\n \"Deep Scan engine returned results for a different scan.\",\n );\n }\n // The control session makes no model calls. Worker usage is read by the\n // existing scan tracker from the native sessions below this scan directory.\n yield {\n type: \"turn.completed\",\n usage: { ...DIRECT_DEEP_SCAN_CONTROL_USAGE },\n };\n}\n\nfunction runEngine(\n command: string,\n args: string[],\n env: NodeJS.ProcessEnv,\n request: string,\n signal: AbortSignal,\n): Promise<string> {\n signal.throwIfAborted();\n const child = spawn(executablePathForSpawn(command), args, {\n env,\n windowsHide: true,\n });\n // EOF requests graceful coordinator/worker cleanup on Windows as well as Unix.\n // Keep the control pipe open until completion or explicit cancellation.\n const cancel = () => child.stdin.end();\n let stdout = \"\";\n let stderr = \"\";\n let processError: Error | undefined;\n child.stdout.setEncoding(\"utf8\").on(\"data\", (chunk) => {\n stdout += chunk;\n });\n child.stderr.setEncoding(\"utf8\").on(\"data\", (chunk) => {\n stderr += chunk;\n });\n child.once(\"error\", (error) => {\n processError = error;\n });\n child.stdin.on(\"error\", (error: NodeJS.ErrnoException) => {\n if (\n ![\"EPIPE\", \"ECONNRESET\", \"EOF\", \"ERR_STREAM_DESTROYED\"].includes(\n error.code ?? \"\",\n )\n )\n processError = error;\n });\n const result = new Promise<string>((resolve, reject) => {\n child.once(\"close\", (code) => {\n signal.removeEventListener(\"abort\", cancel);\n if (signal.aborted) reject(signal.reason);\n else if (processError) reject(processError);\n else if (code !== 0)\n reject(\n new CodexSecurityError(\n stderr.trim() || `Deep Scan engine exited with code ${code}.`,\n ),\n );\n else resolve(stdout);\n });\n });\n child.stdin.write(request + \"\\n\");\n signal.addEventListener(\"abort\", cancel, { once: true });\n if (signal.aborted) cancel();\n return result;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"deep-scan.js","sourceRoot":"","sources":["../src/deep-scan.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAuC,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EACL,SAAS,EACT,UAAU,GAGX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,WAAW,EACX,eAAe,GAEhB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAgB/B,iFAAiF;AACjF,SAAS,cAAc,CAAC,MAAkB,EAAE,MAAM,GAAG,EAAE;IACrD,OA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C;AAChB,CAAC","sourcesContent":["import { spawn, type ChildProcessWithoutNullStreams } from \"node:child_process\";\nimport { realpathSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport type { CodexOptions } from \"@openai/codex-sdk\";\nimport { parse } from \"smol-toml\";\nimport {\n bundledCodexSdkEnvironment,\n resolveBundledCodexExecutable,\n} from \"./codex-sdk-environment.js\";\nimport { CodexSecurityError } from \"./errors.js\";\nimport {\n deepMerge,\n inlineToml,\n type JsonObject,\n type JsonValue,\n} from \"./config.js\";\nimport { isRecord } from \"./record.js\";\nimport {\n executablePathForSpawn,\n isDisconnectedChildStdin,\n PLUGIN_NAME,\n runCodexCommand,\n type CodexCommand,\n} from \"./runtime.js\";\nimport { resolveTrustedExecutable } from \"./trusted-executable.js\";\nimport {\n nativePermissionPreflight,\n nativeProfileClient,\n withCodexPreflightLock,\n} from \"./provider-profile.js\";\n\nexport type DeepScanDiagnostic = Readonly<Record<string, string | number>>;\n\nexport interface DirectDeepScanOptions {\n onDiagnostic?: (event: DeepScanDiagnostic) => void;\n codexOptions: CodexOptions & { nativeProfile?: string };\n preflightCommand: CodexCommand;\n pluginRoot: string;\n repository: string;\n scanDir: string;\n scanId: string;\n prompt: string;\n signal: AbortSignal;\n}\n\n// The stock SDK emits one flag per leaf, including literal dotted keys in order.\nfunction sdkConfigFlags(config: JsonObject, prefix = \"\"): string[] {\n return Object.entries(config).flatMap(([key, value]) => {\n const path = prefix ? `${prefix}.${key}` : key;\n return isRecord(value) && Object.keys(value).length\n ? sdkConfigFlags(value, path)\n : [`${path}=${inlineToml(value)}`];\n });\n}\n\n// An older custom launcher must start in the caller's directory. Only use\n// supplied routing when its app-server cannot read the scan at startup.\nfunction suppliedParentRouting(\n overrides: readonly string[],\n): JsonObject | undefined {\n try {\n const config: JsonObject = Object.create(null);\n for (const override of overrides) {\n const equals = override.indexOf(\"=\");\n const key = override.slice(0, equals).trim();\n if (!/^(?:features|mcp_servers)(?:\\.|$)/u.test(key)) continue;\n const path = key.split(\".\");\n const leaf = path.pop()!;\n let table = config;\n for (const part of path) {\n const next = Object.hasOwn(table, part) ? table[part] : undefined;\n const child =\n table === config[\"features\"] && part === \"code_mode\"\n ? codeModeTable(next)\n : next;\n table = table[part] = Object.assign(\n Object.create(null),\n isRecord(child) ? child : {},\n );\n }\n const value = parse(`value=${override.slice(equals + 1)}`)[\n \"value\"\n ] as JsonValue;\n const priorMode =\n key === \"features.code_mode\" ? codeModeTable(table[leaf]) : undefined;\n const newMode = priorMode && codeModeTable(value);\n table[leaf] =\n priorMode && newMode ? deepMerge({ ...priorMode }, newMode) : value;\n }\n const servers = config[\"mcp_servers\"];\n const owner = isRecord(servers) ? servers[PLUGIN_NAME] : undefined;\n // Even a supplied transport can inherit a machine-level direct opt-out.\n if (isRecord(owner) && !Array.isArray(owner[\"omit_tools_from\"])) return;\n return config;\n } catch {\n // Leave malformed settings for exec's own parser.\n return undefined;\n }\n}\n\n// Codex merges a structured Code Mode setting with its boolean shorthand.\nfunction codeModeTable(value: JsonValue | undefined): JsonObject | undefined {\n if (typeof value === \"boolean\") return { enabled: value };\n return isRecord(value) ? value : undefined;\n}\n\n/** Read the same native layers and CLI overrides as the parent before adding its tool. */\nexport async function readDeepScanParentConfig(\n options: Pick<\n DirectDeepScanOptions,\n \"codexOptions\" | \"preflightCommand\" | \"scanDir\" | \"signal\"\n > & {\n plugin?: { marketplacePath: string; pluginName: string };\n pluginServers?: Record<string, unknown>;\n },\n): Promise<JsonObject | undefined> {\n const { codexOptions, preflightCommand: command } = options;\n const config = codexOptions.config ?? {};\n // The provider-profile launcher emits whole top-level tables instead.\n const overrides =\n codexOptions.nativeProfile === undefined\n ? sdkConfigFlags(config)\n : (await nativeProfileClient()).profileConfigOverrides(config);\n const environment = bundledCodexSdkEnvironment(command.command, {\n ...codexOptions.env,\n ...(codexOptions.apiKey === undefined\n ? {}\n : { CODEX_API_KEY: codexOptions.apiKey }),\n });\n const configOverrides = [\n ...overrides,\n ...(codexOptions.configOverrides ?? []),\n ];\n // Subcommand help does not load a project. A global --cd is ignored by\n // older app-servers, so require support on the subcommand itself.\n const help = await runCodexCommand(\n command,\n [\"app-server\", \"--cd\", options.scanDir, \"--help\"],\n environment,\n undefined,\n options.signal,\n );\n const supportsCd =\n help.success && /^\\s*(?:-C,\\s*)?--cd\\s+<[^>\\n]+>/mu.test(help.stdout);\n if (!supportsCd) {\n // The bundled command is the native executable itself. A custom launcher\n // can use its own working directory to resolve scripts and other inputs.\n if (\n resolve(options.scanDir) !== process.cwd() &&\n !isBundledExecutable(command.command)\n )\n return options.plugin\n ? undefined\n : suppliedParentRouting(configOverrides);\n if (environment[\"CODEX_HOME\"])\n environment[\"CODEX_HOME\"] = resolve(environment[\"CODEX_HOME\"]);\n }\n\n const native = await nativePermissionPreflight();\n return withCodexPreflightLock(environment, options.signal, () =>\n native.readDeepScanRuntimeConfig(\n {\n codexPath: command.command,\n commandArgs: command.args,\n cwd: supportsCd ? process.cwd() : options.scanDir,\n ...(supportsCd && { configCwd: options.scanDir }),\n configOverrides,\n env: environment,\n signal: options.signal,\n context: \"parent-config\",\n plugin: options.plugin,\n },\n (\n config: JsonObject,\n hasEmptyCatalog: (server: string) => Promise<boolean>,\n ) => inspectFilteredPeers(config, options.pluginServers, hasEmptyCatalog),\n ),\n );\n}\n\nfunction isBundledExecutable(command: string): boolean {\n try {\n return (\n realpathSync.native(command) ===\n realpathSync.native(resolveBundledCodexExecutable())\n );\n } catch {\n return false; // An installation may supply only an external launcher.\n }\n}\n\nasync function inspectFilteredPeers(\n config: JsonObject,\n pluginServers: Record<string, unknown> | undefined,\n hasEmptyCatalog: (server: string) => Promise<boolean>,\n): Promise<JsonObject> {\n const configured = isRecord(config[\"mcp_servers\"])\n ? config[\"mcp_servers\"]\n : {};\n const owner = configured[PLUGIN_NAME];\n if (\n isRecord(owner) &&\n (owner[\"command\"] ||\n owner[\"url\"] ||\n Array.isArray(owner[\"omit_tools_from\"]))\n )\n return config;\n const servers = { ...pluginServers, ...configured };\n const registration = servers[PLUGIN_NAME];\n if (!isRecord(registration) || registration[\"enabled\"] === false)\n return config;\n const routing = { ...configured };\n for (const [name, settings] of Object.entries(servers)) {\n if (\n name === PLUGIN_NAME ||\n !isRecord(settings) ||\n settings[\"enabled\"] === false ||\n ![\"codex_security\", \"mcp__codex_security\"].includes(\n normalizedServerName(name),\n )\n )\n continue;\n if (\n ![settings[\"enabled_tools\"], settings[\"disabled_tools\"]].some(\n (tools) => Array.isArray(tools) && tools.length > 0,\n )\n )\n continue;\n if (await hasEmptyCatalog(name)) {\n // This view is used only to select a namespace. Never change the peer's config.\n routing[name] = { enabled_tools: [] };\n }\n }\n return { ...config, mcp_servers: routing };\n}\n\nfunction normalizedServerName(server: string): string {\n return server.replace(/[-.:@/]/gu, \"_\");\n}\n\n/** Keep direct dispatch scoped to the original SDK coordinator turn and MCP server. */\nexport function deepScanParentToolOverrides(\n config: JsonObject,\n pluginServers: Record<string, unknown>,\n): string[] {\n const features = config[\"features\"] ?? {};\n if (!isRecord(features)) return [];\n const mode = features[\"code_mode\"];\n if (mode !== undefined && typeof mode !== \"boolean\" && !isRecord(mode))\n return [];\n const direct =\n (isRecord(mode) ? mode[\"direct_only_tool_namespaces\"] : undefined) ?? [];\n if (!Array.isArray(direct)) return [];\n\n const owner = PLUGIN_NAME;\n const bare = \"codex_security\";\n const prefixed = \"mcp__codex_security\";\n let required = [prefixed, bare];\n const overrides: string[] = [];\n const configured = config[\"mcp_servers\"];\n // Native registrations take precedence over the selected plugin's entries.\n const servers: Record<string, unknown> = {\n ...pluginServers,\n ...(isRecord(configured) ? configured : {}),\n };\n const ownerConfig = servers[owner];\n if (!isRecord(ownerConfig) || ownerConfig[\"enabled\"] === false) return [];\n const omitted = ownerConfig[\"omit_tools_from\"];\n if (Array.isArray(omitted) && omitted.includes(\"direct\")) return [];\n // A raw transport or an existing omission leaf can be updated in place.\n // Adding a new registration would shadow a plugin's transport and policy.\n if (\n isRecord(configured) &&\n Object.hasOwn(configured, owner) &&\n (Array.isArray(omitted) ||\n typeof ownerConfig[\"command\"] === \"string\" ||\n typeof ownerConfig[\"url\"] === \"string\")\n ) {\n if (omitted != null && !Array.isArray(omitted)) return [];\n const surfaces = omitted ?? [];\n if (surfaces.includes(\"code_mode\") && surfaces.includes(\"deferred\"))\n return [];\n return [\n `mcp_servers.${owner}.omit_tools_from=${inlineToml([...new Set([...surfaces, \"code_mode\", \"deferred\"])])}`,\n ];\n }\n const option = features[\"non_prefixed_mcp_tool_names\"];\n const enabled =\n option === true || (isRecord(option) && option[\"enabled\"] === true);\n const selected = isRecord(option) ? option[\"server_names\"] : undefined;\n function namespace(server: string): string {\n const name = normalizedServerName(server);\n const omitPrefix =\n enabled && (!Array.isArray(selected) || selected.includes(server));\n return omitPrefix || name.startsWith(\"mcp__\") ? name : `mcp__${name}`;\n }\n const occupied = new Set(\n Object.entries(servers)\n .filter(\n ([server, settings]) =>\n server !== owner &&\n isRecord(settings) &&\n settings[\"enabled\"] !== false &&\n (!Array.isArray(settings[\"enabled_tools\"]) ||\n settings[\"enabled_tools\"].length > 0),\n )\n .map(([server]) => namespace(server)),\n );\n const current = namespace(owner);\n if (occupied.has(current)) {\n const excluded = isRecord(mode) ? mode[\"excluded_tool_namespaces\"] : null;\n const routed = Array.isArray(excluded) ? [...direct, ...excluded] : direct;\n // Moving the owner also renames its peers. Keep names that the caller\n // explicitly routed or excluded from Code Mode.\n if (\n current === bare ||\n occupied.has(bare) ||\n routed.some(\n (name) =>\n name === current ||\n (typeof name === \"string\" &&\n /^mcp__codex_security_[0-9a-f]{12}$/u.test(name)),\n ) ||\n (option != null && !enabled)\n )\n return [];\n overrides.push(\n `features.non_prefixed_mcp_tool_names=${inlineToml({\n enabled: true,\n server_names: [...(Array.isArray(selected) ? selected : []), owner],\n })}`,\n );\n required = [bare];\n } else if (occupied.has(prefixed) || occupied.has(bare)) {\n required = [current];\n }\n if (!required.every((name) => direct.includes(name))) {\n overrides.push(\n `features.code_mode.direct_only_tool_namespaces=${inlineToml([...new Set([...direct, ...required])])}`,\n );\n }\n return overrides;\n}\n\n// The direct coordinator records context but never calls a model itself.\nexport const DIRECT_DEEP_SCAN_CONTROL_USAGE = {\n input_tokens: 0,\n cached_input_tokens: 0,\n cache_write_input_tokens: 0,\n output_tokens: 0,\n} as const;\n\n/** Run the same coordinator as the plugin, without a parent model turn. */\nexport async function* runDeepScan(\n options: DirectDeepScanOptions,\n): AsyncGenerator<{\n type: string;\n [key: string]: unknown;\n}> {\n const native = await import(\n pathToFileURL(\n join(options.pluginRoot, \"mcp\", \"permission-profile-preflight.mjs\"),\n ).href\n );\n const profile = await import(\n pathToFileURL(join(options.pluginRoot, \"scripts\", \"codex_profile.mjs\")).href\n );\n const configured = options.codexOptions;\n const command = options.preflightCommand;\n const environment = bundledCodexSdkEnvironment(command.command, {\n ...configured.env,\n ...(configured.apiKey === undefined\n ? {}\n : { CODEX_API_KEY: configured.apiKey }),\n });\n const session = (await withCodexPreflightLock(\n environment,\n options.signal,\n () =>\n native.prepareCliDeepScanSession({\n codexPath: command.command,\n commandArgs: command.args,\n cwd: options.scanDir,\n env: environment,\n configOverrides: [\n ...profile.profileConfigOverrides(configured.config ?? {}),\n ...(configured.configOverrides ?? []),\n // This session only records native context; workers keep their own snapshot.\n \"features.plugins=false\",\n ],\n signal: options.signal,\n prompt:\n options.prompt +\n \"\\n\\nThe host runs this Deep Scan coordinator directly and owns finalization. This saved request supplies context for later follow-up; do not start a replacement scan.\",\n }),\n )) as {\n threadId: string;\n model: string;\n reasoningEffort?: string;\n permissionProfile: unknown;\n };\n yield { type: \"thread.started\", thread_id: session.threadId };\n options.signal.throwIfAborted();\n const node = process.versions[\"bun\"]\n ? await resolveTrustedExecutable(\"node\", environment, [options.repository])\n : undefined;\n if (node === null)\n throw new CodexSecurityError(\"Node.js is not available on PATH.\");\n const output = await runEngine(\n node?.executable ?? process.execPath,\n [join(options.pluginRoot, \"mcp\", \"server.mjs\"), \"--deep-scan-engine\"],\n node?.environment ?? environment,\n JSON.stringify({\n scanId: options.scanId,\n ...session,\n ...(options.onDiagnostic && { diagnosticsVersion: 1 }),\n }),\n options.signal,\n options.onDiagnostic,\n );\n const completed = JSON.parse(output);\n if (\n completed.scanId !== options.scanId ||\n completed.manifestPath !== join(options.scanDir, \"scan-manifest.json\")\n ) {\n throw new CodexSecurityError(\n \"Deep Scan engine returned results for a different scan.\",\n );\n }\n // The control session makes no model calls. Worker usage is read by the\n // existing scan tracker from the native sessions below this scan directory.\n yield {\n type: \"turn.completed\",\n usage: { ...DIRECT_DEEP_SCAN_CONTROL_USAGE },\n };\n}\n\nfunction runEngine(\n command: string,\n args: string[],\n env: NodeJS.ProcessEnv,\n request: string,\n signal: AbortSignal,\n onDiagnostic: DirectDeepScanOptions[\"onDiagnostic\"],\n): Promise<string> {\n signal.throwIfAborted();\n const child = spawn(executablePathForSpawn(command), args, {\n env,\n windowsHide: true,\n serialization: \"json\",\n stdio: onDiagnostic ? [\"pipe\", \"pipe\", \"pipe\", \"ipc\"] : \"pipe\",\n }) as ChildProcessWithoutNullStreams;\n if (onDiagnostic) {\n child.on(\"message\", (message) => {\n if (!isRecord(message) || typeof message[\"event\"] !== \"string\") return;\n const fields: Record<string, string | number> = {};\n for (const [name, value] of Object.entries(message)) {\n if (\n /^[a-zA-Z][a-zA-Z0-9]*$/u.test(name) &&\n (typeof value === \"number\" || typeof value === \"string\")\n )\n fields[name] = value;\n }\n try {\n void Promise.resolve(onDiagnostic(fields)).catch(() => {});\n } catch {\n // The optional diagnostic sink cannot stop the scan.\n }\n });\n }\n // EOF requests graceful coordinator/worker cleanup on Windows as well as Unix.\n // Keep the control pipe open until completion or explicit cancellation.\n const cancel = () => child.stdin.end();\n let stdout = \"\";\n let stderr = \"\";\n let processError: Error | undefined;\n child.stdout.setEncoding(\"utf8\").on(\"data\", (chunk) => {\n stdout += chunk;\n });\n child.stderr.setEncoding(\"utf8\").on(\"data\", (chunk) => {\n stderr += chunk;\n });\n child.once(\"error\", (error) => {\n processError = error;\n });\n child.stdin.on(\"error\", (error: NodeJS.ErrnoException) => {\n if (!isDisconnectedChildStdin(error)) processError = error;\n });\n const result = new Promise<string>((resolve, reject) => {\n child.once(\"close\", (code) => {\n signal.removeEventListener(\"abort\", cancel);\n if (signal.aborted) reject(signal.reason);\n else if (processError) reject(processError);\n else if (code !== 0)\n reject(\n new CodexSecurityError(\n stderr.trim() || `Deep Scan engine exited with code ${code}.`,\n ),\n );\n else resolve(stdout);\n });\n });\n child.stdin.write(request + \"\\n\");\n signal.addEventListener(\"abort\", cancel, { once: true });\n if (signal.aborted) cancel();\n return result;\n}\n"]}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const defaultSeverityRubric = "# Severity guidance\n\nJudge the attacker's actual starting access, the security boundary crossed, and\nthe additional unauthorized harm. Use the supplied report and evidence; do not\nperform new validation. Keep confidence separate from severity and identify the\nmissing fact that could change the assessment. Missing proof alone does not\nestablish that a broader attack is impossible; do not invent an attack path or\ndowngrade merely because exploitation was not demonstrated.\n\n## Critical\n\nReserve Critical for consequential, strongly supported compromise meeting all\nthree conditions:\n- Access: an unauthenticated internet attacker, ordinary external user, or\n publicly admitted untrusted workload can exploit the interface without\n employee-only access, an invitation, an approved business relationship, or\n compromise of a trusted supplier.\n- Impact: crossing an important security boundary enables consequential access\n to protected data, privileged actions, meaningful code execution, workload\n escape, or comparable compromise of the affected system.\n- Evidence: demonstrated exploitation or strong source-backed validation\n establishes the complete attack path.\n\nSecond-order attacks can qualify: an external attacker plants data that a trusted\nuser or system later processes, causing consequential unauthorized access or\nprivileged actions.\n\n## High\n\nAssign High when a realistic, evidenced path gives a lower-trust attacker a\nsubstantial unauthorized capability they did not already possess. Internal\nusers, partners, invited collaborators, and admitted untrusted workloads can\nqualify; unauthenticated internet access is not required. Consequences include\nsensitive customer or business data or reusable credentials, account takeover,\nmeaningful cross-tenant access or actions as another user, control of production\nworkloads or deployments, privileged identities, encryption keys or important\nisolation boundaries, or significant repeatable disruption of a critical or\nshared service. A dangerous function, production label, internal access, or the\nexistence of a privileged credential alone is insufficient: identify the\nlower-trust actor, boundary crossing, and consequential new capability.\n\n## Medium\n\nAssign Medium to a credible vulnerability with concretely bounded impact, such\nas nonsecret operational information, narrow unauthorized changes, contained\ndisruption of a noncritical service, or isolated development or staging systems\nwithout a consequential pivot. A fully demonstrated vulnerability can still be\nMedium. Base a downgrade on verified constraints, not on an assumption that\nmissing evidence rules out broader harm.\n\n## Low\n\nAssign Low to a supported security weakness with minor additional unauthorized\nharm and verified limits on its scope, sensitivity, or duration, such as a small\ninformation exposure with little security value or a narrowly contained nuisance.\nDo not use Low as a substitute for uncertainty about a potentially serious path.\n\n## Informational\n\nAssign Informational to a hardening opportunity or observation for which the\nsupplied evidence establishes no additional unauthorized capability or security\nimpact. Explain why it is informational rather than treating missing proof of\nexploitation as proof of safety. Administrative records that do not describe a\nsecurity finding may be excluded; exclusion is distinct from severity.\n";
|
|
1
|
+
export declare const defaultSeverityRubric = "# Severity guidance\n\nJudge the attacker's actual starting access, the security boundary crossed, and the additional unauthorized harm. Keep confidence separate from severity and identify the missing fact that could change the assessment. Missing proof alone does not establish that a broader attack is impossible; do not invent an attack path or downgrade merely because exploitation was not demonstrated.\n\n## Critical\n\nReserve Critical for consequential, strongly supported compromise meeting all three conditions:\n\n- **Access.** An unauthenticated internet attacker, ordinary external user, or publicly admitted untrusted workload can exploit the interface without employee-only access, an invitation, an approved business relationship, or compromise of a trusted supplier.\n- **Impact.** Crossing an important security boundary enables consequential access to protected data, privileged actions, meaningful code execution, workload escape, or comparable compromise of the affected system.\n- **Evidence.** Demonstrated exploitation or strong source-backed validation establishes the complete attack path.\n\nSecond-order attacks can qualify: an external attacker plants data that a trusted user or system later processes, causing consequential unauthorized access or privileged actions.\n\n## High\n\nAssign High when the evidence establishes all three conditions:\n\n- **Access.** A lower-trust actor can reach the affected operation. Internal users, partners, invited collaborators, and admitted untrusted workloads can qualify.\n- **Impact.** Crossing the boundary grants a substantial new capability. Examples include access to sensitive customer or business data or reusable credentials, account takeover, meaningful cross-tenant access or actions as another user, control of production workloads or deployments, privileged identities, encryption keys or important isolation boundaries, and significant repeatable disruption of a critical or shared service.\n- **Evidence.** Identify a realistic path from the actor's existing access to the new capability. A dangerous function, production label, internal access, or privileged credential alone leaves that path unproven.\n\n## Medium\n\nAssign Medium to a credible vulnerability with concretely bounded impact, such as nonsecret operational information, narrow unauthorized changes, contained disruption of a noncritical service, or isolated development or staging systems without a consequential pivot. A fully demonstrated vulnerability can still be Medium. Base a downgrade on verified constraints, not on an assumption that missing evidence rules out broader harm.\n\n## Low\n\nAssign Low to a supported security weakness with minor additional unauthorized harm and verified limits on its scope, sensitivity, or duration, such as a small information exposure with little security value or a narrowly contained nuisance. Do not use Low as a substitute for uncertainty about a potentially serious path.\n\n## Informational\n\nAssign Informational to a hardening opportunity or observation for which the supplied evidence establishes no additional unauthorized capability or security impact. Explain why it is informational rather than treating missing proof of exploitation as proof of safety. Administrative records that do not describe a security finding may be excluded; exclusion is distinct from severity.\n";
|
|
3
2
|
//# sourceMappingURL=default-severity-rubric.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-severity-rubric.d.ts","sourceRoot":"","sources":["../src/default-severity-rubric.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default-severity-rubric.d.ts","sourceRoot":"","sources":["../src/default-severity-rubric.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,qBAAqB,0zGACuxG,CAAC"}
|
|
@@ -1,67 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export const defaultSeverityRubric =
|
|
3
|
-
|
|
4
|
-
Judge the attacker's actual starting access, the security boundary crossed, and
|
|
5
|
-
the additional unauthorized harm. Use the supplied report and evidence; do not
|
|
6
|
-
perform new validation. Keep confidence separate from severity and identify the
|
|
7
|
-
missing fact that could change the assessment. Missing proof alone does not
|
|
8
|
-
establish that a broader attack is impossible; do not invent an attack path or
|
|
9
|
-
downgrade merely because exploitation was not demonstrated.
|
|
10
|
-
|
|
11
|
-
## Critical
|
|
12
|
-
|
|
13
|
-
Reserve Critical for consequential, strongly supported compromise meeting all
|
|
14
|
-
three conditions:
|
|
15
|
-
- Access: an unauthenticated internet attacker, ordinary external user, or
|
|
16
|
-
publicly admitted untrusted workload can exploit the interface without
|
|
17
|
-
employee-only access, an invitation, an approved business relationship, or
|
|
18
|
-
compromise of a trusted supplier.
|
|
19
|
-
- Impact: crossing an important security boundary enables consequential access
|
|
20
|
-
to protected data, privileged actions, meaningful code execution, workload
|
|
21
|
-
escape, or comparable compromise of the affected system.
|
|
22
|
-
- Evidence: demonstrated exploitation or strong source-backed validation
|
|
23
|
-
establishes the complete attack path.
|
|
24
|
-
|
|
25
|
-
Second-order attacks can qualify: an external attacker plants data that a trusted
|
|
26
|
-
user or system later processes, causing consequential unauthorized access or
|
|
27
|
-
privileged actions.
|
|
28
|
-
|
|
29
|
-
## High
|
|
30
|
-
|
|
31
|
-
Assign High when a realistic, evidenced path gives a lower-trust attacker a
|
|
32
|
-
substantial unauthorized capability they did not already possess. Internal
|
|
33
|
-
users, partners, invited collaborators, and admitted untrusted workloads can
|
|
34
|
-
qualify; unauthenticated internet access is not required. Consequences include
|
|
35
|
-
sensitive customer or business data or reusable credentials, account takeover,
|
|
36
|
-
meaningful cross-tenant access or actions as another user, control of production
|
|
37
|
-
workloads or deployments, privileged identities, encryption keys or important
|
|
38
|
-
isolation boundaries, or significant repeatable disruption of a critical or
|
|
39
|
-
shared service. A dangerous function, production label, internal access, or the
|
|
40
|
-
existence of a privileged credential alone is insufficient: identify the
|
|
41
|
-
lower-trust actor, boundary crossing, and consequential new capability.
|
|
42
|
-
|
|
43
|
-
## Medium
|
|
44
|
-
|
|
45
|
-
Assign Medium to a credible vulnerability with concretely bounded impact, such
|
|
46
|
-
as nonsecret operational information, narrow unauthorized changes, contained
|
|
47
|
-
disruption of a noncritical service, or isolated development or staging systems
|
|
48
|
-
without a consequential pivot. A fully demonstrated vulnerability can still be
|
|
49
|
-
Medium. Base a downgrade on verified constraints, not on an assumption that
|
|
50
|
-
missing evidence rules out broader harm.
|
|
51
|
-
|
|
52
|
-
## Low
|
|
53
|
-
|
|
54
|
-
Assign Low to a supported security weakness with minor additional unauthorized
|
|
55
|
-
harm and verified limits on its scope, sensitivity, or duration, such as a small
|
|
56
|
-
information exposure with little security value or a narrowly contained nuisance.
|
|
57
|
-
Do not use Low as a substitute for uncertainty about a potentially serious path.
|
|
58
|
-
|
|
59
|
-
## Informational
|
|
60
|
-
|
|
61
|
-
Assign Informational to a hardening opportunity or observation for which the
|
|
62
|
-
supplied evidence establishes no additional unauthorized capability or security
|
|
63
|
-
impact. Explain why it is informational rather than treating missing proof of
|
|
64
|
-
exploitation as proof of safety. Administrative records that do not describe a
|
|
65
|
-
security finding may be excluded; exclusion is distinct from severity.
|
|
66
|
-
`;
|
|
1
|
+
// Generated from the plugin references/default-severity-rubric.md. Run pnpm build.
|
|
2
|
+
export const defaultSeverityRubric = "# Severity guidance\n\nJudge the attacker's actual starting access, the security boundary crossed, and the additional unauthorized harm. Keep confidence separate from severity and identify the missing fact that could change the assessment. Missing proof alone does not establish that a broader attack is impossible; do not invent an attack path or downgrade merely because exploitation was not demonstrated.\n\n## Critical\n\nReserve Critical for consequential, strongly supported compromise meeting all three conditions:\n\n- **Access.** An unauthenticated internet attacker, ordinary external user, or publicly admitted untrusted workload can exploit the interface without employee-only access, an invitation, an approved business relationship, or compromise of a trusted supplier.\n- **Impact.** Crossing an important security boundary enables consequential access to protected data, privileged actions, meaningful code execution, workload escape, or comparable compromise of the affected system.\n- **Evidence.** Demonstrated exploitation or strong source-backed validation establishes the complete attack path.\n\nSecond-order attacks can qualify: an external attacker plants data that a trusted user or system later processes, causing consequential unauthorized access or privileged actions.\n\n## High\n\nAssign High when the evidence establishes all three conditions:\n\n- **Access.** A lower-trust actor can reach the affected operation. Internal users, partners, invited collaborators, and admitted untrusted workloads can qualify.\n- **Impact.** Crossing the boundary grants a substantial new capability. Examples include access to sensitive customer or business data or reusable credentials, account takeover, meaningful cross-tenant access or actions as another user, control of production workloads or deployments, privileged identities, encryption keys or important isolation boundaries, and significant repeatable disruption of a critical or shared service.\n- **Evidence.** Identify a realistic path from the actor's existing access to the new capability. A dangerous function, production label, internal access, or privileged credential alone leaves that path unproven.\n\n## Medium\n\nAssign Medium to a credible vulnerability with concretely bounded impact, such as nonsecret operational information, narrow unauthorized changes, contained disruption of a noncritical service, or isolated development or staging systems without a consequential pivot. A fully demonstrated vulnerability can still be Medium. Base a downgrade on verified constraints, not on an assumption that missing evidence rules out broader harm.\n\n## Low\n\nAssign Low to a supported security weakness with minor additional unauthorized harm and verified limits on its scope, sensitivity, or duration, such as a small information exposure with little security value or a narrowly contained nuisance. Do not use Low as a substitute for uncertainty about a potentially serious path.\n\n## Informational\n\nAssign Informational to a hardening opportunity or observation for which the supplied evidence establishes no additional unauthorized capability or security impact. Explain why it is informational rather than treating missing proof of exploitation as proof of safety. Administrative records that do not describe a security finding may be excluded; exclusion is distinct from severity.\n";
|
|
67
3
|
//# sourceMappingURL=default-severity-rubric.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-severity-rubric.js","sourceRoot":"","sources":["../src/default-severity-rubric.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"default-severity-rubric.js","sourceRoot":"","sources":["../src/default-severity-rubric.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,MAAM,CAAC,MAAM,qBAAqB,GAChC,uzGAAuzG,CAAC","sourcesContent":["// Generated from the plugin references/default-severity-rubric.md. Run pnpm build.\nexport const defaultSeverityRubric =\n \"# Severity guidance\\n\\nJudge the attacker's actual starting access, the security boundary crossed, and the additional unauthorized harm. Keep confidence separate from severity and identify the missing fact that could change the assessment. Missing proof alone does not establish that a broader attack is impossible; do not invent an attack path or downgrade merely because exploitation was not demonstrated.\\n\\n## Critical\\n\\nReserve Critical for consequential, strongly supported compromise meeting all three conditions:\\n\\n- **Access.** An unauthenticated internet attacker, ordinary external user, or publicly admitted untrusted workload can exploit the interface without employee-only access, an invitation, an approved business relationship, or compromise of a trusted supplier.\\n- **Impact.** Crossing an important security boundary enables consequential access to protected data, privileged actions, meaningful code execution, workload escape, or comparable compromise of the affected system.\\n- **Evidence.** Demonstrated exploitation or strong source-backed validation establishes the complete attack path.\\n\\nSecond-order attacks can qualify: an external attacker plants data that a trusted user or system later processes, causing consequential unauthorized access or privileged actions.\\n\\n## High\\n\\nAssign High when the evidence establishes all three conditions:\\n\\n- **Access.** A lower-trust actor can reach the affected operation. Internal users, partners, invited collaborators, and admitted untrusted workloads can qualify.\\n- **Impact.** Crossing the boundary grants a substantial new capability. Examples include access to sensitive customer or business data or reusable credentials, account takeover, meaningful cross-tenant access or actions as another user, control of production workloads or deployments, privileged identities, encryption keys or important isolation boundaries, and significant repeatable disruption of a critical or shared service.\\n- **Evidence.** Identify a realistic path from the actor's existing access to the new capability. A dangerous function, production label, internal access, or privileged credential alone leaves that path unproven.\\n\\n## Medium\\n\\nAssign Medium to a credible vulnerability with concretely bounded impact, such as nonsecret operational information, narrow unauthorized changes, contained disruption of a noncritical service, or isolated development or staging systems without a consequential pivot. A fully demonstrated vulnerability can still be Medium. Base a downgrade on verified constraints, not on an assumption that missing evidence rules out broader harm.\\n\\n## Low\\n\\nAssign Low to a supported security weakness with minor additional unauthorized harm and verified limits on its scope, sensitivity, or duration, such as a small information exposure with little security value or a narrowly contained nuisance. Do not use Low as a substitute for uncertainty about a potentially serious path.\\n\\n## Informational\\n\\nAssign Informational to a hardening opportunity or observation for which the supplied evidence establishes no additional unauthorized capability or security impact. Explain why it is informational rather than treating missing proof of exploitation as proof of safety. Administrative records that do not describe a security finding may be excluded; exclusion is distinct from severity.\\n\";\n"]}
|
package/dist/endor-findings.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ExternalImportTarget } from "./external-import-contract.js";
|
|
2
2
|
import type { ExternalFindings } from "./external-findings.js";
|
|
3
3
|
/** Saved Endor Finding objects, an array, or an unmasked ListFindingsResponse. */
|
|
4
4
|
export declare function normalizeEndorFindings(input: unknown, target?: ExternalImportTarget): ExternalFindings;
|
|
5
|
+
/** A native upload would ask the worker to reconstruct fields that Cloud could not accept. */
|
|
6
|
+
export declare function requiresStructuredEndorReport(findings: ExternalFindings): boolean;
|
|
5
7
|
/** Endor's documented SARIF producer uses properties.finding-uuid, not its rule name. */
|
|
6
8
|
export declare function normalizeEndorSarif(input: unknown, target?: ExternalImportTarget): ExternalFindings;
|
|
7
9
|
export declare function readEndorFindings(path: string, target?: ExternalImportTarget): Promise<ExternalFindings>;
|