@openai/codex-security 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +437 -2692
- package/_bundled_plugin/.app.json +5 -1
- package/_bundled_plugin/.codex-plugin/plugin.json +9 -5
- package/_bundled_plugin/.mcp.json +2 -0
- package/_bundled_plugin/examples/completed-scan/coverage.json +0 -1
- package/_bundled_plugin/examples/completed-scan/report.md +28 -26
- package/_bundled_plugin/examples/completed-scan/scan-manifest.json +1 -1
- package/_bundled_plugin/mcp/helpers.mjs +1 -0
- package/_bundled_plugin/mcp/helpers.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/native/THIRD_PARTY_NOTICES.txt +6 -213
- package/_bundled_plugin/mcp/native/darwin-arm64/unix.node +0 -0
- package/_bundled_plugin/mcp/native/darwin-x64/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-arm64-gnu/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-arm64-musl/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-x64-gnu/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-x64-musl/unix.node +0 -0
- package/_bundled_plugin/mcp/native/win32-arm64/windows.node +0 -0
- package/_bundled_plugin/mcp/native/win32-x64/windows.node +0 -0
- package/_bundled_plugin/mcp/permission-profile-preflight.mjs +563 -0
- package/_bundled_plugin/mcp/server.mjs +1 -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/preflight/capability-profiles.toml +0 -13
- package/_bundled_plugin/references/artifact-storage.md +2 -2
- package/_bundled_plugin/references/config-preflight.md +0 -4
- package/_bundled_plugin/references/core-scan.md +21 -9
- package/_bundled_plugin/references/final-report.md +10 -12
- package/_bundled_plugin/references/finding-detail-fields.md +90 -80
- package/_bundled_plugin/references/sarif-adapter.md +1 -1
- package/_bundled_plugin/references/scan-artifacts.md +1 -2
- package/_bundled_plugin/references/scan-contract.md +9 -4
- package/_bundled_plugin/references/scan-prologue.md +12 -0
- package/_bundled_plugin/references/security-guidance.md +2 -2
- package/_bundled_plugin/references/standalone-validation.md +11 -0
- package/_bundled_plugin/references/threat-model.md +1 -1
- package/_bundled_plugin/schemas/coverage.schema.json +1 -47
- package/_bundled_plugin/schemas/definitions/artifact-common.schema.json +2 -24
- package/_bundled_plugin/schemas/definitions/discovery-candidate.schema.json +49 -25
- package/_bundled_plugin/schemas/findings.schema.json +71 -192
- package/_bundled_plugin/schemas/scan-manifest.schema.json +18 -45
- package/_bundled_plugin/schemas/tools/candidate-attack-paths.schema.json +91 -83
- package/_bundled_plugin/schemas/tools/candidate-validations.schema.json +35 -64
- package/_bundled_plugin/schemas/tools/deep-reducer.schema.json +5 -2
- package/_bundled_plugin/schemas/tools/discovery-candidates.schema.json +6 -55
- package/_bundled_plugin/schemas/tools/review-items.schema.json +2 -38
- package/_bundled_plugin/schemas/tools/scan-draft.schema.json +169 -294
- package/_bundled_plugin/scripts/codex_profile.mjs +239 -0
- package/_bundled_plugin/scripts/codex_session.mjs +53 -0
- package/_bundled_plugin/scripts/config_preflight.py +26 -62
- package/_bundled_plugin/scripts/deep_scan_config.py +9 -11
- package/_bundled_plugin/scripts/deep_scan_workbench.py +129 -150
- package/_bundled_plugin/scripts/finalize_scan_contract.py +315 -232
- package/_bundled_plugin/scripts/finding_preview.py +39 -9
- package/_bundled_plugin/scripts/generate_in_scope_files.py +27 -77
- package/_bundled_plugin/scripts/generate_rank_input.py +99 -829
- package/_bundled_plugin/scripts/launch_codex_security_mcp +35 -10
- package/_bundled_plugin/scripts/launch_codex_security_mcp.cmd +5 -5
- package/_bundled_plugin/scripts/rank_preview.py +42 -918
- package/_bundled_plugin/scripts/report_projection.py +117 -172
- package/_bundled_plugin/scripts/snapshot_sqlite.py +6 -1
- package/_bundled_plugin/scripts/threat_model_projection.py +4 -7
- package/_bundled_plugin/scripts/validate_scan_contract.py +4 -34
- package/_bundled_plugin/scripts/validate_tracking_source.py +3 -13
- package/_bundled_plugin/scripts/windows_scan_local_files.py +48 -3
- package/_bundled_plugin/scripts/workbench/handoff.py +25 -50
- package/_bundled_plugin/scripts/workbench/runtime_toml.py +22 -0
- package/_bundled_plugin/scripts/workbench/storage.py +10 -6
- package/_bundled_plugin/scripts/workbench_cli.py +94 -179
- package/_bundled_plugin/scripts/workbench_db.py +427 -463
- package/_bundled_plugin/scripts/workbench_feedback.py +6 -3
- package/_bundled_plugin/scripts/workbench_finding_index.py +19 -1
- package/_bundled_plugin/scripts/workbench_finding_workflows.py +18 -4
- package/_bundled_plugin/scripts/workbench_local_dedupe.py +136 -0
- package/_bundled_plugin/scripts/workbench_native_indexes.py +27 -14
- package/_bundled_plugin/scripts/workbench_progress.py +14 -58
- package/_bundled_plugin/scripts/workbench_publication.py +33 -57
- package/_bundled_plugin/scripts/workbench_remediation.py +12 -0
- package/_bundled_plugin/scripts/workbench_saved_results.py +172 -49
- package/_bundled_plugin/scripts/workbench_scan_history.py +57 -57
- package/_bundled_plugin/scripts/workbench_scan_start.py +105 -41
- package/_bundled_plugin/scripts/workbench_scan_usage.py +23 -34
- package/_bundled_plugin/scripts/workbench_schema.py +37 -1151
- package/_bundled_plugin/scripts/workbench_source_excerpt.py +11 -1
- package/_bundled_plugin/scripts/workbench_target.py +430 -142
- package/_bundled_plugin/scripts/workbench_validation.py +16 -27
- package/_bundled_plugin/shared/workbench-history-repairs.json +218 -0
- package/_bundled_plugin/shared/workbench-migrations.json +397 -0
- package/_bundled_plugin/skills/assess-patch-risk/SKILL.md +15 -4
- package/_bundled_plugin/skills/attack-path-analysis/SKILL.md +1 -0
- package/_bundled_plugin/skills/cloud-findings/SKILL.md +54 -0
- package/_bundled_plugin/skills/cloud-findings/agents/openai.yaml +4 -0
- package/_bundled_plugin/skills/deep-security-scan/SKILL.md +3 -3
- package/_bundled_plugin/skills/deep-security-scan/agents/openai.yaml +1 -1
- package/_bundled_plugin/skills/finding-discovery/SKILL.md +3 -3
- package/_bundled_plugin/skills/propose-security-hardening/references/proposal-format.md +50 -20
- package/_bundled_plugin/skills/security-diff-scan/SKILL.md +8 -14
- package/_bundled_plugin/skills/security-diff-scan/agents/openai.yaml +1 -1
- package/_bundled_plugin/skills/security-scan/SKILL.md +22 -7
- package/_bundled_plugin/skills/security-scan/agents/openai.yaml +1 -1
- package/_bundled_plugin/skills/security-scan/references/desktop-scan.md +1 -1
- package/_bundled_plugin/skills/security-scan/references/scan-artifacts-and-ledger.md +13 -1
- package/_bundled_plugin/skills/threat-model/SKILL.md +1 -1
- package/_bundled_plugin/skills/track-findings/SKILL.md +46 -178
- package/_bundled_plugin/skills/track-findings/agents/openai.yaml +1 -1
- package/_bundled_plugin/skills/track-findings/references/github-security-advisories.md +16 -24
- package/_bundled_plugin/skills/track-findings/references/jira.md +15 -61
- package/_bundled_plugin/skills/triage-finding/SKILL.md +50 -289
- package/_bundled_plugin/skills/triage-finding/agents/openai.yaml +2 -2
- package/_bundled_plugin/skills/triage-finding/references/ticket-intake.md +23 -43
- package/_bundled_plugin/skills/triage-finding/references/triage-result-contract.md +7 -1
- package/bin/codex-security.mjs +9 -2
- package/dist/api.d.ts +60 -10
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +803 -380
- package/dist/api.js.map +1 -1
- package/dist/artifact-export.d.ts +1 -1
- package/dist/artifact-export.d.ts.map +1 -1
- package/dist/artifact-export.js +28 -13
- package/dist/artifact-export.js.map +1 -1
- package/dist/auth.d.ts +2 -6
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +19 -9
- package/dist/auth.js.map +1 -1
- package/dist/bulk-scan-discovery.d.ts.map +1 -1
- package/dist/bulk-scan-discovery.js +1 -0
- package/dist/bulk-scan-discovery.js.map +1 -1
- package/dist/classify-severity.d.ts +26 -9
- package/dist/classify-severity.d.ts.map +1 -1
- package/dist/classify-severity.js +13 -30
- package/dist/classify-severity.js.map +1 -1
- package/dist/cli-help.d.ts.map +1 -1
- package/dist/cli-help.js +17 -13
- package/dist/cli-help.js.map +1 -1
- package/dist/cli-signals.d.ts +8 -0
- package/dist/cli-signals.d.ts.map +1 -0
- package/dist/cli-signals.js +28 -0
- package/dist/cli-signals.js.map +1 -0
- package/dist/cli.d.ts +4 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1087 -900
- package/dist/cli.js.map +1 -1
- package/dist/cloud-publish.d.ts.map +1 -1
- package/dist/cloud-publish.js +10 -9
- package/dist/cloud-publish.js.map +1 -1
- package/dist/codeowners.d.ts +19 -0
- package/dist/codeowners.d.ts.map +1 -0
- package/dist/codeowners.js +138 -0
- package/dist/codeowners.js.map +1 -0
- package/dist/codex-sdk-environment.d.ts +1 -0
- package/dist/codex-sdk-environment.d.ts.map +1 -1
- package/dist/codex-sdk-environment.js +40 -2
- package/dist/codex-sdk-environment.js.map +1 -1
- package/dist/component-plan.d.ts +2 -5
- package/dist/component-plan.d.ts.map +1 -1
- package/dist/component-plan.js +38 -30
- package/dist/component-plan.js.map +1 -1
- package/dist/component-scan.d.ts +6 -5
- package/dist/component-scan.d.ts.map +1 -1
- package/dist/component-scan.js +23 -35
- package/dist/component-scan.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +64 -74
- package/dist/config.js.map +1 -1
- package/dist/contract.d.ts +15 -3
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +87 -252
- package/dist/contract.js.map +1 -1
- package/dist/cost-model.d.ts +13 -6
- package/dist/cost-model.d.ts.map +1 -1
- package/dist/cost-model.js +14 -4
- package/dist/cost-model.js.map +1 -1
- package/dist/cost.d.ts +10 -2
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +102 -104
- package/dist/cost.js.map +1 -1
- package/dist/custom-validation-prompt.d.ts.map +1 -1
- package/dist/custom-validation-prompt.js +6 -5
- package/dist/custom-validation-prompt.js.map +1 -1
- package/dist/custom-validation.d.ts +1 -2
- package/dist/custom-validation.d.ts.map +1 -1
- package/dist/custom-validation.js +9 -3
- package/dist/custom-validation.js.map +1 -1
- package/dist/deduplication/checkpointed-review.d.ts +4 -2
- package/dist/deduplication/checkpointed-review.d.ts.map +1 -1
- package/dist/deduplication/checkpointed-review.js +23 -9
- package/dist/deduplication/checkpointed-review.js.map +1 -1
- package/dist/deduplication/codex-review.d.ts +7 -1
- package/dist/deduplication/codex-review.d.ts.map +1 -1
- package/dist/deduplication/codex-review.js +126 -17
- package/dist/deduplication/codex-review.js.map +1 -1
- package/dist/deduplication/deduplication-prompts.d.ts +5 -2
- package/dist/deduplication/deduplication-prompts.d.ts.map +1 -1
- package/dist/deduplication/deduplication-prompts.js +18 -4
- package/dist/deduplication/deduplication-prompts.js.map +1 -1
- package/dist/deduplication/deduplication-reviewer.d.ts +26 -4
- package/dist/deduplication/deduplication-reviewer.d.ts.map +1 -1
- package/dist/deduplication/deduplication-reviewer.js +57 -47
- package/dist/deduplication/deduplication-reviewer.js.map +1 -1
- package/dist/deduplication/deduplication.d.ts.map +1 -1
- package/dist/deduplication/deduplication.js +19 -51
- package/dist/deduplication/deduplication.js.map +1 -1
- package/dist/deduplication/diagnostics.d.ts +17 -0
- package/dist/deduplication/diagnostics.d.ts.map +1 -0
- package/dist/deduplication/diagnostics.js +5 -0
- package/dist/deduplication/diagnostics.js.map +1 -0
- package/dist/deduplication/finding-schema.d.ts.map +1 -1
- package/dist/deduplication/finding-schema.js +7 -1
- package/dist/deduplication/finding-schema.js.map +1 -1
- package/dist/deduplication/local.d.ts +31 -0
- package/dist/deduplication/local.d.ts.map +1 -0
- package/dist/deduplication/local.js +166 -0
- package/dist/deduplication/local.js.map +1 -0
- package/dist/deduplication/records-protocol.d.ts.map +1 -1
- package/dist/deduplication/records-protocol.js +11 -24
- package/dist/deduplication/records-protocol.js.map +1 -1
- package/dist/deduplication/records.d.ts +186 -11
- package/dist/deduplication/records.d.ts.map +1 -1
- package/dist/deduplication/records.js +10 -18
- package/dist/deduplication/records.js.map +1 -1
- package/dist/deduplication/scan.d.ts +9 -3
- package/dist/deduplication/scan.d.ts.map +1 -1
- package/dist/deduplication/scan.js +158 -39
- package/dist/deduplication/scan.js.map +1 -1
- package/dist/deep-config.d.ts +2 -1
- package/dist/deep-config.d.ts.map +1 -1
- package/dist/deep-config.js +4 -4
- package/dist/deep-config.js.map +1 -1
- package/dist/deep-progress.d.ts +2 -0
- package/dist/deep-progress.d.ts.map +1 -1
- package/dist/deep-progress.js +13 -10
- package/dist/deep-progress.js.map +1 -1
- package/dist/deep-scan.d.ts +20 -0
- package/dist/deep-scan.d.ts.map +1 -0
- package/dist/deep-scan.js +113 -0
- package/dist/deep-scan.js.map +1 -0
- package/dist/errors.d.ts +2 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +2 -0
- package/dist/errors.js.map +1 -1
- package/dist/feedback.d.ts.map +1 -1
- package/dist/feedback.js +53 -21
- package/dist/feedback.js.map +1 -1
- package/dist/finding-catalogue.d.ts.map +1 -1
- package/dist/finding-catalogue.js +4 -8
- package/dist/finding-catalogue.js.map +1 -1
- package/dist/finding-normalization.d.ts +5 -0
- package/dist/finding-normalization.d.ts.map +1 -0
- package/dist/finding-normalization.js +120 -0
- package/dist/finding-normalization.js.map +1 -0
- package/dist/finding-retrieval.d.ts +9 -0
- package/dist/finding-retrieval.d.ts.map +1 -1
- package/dist/finding-retrieval.js.map +1 -1
- package/dist/finding-workflow.d.ts +13 -8
- package/dist/finding-workflow.d.ts.map +1 -1
- package/dist/finding-workflow.js +14 -6
- package/dist/finding-workflow.js.map +1 -1
- package/dist/findings-client.d.ts +2 -1
- package/dist/findings-client.d.ts.map +1 -1
- package/dist/findings-client.js +36 -9
- package/dist/findings-client.js.map +1 -1
- package/dist/findings-errors.d.ts +16 -0
- package/dist/findings-errors.d.ts.map +1 -0
- package/dist/findings-errors.js +24 -0
- package/dist/findings-errors.js.map +1 -0
- package/dist/findings-import.d.ts +1 -1
- package/dist/findings-import.d.ts.map +1 -1
- package/dist/findings-import.js +12 -30
- package/dist/findings-import.js.map +1 -1
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +7 -1
- package/dist/github.js.map +1 -1
- package/dist/import-scan.d.ts.map +1 -1
- package/dist/import-scan.js +48 -38
- package/dist/import-scan.js.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/knowledge-base.d.ts +7 -1
- package/dist/knowledge-base.d.ts.map +1 -1
- package/dist/knowledge-base.js +114 -46
- package/dist/knowledge-base.js.map +1 -1
- package/dist/linear.d.ts.map +1 -1
- package/dist/linear.js +2 -7
- package/dist/linear.js.map +1 -1
- package/dist/mock-scan.d.ts.map +1 -1
- package/dist/mock-scan.js +0 -1
- package/dist/mock-scan.js.map +1 -1
- package/dist/models.d.ts +0 -2
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js.map +1 -1
- package/dist/multiscan.d.ts +9 -3
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +193 -126
- package/dist/multiscan.js.map +1 -1
- package/dist/owner-evidence.d.ts +10 -2
- package/dist/owner-evidence.d.ts.map +1 -1
- package/dist/owner-evidence.js +67 -8
- package/dist/owner-evidence.js.map +1 -1
- package/dist/patch-tui.d.ts.map +1 -1
- package/dist/patch-tui.js +3 -2
- package/dist/patch-tui.js.map +1 -1
- package/dist/project-config.js +3 -3
- package/dist/project-config.js.map +1 -1
- package/dist/provider-profile.d.ts +21 -0
- package/dist/provider-profile.d.ts.map +1 -0
- package/dist/provider-profile.js +133 -0
- package/dist/provider-profile.js.map +1 -0
- package/dist/publication-events.d.ts +6 -8
- package/dist/publication-events.d.ts.map +1 -1
- package/dist/publication-events.js +25 -50
- package/dist/publication-events.js.map +1 -1
- package/dist/publication-store.d.ts.map +1 -1
- package/dist/publication-store.js +40 -64
- package/dist/publication-store.js.map +1 -1
- package/dist/publication.d.ts +1 -2
- package/dist/publication.d.ts.map +1 -1
- package/dist/publication.js +2 -8
- package/dist/publication.js.map +1 -1
- package/dist/publish.d.ts +1 -5
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +109 -160
- package/dist/publish.js.map +1 -1
- package/dist/request-metadata.d.ts +9 -0
- package/dist/request-metadata.d.ts.map +1 -0
- package/dist/request-metadata.js +13 -0
- package/dist/request-metadata.js.map +1 -0
- package/dist/runtime.d.ts +15 -4
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +430 -138
- package/dist/runtime.js.map +1 -1
- package/dist/saved-scan-bootstrap.d.ts +14 -0
- package/dist/saved-scan-bootstrap.d.ts.map +1 -0
- package/dist/saved-scan-bootstrap.js +261 -0
- package/dist/saved-scan-bootstrap.js.map +1 -0
- package/dist/saved-scan.d.ts +1 -1
- package/dist/saved-scan.d.ts.map +1 -1
- package/dist/saved-scan.js +6 -12
- package/dist/saved-scan.js.map +1 -1
- package/dist/scan-activity.js +11 -8
- package/dist/scan-activity.js.map +1 -1
- package/dist/scan-comparison.d.ts +28 -15
- package/dist/scan-comparison.d.ts.map +1 -1
- package/dist/scan-comparison.js +276 -281
- package/dist/scan-comparison.js.map +1 -1
- package/dist/scan-dashboard.d.ts +3 -0
- package/dist/scan-dashboard.d.ts.map +1 -1
- package/dist/scan-dashboard.js +345 -77
- package/dist/scan-dashboard.js.map +1 -1
- package/dist/scan-history-renderer.d.ts.map +1 -1
- package/dist/scan-history-renderer.js +54 -13
- package/dist/scan-history-renderer.js.map +1 -1
- package/dist/scan-inputs.d.ts +6 -0
- package/dist/scan-inputs.d.ts.map +1 -0
- package/dist/scan-inputs.js +71 -0
- package/dist/scan-inputs.js.map +1 -0
- package/dist/scan-logs.d.ts +2 -3
- package/dist/scan-logs.d.ts.map +1 -1
- package/dist/scan-logs.js +12 -6
- package/dist/scan-logs.js.map +1 -1
- package/dist/scan-sessions.d.ts +4 -0
- package/dist/scan-sessions.d.ts.map +1 -1
- package/dist/scan-sessions.js +17 -0
- package/dist/scan-sessions.js.map +1 -1
- package/dist/scan-skill-paths.d.ts +8 -0
- package/dist/scan-skill-paths.d.ts.map +1 -0
- package/dist/scan-skill-paths.js +47 -0
- package/dist/scan-skill-paths.js.map +1 -0
- package/dist/security-policy-cli.d.ts.map +1 -1
- package/dist/security-policy-cli.js +7 -27
- package/dist/security-policy-cli.js.map +1 -1
- package/dist/security-policy.d.ts +9 -5
- package/dist/security-policy.d.ts.map +1 -1
- package/dist/security-policy.js +33 -14
- package/dist/security-policy.js.map +1 -1
- package/dist/server/api.d.ts +0 -1
- package/dist/server/api.d.ts.map +1 -1
- package/dist/server/api.js +0 -1
- package/dist/server/api.js.map +1 -1
- package/dist/server/embeddings.d.ts +3 -1
- package/dist/server/embeddings.d.ts.map +1 -1
- package/dist/server/embeddings.js +10 -3
- package/dist/server/embeddings.js.map +1 -1
- package/dist/server/errors.d.ts +5 -2
- package/dist/server/errors.d.ts.map +1 -1
- package/dist/server/errors.js +7 -0
- package/dist/server/errors.js.map +1 -1
- package/dist/server/sqlite-store.d.ts +0 -2
- package/dist/server/sqlite-store.d.ts.map +1 -1
- package/dist/server/sqlite-store.js +54 -44
- package/dist/server/sqlite-store.js.map +1 -1
- package/dist/server/storage.d.ts +0 -2
- package/dist/server/storage.d.ts.map +1 -1
- package/dist/server/storage.js.map +1 -1
- package/dist/severity-store.js +19 -24
- package/dist/severity-store.js.map +1 -1
- package/dist/standalone-validation-prompt.d.ts +2 -0
- package/dist/standalone-validation-prompt.d.ts.map +1 -0
- package/dist/standalone-validation-prompt.js +10 -0
- package/dist/standalone-validation-prompt.js.map +1 -0
- package/dist/suggest-owners.d.ts +4 -2
- package/dist/suggest-owners.d.ts.map +1 -1
- package/dist/suggest-owners.js +11 -5
- package/dist/suggest-owners.js.map +1 -1
- package/dist/targets.d.ts +11 -0
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +106 -47
- package/dist/targets.js.map +1 -1
- package/dist/trusted-executable.d.ts +2 -2
- package/dist/trusted-executable.d.ts.map +1 -1
- package/dist/trusted-executable.js +8 -6
- package/dist/trusted-executable.js.map +1 -1
- package/dist/value.js +7 -0
- package/dist/value.js.map +1 -1
- package/dist/version.js.map +1 -1
- package/dist/workbench-arguments.d.ts +3 -0
- package/dist/workbench-arguments.d.ts.map +1 -0
- package/dist/workbench-arguments.js +15 -0
- package/dist/workbench-arguments.js.map +1 -0
- package/dist/worker-progress.d.ts +1 -0
- package/dist/worker-progress.d.ts.map +1 -1
- package/dist/worker-progress.js +27 -12
- package/dist/worker-progress.js.map +1 -1
- package/docs/cli.md +1778 -0
- package/docs/findings-service.md +402 -0
- package/package.json +18 -19
- package/_bundled_plugin/schemas/tools/worker-threat-model.schema.json +0 -18
- package/_bundled_plugin/scripts/workbench_dashboard.py +0 -159
- package/_bundled_plugin/scripts/workbench_findings.py +0 -221
- package/_bundled_plugin/scripts/workbench_severity.py +0 -122
- package/_bundled_plugin/skills/assess-patch-risk/scripts/validate_patch_risk_assessment.py +0 -163
- package/dist/server/dashboard/THIRD_PARTY_NOTICES.txt +0 -276
- package/dist/server/dashboard/app.css +0 -2
- package/dist/server/dashboard/app.js +0 -66
- package/dist/server/dashboard/index.html +0 -18
- package/dist/server/dashboard-types.d.ts +0 -48
- package/dist/server/dashboard-types.d.ts.map +0 -1
- package/dist/server/dashboard-types.js +0 -2
- package/dist/server/dashboard-types.js.map +0 -1
- package/dist/server/dashboard.d.ts +0 -6
- package/dist/server/dashboard.d.ts.map +0 -1
- package/dist/server/dashboard.js +0 -59
- package/dist/server/dashboard.js.map +0 -1
- package/dist/server/index.d.ts +0 -2
- package/dist/server/index.d.ts.map +0 -1
- package/dist/server/index.js +0 -6
- package/dist/server/index.js.map +0 -1
- package/dist/server/routes.d.ts +0 -7
- package/dist/server/routes.d.ts.map +0 -1
- package/dist/server/routes.js +0 -98
- package/dist/server/routes.js.map +0 -1
- package/dist/server/serve.d.ts +0 -2
- package/dist/server/serve.d.ts.map +0 -1
- package/dist/server/serve.js +0 -28
- package/dist/server/serve.js.map +0 -1
- package/dist/server/server.d.ts +0 -10
- package/dist/server/server.d.ts.map +0 -1
- package/dist/server/server.js +0 -16
- package/dist/server/server.js.map +0 -1
- package/dist/server/validation.d.ts +0 -17
- package/dist/server/validation.d.ts.map +0 -1
- package/dist/server/validation.js +0 -53
- package/dist/server/validation.js.map +0 -1
|
@@ -0,0 +1,563 @@
|
|
|
1
|
+
// src/record.ts
|
|
2
|
+
function isRecord(value) {
|
|
3
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
|
+
}
|
|
5
|
+
function asRecord(value) {
|
|
6
|
+
return isRecord(value) ? value : void 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// src/deep-scan/permission-profile-preflight.ts
|
|
10
|
+
import { spawn } from "node:child_process";
|
|
11
|
+
import { createInterface } from "node:readline";
|
|
12
|
+
import { createReadStream } from "node:fs";
|
|
13
|
+
import { isDeepStrictEqual } from "node:util";
|
|
14
|
+
|
|
15
|
+
// package.json
|
|
16
|
+
var version = "0.1.161";
|
|
17
|
+
|
|
18
|
+
// src/deep-scan/errors.ts
|
|
19
|
+
var DeepScanNonRetryableError = class extends Error {
|
|
20
|
+
constructor(message, options) {
|
|
21
|
+
super(message, options);
|
|
22
|
+
this.name = "DeepScanNonRetryableError";
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// src/deep-scan/executable-path.ts
|
|
27
|
+
import { win32 } from "node:path";
|
|
28
|
+
function executablePathForSpawn(command) {
|
|
29
|
+
if (process.platform !== "win32" || !win32.isAbsolute(command))
|
|
30
|
+
return command;
|
|
31
|
+
const root = win32.parse(command).root;
|
|
32
|
+
return root === "\\" || root === "/" ? command : win32.toNamespacedPath(command);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// ../scripts/codex_profile.mjs
|
|
36
|
+
function isPermissionProfileFallbackWarning(message, profileId) {
|
|
37
|
+
if (typeof message !== "string") return false;
|
|
38
|
+
const prefix = `Configured value for \`permission_profile\` is disallowed by requirements; falling back from \`${profileId}\` to required value \``;
|
|
39
|
+
const warning = message.trim();
|
|
40
|
+
return warning.startsWith(prefix) && warning.endsWith("`.");
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// src/deep-scan/permission-profile-preflight.ts
|
|
44
|
+
var DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID = "codex_security_deep_scan_worker";
|
|
45
|
+
async function readDeepScanRuntimeConfig(options) {
|
|
46
|
+
return withPreflightClient(options, async (client) => {
|
|
47
|
+
const response = await client.request("config/read", {
|
|
48
|
+
cwd: options.cwd,
|
|
49
|
+
includeLayers: false
|
|
50
|
+
});
|
|
51
|
+
const config = asRecord(response.config);
|
|
52
|
+
if (!config) throw malformedPreflightError(options.context);
|
|
53
|
+
return config;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async function prepareCliDeepScanSession(options) {
|
|
57
|
+
return withPreflightClient(options, async (client) => {
|
|
58
|
+
const response = await client.request("thread/start", {
|
|
59
|
+
cwd: options.cwd,
|
|
60
|
+
threadSource: "security_scan",
|
|
61
|
+
ephemeral: false
|
|
62
|
+
});
|
|
63
|
+
const thread = asRecord(response.thread);
|
|
64
|
+
if (typeof thread?.id !== "string" || typeof thread.path !== "string" || typeof response.model !== "string") {
|
|
65
|
+
throw new Error("Codex did not return the owning Deep Scan session.");
|
|
66
|
+
}
|
|
67
|
+
await client.request("thread/inject_items", {
|
|
68
|
+
threadId: thread.id,
|
|
69
|
+
items: [
|
|
70
|
+
{
|
|
71
|
+
type: "message",
|
|
72
|
+
role: "user",
|
|
73
|
+
content: [{ type: "input_text", text: options.prompt }]
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
let permissionProfile;
|
|
78
|
+
const input = createReadStream(thread.path, { encoding: "utf8" });
|
|
79
|
+
const lines = createInterface({ input, crlfDelay: Infinity });
|
|
80
|
+
try {
|
|
81
|
+
for await (const line of lines) {
|
|
82
|
+
if (!line.trim()) continue;
|
|
83
|
+
const entry = asRecord(JSON.parse(line));
|
|
84
|
+
if (entry?.type === "turn_context") {
|
|
85
|
+
permissionProfile = asRecord(entry.payload)?.permission_profile;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
} finally {
|
|
89
|
+
lines.close();
|
|
90
|
+
input.destroy();
|
|
91
|
+
}
|
|
92
|
+
if (permissionProfile === void 0) {
|
|
93
|
+
throw new Error(
|
|
94
|
+
"Codex did not persist the Deep Scan session's effective permissions."
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
threadId: thread.id,
|
|
99
|
+
model: response.model,
|
|
100
|
+
...typeof response.reasoningEffort === "string" ? { reasoningEffort: response.reasoningEffort } : {},
|
|
101
|
+
permissionProfile
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
async function preflightDeepScanWorkerPermissionProfile(options) {
|
|
106
|
+
return withPreflightClient(options, async (client) => {
|
|
107
|
+
const configResponse = await client.request("config/read", {
|
|
108
|
+
cwd: options.cwd,
|
|
109
|
+
includeLayers: false
|
|
110
|
+
});
|
|
111
|
+
const catalog = await client.readPermissionProfileCatalog(options.cwd);
|
|
112
|
+
const matchingEntries = catalog.filter(
|
|
113
|
+
(entry) => entry.id === DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID
|
|
114
|
+
);
|
|
115
|
+
if (matchingEntries.length !== 1)
|
|
116
|
+
throw malformedPreflightError(options.context);
|
|
117
|
+
const catalogEntry = matchingEntries[0];
|
|
118
|
+
const requirementsResponse = catalogEntry.allowed === true ? void 0 : await client.readConfigRequirementsForClassification();
|
|
119
|
+
verifyPreflightResult(
|
|
120
|
+
options,
|
|
121
|
+
configResponse,
|
|
122
|
+
catalogEntry,
|
|
123
|
+
requirementsResponse
|
|
124
|
+
);
|
|
125
|
+
if (!options.allowOpenAiApiKeyFallback || asRecord(configResponse.config)?.forced_login_method === "chatgpt") {
|
|
126
|
+
return { useOpenAiApiKey: false };
|
|
127
|
+
}
|
|
128
|
+
const account = await client.request("account/read", {
|
|
129
|
+
refreshToken: false
|
|
130
|
+
});
|
|
131
|
+
return {
|
|
132
|
+
useOpenAiApiKey: account.requiresOpenaiAuth === true && account.account === null
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
async function withPreflightClient(options, operation) {
|
|
137
|
+
if (options.signal.aborted) throw abortError(options.signal.reason);
|
|
138
|
+
const client = new AppServerPreflightClient(options);
|
|
139
|
+
try {
|
|
140
|
+
await client.initialize();
|
|
141
|
+
return await operation(client);
|
|
142
|
+
} catch (error) {
|
|
143
|
+
await client.close();
|
|
144
|
+
const stderr = client.stderrText;
|
|
145
|
+
if (error instanceof Error && stderr)
|
|
146
|
+
Object.defineProperty(error, "message", {
|
|
147
|
+
value: error.message + "\n" + stderr,
|
|
148
|
+
writable: true,
|
|
149
|
+
configurable: true,
|
|
150
|
+
enumerable: false
|
|
151
|
+
});
|
|
152
|
+
throw error;
|
|
153
|
+
} finally {
|
|
154
|
+
await client.close();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
var AppServerPreflightClient = class {
|
|
158
|
+
constructor(options) {
|
|
159
|
+
this.options = options;
|
|
160
|
+
const args = [...options.commandArgs ?? []];
|
|
161
|
+
for (const override of options.configOverrides) {
|
|
162
|
+
args.push("--config", override);
|
|
163
|
+
}
|
|
164
|
+
for (const override of options.providerConfigOverrides ?? []) {
|
|
165
|
+
args.push("--config", override);
|
|
166
|
+
}
|
|
167
|
+
args.push("app-server", "--stdio");
|
|
168
|
+
this.child = spawn(executablePathForSpawn(options.codexPath), args, {
|
|
169
|
+
cwd: options.cwd,
|
|
170
|
+
...options.env === void 0 ? {} : { env: options.env },
|
|
171
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
172
|
+
windowsHide: true
|
|
173
|
+
});
|
|
174
|
+
this.childClose = new Promise((resolve) => {
|
|
175
|
+
this.child.once("close", () => {
|
|
176
|
+
this.childClosed = true;
|
|
177
|
+
resolve();
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
this.child.stderr.on("data", (chunk) => this.stderr.push(chunk));
|
|
181
|
+
this.stdoutLines = createInterface({
|
|
182
|
+
input: this.child.stdout,
|
|
183
|
+
crlfDelay: Infinity
|
|
184
|
+
});
|
|
185
|
+
this.stdoutLines.on("line", (line) => this.consumeStdoutLine(line));
|
|
186
|
+
const onStdioError = (error) => {
|
|
187
|
+
const failure = codexExecutableStdioError(
|
|
188
|
+
options.codexPath,
|
|
189
|
+
options.context
|
|
190
|
+
);
|
|
191
|
+
failure.message += "\n" + error.message;
|
|
192
|
+
this.fail(failure);
|
|
193
|
+
};
|
|
194
|
+
this.stdoutLines.on("error", onStdioError);
|
|
195
|
+
this.child.stdin.on("error", onStdioError);
|
|
196
|
+
this.child.on("error", (error) => {
|
|
197
|
+
this.fail(
|
|
198
|
+
codexExecutableStartError(options.codexPath, error, options.context)
|
|
199
|
+
);
|
|
200
|
+
});
|
|
201
|
+
this.child.on("close", (code, signal) => {
|
|
202
|
+
if (!this.closed) {
|
|
203
|
+
this.fail(
|
|
204
|
+
codexExecutableExitError(
|
|
205
|
+
options.codexPath,
|
|
206
|
+
code,
|
|
207
|
+
signal,
|
|
208
|
+
options.context
|
|
209
|
+
)
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
const onAbort = () => {
|
|
214
|
+
this.fail(abortError(options.signal.reason));
|
|
215
|
+
this.stopChild();
|
|
216
|
+
};
|
|
217
|
+
options.signal.addEventListener("abort", onAbort, { once: true });
|
|
218
|
+
this.removeAbortListener = () => options.signal.removeEventListener("abort", onAbort);
|
|
219
|
+
}
|
|
220
|
+
options;
|
|
221
|
+
child;
|
|
222
|
+
childClose;
|
|
223
|
+
stdoutLines;
|
|
224
|
+
pending;
|
|
225
|
+
nextId = 1;
|
|
226
|
+
stderr = [];
|
|
227
|
+
terminalError;
|
|
228
|
+
closed = false;
|
|
229
|
+
childClosed = false;
|
|
230
|
+
removeAbortListener;
|
|
231
|
+
get stderrText() {
|
|
232
|
+
return Buffer.concat(this.stderr).toString("utf8");
|
|
233
|
+
}
|
|
234
|
+
async initialize() {
|
|
235
|
+
await this.request("initialize", {
|
|
236
|
+
clientInfo: {
|
|
237
|
+
name: "codex_security_deep_scan",
|
|
238
|
+
title: "Codex Security Local Deep Scan",
|
|
239
|
+
version
|
|
240
|
+
},
|
|
241
|
+
capabilities: { experimentalApi: true }
|
|
242
|
+
});
|
|
243
|
+
if (this.terminalError) throw this.terminalError;
|
|
244
|
+
this.write({ jsonrpc: "2.0", method: "initialized", params: {} });
|
|
245
|
+
}
|
|
246
|
+
async readPermissionProfileCatalog(cwd) {
|
|
247
|
+
const entries = [];
|
|
248
|
+
const seenCursors = /* @__PURE__ */ new Set();
|
|
249
|
+
let cursor;
|
|
250
|
+
while (true) {
|
|
251
|
+
const result = await this.request("permissionProfile/list", {
|
|
252
|
+
cwd,
|
|
253
|
+
...cursor === void 0 ? {} : { cursor }
|
|
254
|
+
});
|
|
255
|
+
const data = result.data;
|
|
256
|
+
if (!Array.isArray(data))
|
|
257
|
+
throw malformedPreflightError(this.options.context);
|
|
258
|
+
for (const value of data) {
|
|
259
|
+
const entry = asRecord(value);
|
|
260
|
+
if (!entry || typeof entry.id !== "string") {
|
|
261
|
+
throw malformedPreflightError(this.options.context);
|
|
262
|
+
}
|
|
263
|
+
if (typeof entry.allowed !== "boolean")
|
|
264
|
+
throw malformedPreflightError(this.options.context);
|
|
265
|
+
entries.push(entry);
|
|
266
|
+
}
|
|
267
|
+
const nextCursor = result.nextCursor;
|
|
268
|
+
if (nextCursor === null) return entries;
|
|
269
|
+
if (typeof nextCursor !== "string" || nextCursor.length === 0 || seenCursors.has(nextCursor)) {
|
|
270
|
+
throw malformedPreflightError(this.options.context);
|
|
271
|
+
}
|
|
272
|
+
seenCursors.add(nextCursor);
|
|
273
|
+
cursor = nextCursor;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Classification is best effort after the catalog already rejected the
|
|
278
|
+
* profile. An older runtime may not expose this API; that is still a safe
|
|
279
|
+
* generic managed-policy rejection, not a reason to guess at remediation.
|
|
280
|
+
*/
|
|
281
|
+
async readConfigRequirementsForClassification() {
|
|
282
|
+
try {
|
|
283
|
+
return await this.request("configRequirements/read");
|
|
284
|
+
} catch (error) {
|
|
285
|
+
if (this.options.signal.aborted || isAbortError(error)) throw error;
|
|
286
|
+
return void 0;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
request(method, params) {
|
|
290
|
+
if (this.terminalError) return Promise.reject(this.terminalError);
|
|
291
|
+
const id = this.nextId++;
|
|
292
|
+
return new Promise((resolve, reject) => {
|
|
293
|
+
this.pending = { id, method, resolve, reject };
|
|
294
|
+
this.write({
|
|
295
|
+
jsonrpc: "2.0",
|
|
296
|
+
id,
|
|
297
|
+
method,
|
|
298
|
+
...params === void 0 ? {} : { params }
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
async close() {
|
|
303
|
+
this.closed = true;
|
|
304
|
+
this.removeAbortListener();
|
|
305
|
+
this.stopChild();
|
|
306
|
+
if (this.childClosed) return;
|
|
307
|
+
const forcedTermination = setTimeout(() => {
|
|
308
|
+
if (this.child.exitCode === null && this.child.signalCode === null) {
|
|
309
|
+
this.child.kill("SIGKILL");
|
|
310
|
+
}
|
|
311
|
+
this.child.stdin.destroy();
|
|
312
|
+
this.child.stdout.destroy();
|
|
313
|
+
this.child.stderr.destroy();
|
|
314
|
+
}, 1e3);
|
|
315
|
+
try {
|
|
316
|
+
await this.childClose;
|
|
317
|
+
} finally {
|
|
318
|
+
clearTimeout(forcedTermination);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
write(message) {
|
|
322
|
+
if (!this.child.stdin.writable) {
|
|
323
|
+
this.fail(
|
|
324
|
+
codexExecutableStdioError(this.options.codexPath, this.options.context)
|
|
325
|
+
);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
this.child.stdin.write(`${JSON.stringify(message)}
|
|
329
|
+
`, (error) => {
|
|
330
|
+
if (error) {
|
|
331
|
+
const failure = codexExecutableStdioError(
|
|
332
|
+
this.options.codexPath,
|
|
333
|
+
this.options.context
|
|
334
|
+
);
|
|
335
|
+
failure.message += "\n" + error.message;
|
|
336
|
+
this.fail(failure);
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
consumeStdoutLine(line) {
|
|
341
|
+
if (this.terminalError || line.trim().length === 0) return;
|
|
342
|
+
let value;
|
|
343
|
+
try {
|
|
344
|
+
value = JSON.parse(line);
|
|
345
|
+
} catch {
|
|
346
|
+
this.fail(malformedPreflightError(this.options.context));
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
const message = asRecord(value);
|
|
350
|
+
if (!message) {
|
|
351
|
+
this.fail(malformedPreflightError(this.options.context));
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
const id = message.id;
|
|
355
|
+
if (typeof id !== "number") {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
const pending = this.pending;
|
|
359
|
+
if (!pending || pending.id !== id) {
|
|
360
|
+
this.fail(malformedPreflightError(this.options.context));
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
this.pending = void 0;
|
|
364
|
+
if (message.error !== void 0) {
|
|
365
|
+
pending.reject(
|
|
366
|
+
jsonRpcPreflightError(
|
|
367
|
+
this.options.codexPath,
|
|
368
|
+
pending.method,
|
|
369
|
+
message.error,
|
|
370
|
+
this.options.context
|
|
371
|
+
)
|
|
372
|
+
);
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
const result = asRecord(message.result);
|
|
376
|
+
if (!result) {
|
|
377
|
+
pending.reject(malformedPreflightError(this.options.context));
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
pending.resolve(result);
|
|
381
|
+
}
|
|
382
|
+
fail(error) {
|
|
383
|
+
if (this.terminalError) return;
|
|
384
|
+
this.terminalError = error;
|
|
385
|
+
this.pending?.reject(error);
|
|
386
|
+
this.pending = void 0;
|
|
387
|
+
}
|
|
388
|
+
stopChild() {
|
|
389
|
+
this.stdoutLines.close();
|
|
390
|
+
if (!this.child.stdin.destroyed) this.child.stdin.end();
|
|
391
|
+
if (this.child.exitCode === null && this.child.signalCode === null) {
|
|
392
|
+
this.child.kill("SIGTERM");
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
function verifyPreflightResult(options, configResponse, catalogEntry, requirementsResponse) {
|
|
397
|
+
if (catalogEntry.allowed !== true) {
|
|
398
|
+
throw existingAllowlistExcludesProfile(requirementsResponse) ? disallowedProfileAllowlistError(options.context) : managedPolicyRejectedError(options.context);
|
|
399
|
+
}
|
|
400
|
+
const config = asRecord(configResponse.config);
|
|
401
|
+
const permissions = asRecord(config?.permissions);
|
|
402
|
+
const actualProfile = permissions ? asRecord(permissions[DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID]) : void 0;
|
|
403
|
+
if (!config || !permissions || !actualProfile || typeof config.default_permissions !== "string")
|
|
404
|
+
throw malformedPreflightError(options.context);
|
|
405
|
+
if (config.default_permissions !== DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID) {
|
|
406
|
+
throw profileNotSelectedError(options.context);
|
|
407
|
+
}
|
|
408
|
+
const expectedProfile = comparableProfile(options.expectedProfile);
|
|
409
|
+
const actualWithoutDescription = comparableProfile(actualProfile);
|
|
410
|
+
if (!isDeepStrictEqual(actualWithoutDescription, expectedProfile)) {
|
|
411
|
+
throw profileCollisionError(options.context);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
function existingAllowlistExcludesProfile(response) {
|
|
415
|
+
if (!response || !Object.hasOwn(response, "requirements")) return false;
|
|
416
|
+
if (response.requirements === null) return false;
|
|
417
|
+
const requirements = asRecord(response.requirements);
|
|
418
|
+
if (!requirements || !Object.hasOwn(requirements, "allowedPermissionProfiles"))
|
|
419
|
+
return false;
|
|
420
|
+
if (requirements.allowedPermissionProfiles === null) return false;
|
|
421
|
+
const allowlist = asRecord(requirements.allowedPermissionProfiles);
|
|
422
|
+
if (!allowlist) return false;
|
|
423
|
+
if (Object.values(allowlist).some((value) => typeof value !== "boolean"))
|
|
424
|
+
return false;
|
|
425
|
+
return allowlist[DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID] !== true;
|
|
426
|
+
}
|
|
427
|
+
function comparableProfile(value) {
|
|
428
|
+
const { description: _description, ...rest } = stripNullObjectFields(
|
|
429
|
+
value
|
|
430
|
+
);
|
|
431
|
+
return rest;
|
|
432
|
+
}
|
|
433
|
+
function stripNullObjectFields(value) {
|
|
434
|
+
if (Array.isArray(value))
|
|
435
|
+
return value.map((entry) => stripNullObjectFields(entry));
|
|
436
|
+
const object = asRecord(value);
|
|
437
|
+
if (!object) return value;
|
|
438
|
+
return Object.fromEntries(
|
|
439
|
+
Object.entries(object).filter(([, entry]) => entry !== null).map(([key, entry]) => [key, stripNullObjectFields(entry)])
|
|
440
|
+
);
|
|
441
|
+
}
|
|
442
|
+
function disallowedProfileAllowlistError(context) {
|
|
443
|
+
return new DeepScanNonRetryableError(
|
|
444
|
+
`${subject(context)} cannot safely start a read-only worker because organization policy does not allow the required \`${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID}\` permission profile. Ask your Codex administrator to define this read-only stub in a normal config layer:
|
|
445
|
+
|
|
446
|
+
[permissions.${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID}]
|
|
447
|
+
extends = ":read-only"
|
|
448
|
+
|
|
449
|
+
and add this entry to your existing allowlist in requirements.toml:
|
|
450
|
+
|
|
451
|
+
[allowed_permission_profiles]
|
|
452
|
+
${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID} = true
|
|
453
|
+
|
|
454
|
+
${subject(context)} did not run.`
|
|
455
|
+
);
|
|
456
|
+
}
|
|
457
|
+
function managedPolicyRejectedError(context) {
|
|
458
|
+
return new DeepScanNonRetryableError(
|
|
459
|
+
`${subject(context)} cannot safely start a read-only worker because managed Codex policy rejected the required \`${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID}\` permission profile. Ask your Codex administrator to review the managed permission, sandbox, and filesystem requirements. ${subject(context)} did not run.`
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
function profileNotSelectedError(context) {
|
|
463
|
+
return new DeepScanNonRetryableError(
|
|
464
|
+
`${subject(context)} cannot safely start a read-only worker because Codex did not select the required \`${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID}\` permission profile. Ask your Codex administrator to allow that profile for ${subject(context)}. ${subject(context)} did not run.`
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
function profileCollisionError(context) {
|
|
468
|
+
return new DeepScanNonRetryableError(
|
|
469
|
+
`${subject(context)} cannot safely start a read-only worker because existing Codex configuration changes the reserved \`${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID}\` permission profile. Ask your Codex administrator to keep the normal-config \`[permissions.${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID}]\` stub limited to \`extends = ":read-only"\`; ${subject(context)} supplies its deny rules at runtime. ${subject(context)} did not run.`
|
|
470
|
+
);
|
|
471
|
+
}
|
|
472
|
+
function malformedPreflightError(context) {
|
|
473
|
+
return new Error(
|
|
474
|
+
`${subject(context)} cannot safely verify its read-only worker permission profile with this Codex configuration. ${subject(context)} did not run.`
|
|
475
|
+
);
|
|
476
|
+
}
|
|
477
|
+
function unsupportedCodexApiError(codexPath, api, context) {
|
|
478
|
+
return new DeepScanNonRetryableError(
|
|
479
|
+
subject(context) + " cannot safely verify its read-only worker permission profile because the selected Codex executable " + JSON.stringify(codexPath) + " does not support the required " + JSON.stringify(api) + " API. Update the Codex installation at that path (the desktop app if it is bundled, otherwise the selected CLI) and retry. " + subject(context) + " did not run."
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
function jsonRpcPreflightError(codexPath, method, value, context) {
|
|
483
|
+
const error = asRecord(value);
|
|
484
|
+
const code = typeof error?.code === "number" && Number.isFinite(error.code) ? error.code : void 0;
|
|
485
|
+
if (code === -32601) {
|
|
486
|
+
const failure = unsupportedCodexApiError(codexPath, method, context);
|
|
487
|
+
if (typeof error?.message === "string")
|
|
488
|
+
failure.message += "\n" + error.message;
|
|
489
|
+
return failure;
|
|
490
|
+
}
|
|
491
|
+
return new Error(
|
|
492
|
+
subject(context) + " cannot safely verify its read-only worker permission profile because the selected Codex executable " + JSON.stringify(codexPath) + " returned an error for " + JSON.stringify(method) + (code === void 0 ? "" : " (JSON-RPC code " + code + ")") + ". Check the Codex configuration and retry. " + subject(context) + " did not run." + (typeof error?.message === "string" ? "\n" + error.message : "")
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
function codexExecutableStartError(codexPath, error, context) {
|
|
496
|
+
const value = "code" in error ? error.code : void 0;
|
|
497
|
+
const code = typeof value === "string" && /^[A-Z0-9_]+$/u.test(value) ? value : void 0;
|
|
498
|
+
const codeDetail = code === void 0 ? "" : " (" + code + ")";
|
|
499
|
+
return new Error(
|
|
500
|
+
codexExecutableFailureMessage(
|
|
501
|
+
codexPath,
|
|
502
|
+
"could not start" + codeDetail,
|
|
503
|
+
context
|
|
504
|
+
) + "\n" + error.message,
|
|
505
|
+
{ cause: error }
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
function codexExecutableExitError(codexPath, code, signal, context) {
|
|
509
|
+
const detail = code !== null ? "exited before permission-profile verification completed with code " + code : signal !== null ? "was terminated before permission-profile verification completed by signal " + signal : "exited before permission-profile verification completed";
|
|
510
|
+
return new Error(codexExecutableFailureMessage(codexPath, detail, context));
|
|
511
|
+
}
|
|
512
|
+
function codexExecutableStdioError(codexPath, context) {
|
|
513
|
+
return new Error(
|
|
514
|
+
codexExecutableFailureMessage(
|
|
515
|
+
codexPath,
|
|
516
|
+
"could not exchange app-server JSON-RPC over stdio",
|
|
517
|
+
context
|
|
518
|
+
)
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
function codexExecutableFailureMessage(codexPath, detail, context) {
|
|
522
|
+
return subject(context) + " cannot safely verify its read-only worker permission profile because the selected Codex executable " + JSON.stringify(codexPath) + " " + detail + ". Check that the named executable runs with --version, and check CODEX_CLI_PATH/PATH, then retry. " + subject(context) + " did not run.";
|
|
523
|
+
}
|
|
524
|
+
function deepScanPermissionProfileFallbackError(message) {
|
|
525
|
+
if (typeof message !== "string") return void 0;
|
|
526
|
+
if (!isPermissionProfileFallbackWarning(
|
|
527
|
+
message,
|
|
528
|
+
DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID
|
|
529
|
+
))
|
|
530
|
+
return void 0;
|
|
531
|
+
return new DeepScanNonRetryableError(
|
|
532
|
+
`Deep Scan stopped a worker because organization policy rejected the required \`${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID}\` permission profile after the turn started. The worker was stopped and its results were discarded. Ask your Codex administrator to define this read-only stub in a normal config layer:
|
|
533
|
+
|
|
534
|
+
[permissions.${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID}]
|
|
535
|
+
extends = ":read-only"
|
|
536
|
+
|
|
537
|
+
and add this entry to your existing allowlist in requirements.toml:
|
|
538
|
+
|
|
539
|
+
[allowed_permission_profiles]
|
|
540
|
+
${DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID} = true
|
|
541
|
+
${message}`
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
function subject(context) {
|
|
545
|
+
return context === "helper" ? "Read-only Codex helper" : "Deep Scan";
|
|
546
|
+
}
|
|
547
|
+
function isAbortError(error) {
|
|
548
|
+
return error instanceof Error && error.name === "AbortError";
|
|
549
|
+
}
|
|
550
|
+
function abortError(reason) {
|
|
551
|
+
if (reason instanceof Error) return reason;
|
|
552
|
+
return new DOMException(
|
|
553
|
+
"Deep Scan worker permission profile preflight aborted.",
|
|
554
|
+
"AbortError"
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
export {
|
|
558
|
+
DEEP_SCAN_WORKER_PERMISSION_PROFILE_ID,
|
|
559
|
+
deepScanPermissionProfileFallbackError,
|
|
560
|
+
preflightDeepScanWorkerPermissionProfile,
|
|
561
|
+
prepareCliDeepScanSession,
|
|
562
|
+
readDeepScanRuntimeConfig
|
|
563
|
+
};
|
|
Binary file
|
|
Binary file
|
|
@@ -14,19 +14,6 @@ op = ">="
|
|
|
14
14
|
value = 6
|
|
15
15
|
v1_default = 6
|
|
16
16
|
|
|
17
|
-
[capabilities.usable_worker_slots_8]
|
|
18
|
-
kind = "multi_agent_capacity"
|
|
19
|
-
op = ">="
|
|
20
|
-
value = 8
|
|
21
|
-
v1_default = 6
|
|
22
|
-
|
|
23
|
-
[capabilities.agent_depth_2]
|
|
24
|
-
kind = "config"
|
|
25
|
-
path = "agents.max_depth"
|
|
26
|
-
op = ">="
|
|
27
|
-
value = 2
|
|
28
|
-
default = 1
|
|
29
|
-
|
|
30
17
|
[capabilities.goals_enabled]
|
|
31
18
|
kind = "config"
|
|
32
19
|
path = "features.goals"
|
|
@@ -19,7 +19,7 @@ Identify the owner with exactly one of:
|
|
|
19
19
|
|
|
20
20
|
Select `storage` explicitly:
|
|
21
21
|
|
|
22
|
-
- `persistent`: retained documents/evidence under the authoritative scan directory or standalone collection. The default root is `$CODEX_SECURITY_STATE_DIR/scans`, or `$CODEX_HOME/state/plugins/codex-security/scans` when no state override is set; `CODEX_HOME` defaults to `~/.codex`. The existing `CODEX_SECURITY_SCAN_ROOT` override still takes precedence for plugin-created output.
|
|
22
|
+
- `persistent`: retained documents/evidence under the authoritative scan directory or standalone collection. The default root is `$CODEX_SECURITY_STATE_DIR/scans`, or `$CODEX_HOME/state/plugins/codex-security/scans` when no state override is set; `CODEX_HOME` defaults to `~/.codex`. The existing `CODEX_SECURITY_SCAN_ROOT` override still takes precedence for plugin-created output. The workbench state directory must be writable; set `CODEX_SECURITY_STATE_DIR` explicitly on hosts with an unwritable default. Preserve an existing scan's saved path, including older temporary paths.
|
|
23
23
|
- `temporary`: disposable staging and execution output in a context-specific OS temporary directory. Standalone temporary saves and reads do not create or require the persistent collection. It is not part of the completed result and must not be referenced from canonical findings or coverage. It can disappear independently of retained files.
|
|
24
24
|
|
|
25
25
|
Relative storage overrides resolve from the plugin directory, matching the workbench, regardless of the MCP launch directory.
|
|
@@ -46,7 +46,7 @@ For standalone/legacy mutable ledgers, use the save tool to replace their comple
|
|
|
46
46
|
|
|
47
47
|
## Threat-model cache and completed results
|
|
48
48
|
|
|
49
|
-
For a standalone repository threat model, use `targetPath: <repo_root>`, `storage: "persistent"`, `path: "threatmodel.md"`. Read a shared cached file only when the threat-model workflow allows cache reuse and its exact repository/version footer matches; if the new filename is absent, the legacy `threat_model.md` may be read under the same rules. For a running scan, retain the selected text as `{ "format": "markdown", "content": "<exact Markdown>" }` in its canonical `threatModel`, using an early `complete: false` semantic checkpoint with
|
|
49
|
+
For a standalone repository threat model, use `targetPath: <repo_root>`, `storage: "persistent"`, `path: "threatmodel.md"`. Read a shared cached file only when the threat-model workflow allows cache reuse and its exact repository/version footer matches; if the new filename is absent, the legacy `threat_model.md` may be read under the same rules. For a running scan, retain the selected text as `{ "format": "markdown", "content": "<exact Markdown>" }` in its canonical `threatModel`, using an early `complete: false` semantic checkpoint with the reviewed surfaces and pending work. The host writes `<scan_dir>/threatmodel.md` from that content. Preserve the workflow's conditions that forbid reading or replacing the shared cache; saving or exporting a scan's model does not authorize a cache update.
|
|
50
50
|
|
|
51
51
|
End each shared threat model with these two lines:
|
|
52
52
|
|
|
@@ -62,10 +62,6 @@ When the profile includes remediation patches, present the concrete config delta
|
|
|
62
62
|
|
|
63
63
|
Some remediation patches have `kind = "host_setting"`. Present those as host-level setup guidance, not as edits to persistent Codex config.
|
|
64
64
|
|
|
65
|
-
Deep Security Scan uses MCP-owned SDK sessions rather than the parent thread's worker pool. Its preflight does not require a particular parent delegation runtime, ownership, capacity, or depth. Discovery workers inherit the scan's model and use the reserved `codex_security_deep_scan_worker` permission profile with the parent's supported filesystem denials. The selected Codex executable must support permission-profile configuration and allowance checks. If that command fails to start or exits early, report its path and the tool's diagnostic; do not infer that its version is unsupported. If the tool identifies a missing API, ask the user to update the Codex installation at the reported path: the desktop app for an app-bundled executable, or the selected CLI otherwise. If Codex policy rejects the profile, report the tool's administrator guidance. Do not remove deny rules or select a broader sandbox to work around the error.
|
|
66
|
-
|
|
67
|
-
Deep Scan workers use the selected Codex home's credentials and provider configuration. An existing `CODEX_API_KEY` remains selected. When the worker has no Codex account and its provider requires OpenAI authentication, it can use `OPENAI_API_KEY` through the SDK's API-key option. This does not replace a stored account, custom-provider authentication, or a forced ChatGPT login. The key must be present in the process that launched the plugin; setting it later in a separate shell does not update a running plugin.
|
|
68
|
-
|
|
69
65
|
Do not warn merely because a user's value differs from the profile's suggested patch. Warn or block only when the evaluated capability requirement is unmet.
|
|
70
66
|
|
|
71
67
|
If a blocking runtime capability is `unknown`, establish it from the current tool surface and rerun the helper with an explicit `--runtime-check`. An unknown `warn` or `suggest` capability does not block a `ready` scan; continue on the documented degraded path without claiming that capability is available.
|