@openai/codex-security 0.8.1 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -57
- package/_bundled_plugin/.app.json +4 -0
- package/_bundled_plugin/.mcp.json +1 -0
- package/_bundled_plugin/mcp/helpers.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/helpers.mjs.br.part-001 +0 -0
- package/_bundled_plugin/mcp/native/THIRD_PARTY_NOTICES.txt +4 -4
- package/_bundled_plugin/mcp/native/darwin-arm64/unix.node +0 -0
- package/_bundled_plugin/mcp/native/darwin-x64/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-arm64-gnu/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-arm64-musl/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-x64-gnu/unix.node +0 -0
- package/_bundled_plugin/mcp/native/linux-x64-musl/unix.node +0 -0
- package/_bundled_plugin/mcp/native/win32-arm64/windows.node +0 -0
- package/_bundled_plugin/mcp/native/win32-x64/windows.node +0 -0
- package/_bundled_plugin/mcp/permission-profile-preflight.mjs +46 -12
- package/_bundled_plugin/mcp/server.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-001 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-002 +0 -0
- package/_bundled_plugin/references/artifact-storage.md +1 -1
- package/_bundled_plugin/references/core-scan.md +14 -5
- package/_bundled_plugin/references/default-severity-rubric.md +28 -0
- package/_bundled_plugin/references/finding-detail-fields.md +1 -0
- package/_bundled_plugin/references/threat-model.md +1 -0
- package/_bundled_plugin/scripts/deep_scan_workbench.py +23 -112
- package/_bundled_plugin/scripts/finalize_scan_contract.py +167 -153
- package/_bundled_plugin/scripts/finding_preview.py +5 -29
- package/_bundled_plugin/scripts/posix_scan_local_files.py +187 -0
- package/_bundled_plugin/scripts/report_projection.py +87 -136
- package/_bundled_plugin/scripts/validate_scan_contract.py +2 -6
- package/_bundled_plugin/scripts/windows_scan_local_files.py +212 -55
- package/_bundled_plugin/scripts/workbench/retained_coverage.py +8 -24
- package/_bundled_plugin/scripts/workbench/saved_coverage.py +143 -231
- package/_bundled_plugin/scripts/workbench_cli.py +102 -13
- package/_bundled_plugin/scripts/workbench_constants.py +9 -0
- package/_bundled_plugin/scripts/workbench_coverage_receipts.py +0 -17
- package/_bundled_plugin/scripts/workbench_db.py +187 -363
- package/_bundled_plugin/scripts/workbench_finding_workflows.py +86 -4
- package/_bundled_plugin/scripts/workbench_native_indexes.py +17 -21
- package/_bundled_plugin/scripts/workbench_remediation.py +495 -11
- package/_bundled_plugin/scripts/workbench_saved_results.py +0 -66
- package/_bundled_plugin/scripts/workbench_scan_history.py +22 -25
- package/_bundled_plugin/scripts/workbench_scan_start.py +1 -1
- package/_bundled_plugin/scripts/workbench_scan_usage.py +25 -52
- package/_bundled_plugin/scripts/workbench_schema.py +1 -1
- package/_bundled_plugin/scripts/workbench_setup.py +239 -0
- package/_bundled_plugin/scripts/workbench_source_scopes.py +15 -23
- package/_bundled_plugin/scripts/workbench_target.py +120 -35
- package/_bundled_plugin/scripts/workbench_validation.py +1 -9
- package/_bundled_plugin/shared/workbench-history-repairs.json +7 -0
- package/_bundled_plugin/shared/workbench-migrations.json +19 -0
- package/_bundled_plugin/skills/attack-path-analysis/SKILL.md +1 -1
- package/_bundled_plugin/skills/attack-path-analysis/references/severity-policy.md +4 -68
- package/_bundled_plugin/skills/check-skills/SKILL.md +43 -0
- package/_bundled_plugin/skills/check-skills/agents/openai.yaml +4 -0
- package/_bundled_plugin/skills/cloud-findings/SKILL.md +2 -0
- package/_bundled_plugin/skills/fix-finding/SKILL.md +18 -1
- package/_bundled_plugin/skills/publish-findings/SKILL.md +68 -35
- package/_bundled_plugin/skills/publish-findings/references/wiz-import.md +2 -21
- package/_bundled_plugin/skills/resolve-dependency-alert/SKILL.md +18 -0
- package/_bundled_plugin/skills/resolve-dependency-alert/agents/openai.yaml +4 -0
- package/_bundled_plugin/skills/threat-model-visualize/SKILL.md +83 -0
- package/_bundled_plugin/skills/threat-model-visualize/agents/openai.yaml +4 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/context-reference-overview.svg +366 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/context-reference-path.svg +558 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/control-effects.js +85 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/explorer.css +17 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/explorer.html +38 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/explorer.js +372 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/route-paths.js +71 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/source-roles.js +47 -0
- package/_bundled_plugin/skills/threat-model-visualize/assets/svg-layout.js +149 -0
- package/_bundled_plugin/skills/threat-model-visualize/references/context-explorer.md +21 -0
- package/_bundled_plugin/skills/threat-model-visualize/references/view-model.md +49 -0
- package/_bundled_plugin/skills/threat-model-visualize/scripts/build_explorer.py +569 -0
- package/_bundled_plugin/skills/track-findings/SKILL.md +5 -3
- package/_bundled_plugin/skills/triage-finding/references/github-rest-intake.md +22 -68
- package/_bundled_plugin/skills/triage-finding/references/ticket-intake.md +6 -4
- package/dist/api.d.ts +6 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +414 -163
- package/dist/api.js.map +1 -1
- package/dist/auth.js +7 -2
- package/dist/auth.js.map +1 -1
- package/dist/blackduck-findings.d.ts +8 -0
- package/dist/blackduck-findings.d.ts.map +1 -0
- package/dist/blackduck-findings.js +305 -0
- package/dist/blackduck-findings.js.map +1 -0
- package/dist/bulk-scan-discovery.d.ts.map +1 -1
- package/dist/bulk-scan-discovery.js +51 -36
- package/dist/bulk-scan-discovery.js.map +1 -1
- package/dist/classify-severity-records.d.ts +5 -0
- package/dist/classify-severity-records.d.ts.map +1 -1
- package/dist/classify-severity-records.js +6 -8
- package/dist/classify-severity-records.js.map +1 -1
- package/dist/classify-severity.d.ts +4 -1
- package/dist/classify-severity.d.ts.map +1 -1
- package/dist/classify-severity.js +28 -9
- package/dist/classify-severity.js.map +1 -1
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +635 -266
- package/dist/cli.js.map +1 -1
- package/dist/codex-prompt.d.ts +2 -0
- package/dist/codex-prompt.d.ts.map +1 -1
- package/dist/codex-prompt.js +6 -0
- package/dist/codex-prompt.js.map +1 -1
- package/dist/component-scan.d.ts.map +1 -1
- package/dist/component-scan.js +6 -5
- package/dist/component-scan.js.map +1 -1
- package/dist/config.d.ts +2 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +162 -40
- package/dist/config.js.map +1 -1
- package/dist/continuum-findings.d.ts +7 -0
- package/dist/continuum-findings.d.ts.map +1 -0
- package/dist/continuum-findings.js +157 -0
- package/dist/continuum-findings.js.map +1 -0
- package/dist/contract-values.d.ts +28 -0
- package/dist/contract-values.d.ts.map +1 -0
- package/dist/contract-values.js +75 -0
- package/dist/contract-values.js.map +1 -0
- package/dist/contract.d.ts +2 -20
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +58 -669
- package/dist/contract.js.map +1 -1
- package/dist/cost-model.d.ts.map +1 -1
- package/dist/cost-model.js +1 -4
- package/dist/cost-model.js.map +1 -1
- package/dist/cost.d.ts +19 -1
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +2120 -39
- package/dist/cost.js.map +1 -1
- package/dist/custom-validation-prompt.d.ts +1 -1
- package/dist/custom-validation-prompt.d.ts.map +1 -1
- package/dist/custom-validation-prompt.js +5 -0
- package/dist/custom-validation-prompt.js.map +1 -1
- package/dist/custom-validation.d.ts +2 -0
- package/dist/custom-validation.d.ts.map +1 -1
- package/dist/custom-validation.js +6 -2
- package/dist/custom-validation.js.map +1 -1
- package/dist/deduplication/deduplication-prompts.d.ts +4 -4
- package/dist/deduplication/deduplication-prompts.d.ts.map +1 -1
- package/dist/deduplication/deduplication-prompts.js +2 -2
- package/dist/deduplication/deduplication-prompts.js.map +1 -1
- package/dist/deduplication/deduplication-reviewer.d.ts +14 -11
- package/dist/deduplication/deduplication-reviewer.d.ts.map +1 -1
- package/dist/deduplication/deduplication-reviewer.js +12 -5
- package/dist/deduplication/deduplication-reviewer.js.map +1 -1
- package/dist/deduplication/deduplication.js.map +1 -1
- package/dist/deduplication/finding-schema.d.ts +19 -1
- package/dist/deduplication/finding-schema.d.ts.map +1 -1
- package/dist/deduplication/finding-schema.js +25 -0
- package/dist/deduplication/finding-schema.js.map +1 -1
- package/dist/deduplication/local.d.ts.map +1 -1
- package/dist/deduplication/local.js +3 -8
- package/dist/deduplication/local.js.map +1 -1
- package/dist/deduplication/records.d.ts +11 -3
- package/dist/deduplication/records.d.ts.map +1 -1
- package/dist/deduplication/records.js +48 -16
- package/dist/deduplication/records.js.map +1 -1
- package/dist/deep-scan.d.ts +11 -0
- package/dist/deep-scan.d.ts.map +1 -1
- package/dist/deep-scan.js +235 -4
- package/dist/deep-scan.js.map +1 -1
- package/dist/default-severity-rubric.d.ts +1 -2
- package/dist/default-severity-rubric.d.ts.map +1 -1
- package/dist/default-severity-rubric.js +2 -66
- package/dist/default-severity-rubric.js.map +1 -1
- package/dist/endor-findings.d.ts.map +1 -1
- package/dist/endor-findings.js +44 -89
- package/dist/endor-findings.js.map +1 -1
- package/dist/errors.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/external-findings-import.d.ts.map +1 -1
- package/dist/external-findings-import.js +11 -15
- package/dist/external-findings-import.js.map +1 -1
- package/dist/external-findings-local.d.ts +12 -1
- package/dist/external-findings-local.d.ts.map +1 -1
- package/dist/external-findings-local.js +411 -184
- package/dist/external-findings-local.js.map +1 -1
- package/dist/external-findings-publish.d.ts +15 -1
- package/dist/external-findings-publish.d.ts.map +1 -1
- package/dist/external-findings-publish.js +1238 -226
- package/dist/external-findings-publish.js.map +1 -1
- package/dist/external-findings-read.d.ts +10 -0
- package/dist/external-findings-read.d.ts.map +1 -1
- package/dist/external-findings-read.js +71 -51
- package/dist/external-findings-read.js.map +1 -1
- package/dist/external-findings.d.ts +13 -0
- package/dist/external-findings.d.ts.map +1 -1
- package/dist/external-findings.js +124 -1
- package/dist/external-findings.js.map +1 -1
- package/dist/external-import-contract.d.ts +29 -1
- package/dist/external-import-contract.d.ts.map +1 -1
- package/dist/external-import-contract.js +314 -44
- package/dist/external-import-contract.js.map +1 -1
- package/dist/external-import-models.d.ts +1 -1
- package/dist/external-import-models.d.ts.map +1 -1
- package/dist/external-import-models.js.map +1 -1
- package/dist/finding-normalization.d.ts +1 -1
- package/dist/finding-normalization.d.ts.map +1 -1
- package/dist/finding-normalization.js +46 -11
- package/dist/finding-normalization.js.map +1 -1
- package/dist/finding-retrieval.d.ts +3 -3
- package/dist/finding-retrieval.d.ts.map +1 -1
- package/dist/finding-retrieval.js.map +1 -1
- package/dist/finding-workflow.d.ts +6 -1
- package/dist/finding-workflow.d.ts.map +1 -1
- package/dist/finding-workflow.js +2 -2
- package/dist/finding-workflow.js.map +1 -1
- package/dist/git-remote.d.ts +4 -0
- package/dist/git-remote.d.ts.map +1 -1
- package/dist/git-remote.js +20 -0
- package/dist/git-remote.js.map +1 -1
- package/dist/github-advisories.d.ts +3 -12
- package/dist/github-advisories.d.ts.map +1 -1
- package/dist/github-advisories.js +9 -29
- package/dist/github-advisories.js.map +1 -1
- package/dist/github-dependabot-findings.d.ts.map +1 -1
- package/dist/github-dependabot-findings.js +7 -16
- package/dist/github-dependabot-findings.js.map +1 -1
- package/dist/github-findings.d.ts.map +1 -1
- package/dist/github-findings.js +344 -56
- package/dist/github-findings.js.map +1 -1
- package/dist/github.d.ts +17 -7
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +43 -30
- package/dist/github.js.map +1 -1
- package/dist/host-protocol.d.ts +7 -2
- package/dist/host-protocol.d.ts.map +1 -1
- package/dist/host-protocol.js +27 -3
- package/dist/host-protocol.js.map +1 -1
- package/dist/host-records-protocol.d.ts +10 -11
- package/dist/host-records-protocol.d.ts.map +1 -1
- package/dist/host-records-protocol.js +69 -9
- package/dist/host-records-protocol.js.map +1 -1
- package/dist/hosted-scan.d.ts +15 -0
- package/dist/hosted-scan.d.ts.map +1 -1
- package/dist/hosted-scan.js +55 -33
- package/dist/hosted-scan.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/inspector-findings.d.ts +9 -0
- package/dist/inspector-findings.d.ts.map +1 -0
- package/dist/inspector-findings.js +512 -0
- package/dist/inspector-findings.js.map +1 -0
- package/dist/knowledge-base.js +18 -5
- package/dist/knowledge-base.js.map +1 -1
- package/dist/local-git-metadata.d.ts +5 -0
- package/dist/local-git-metadata.d.ts.map +1 -0
- package/dist/local-git-metadata.js +131 -0
- package/dist/local-git-metadata.js.map +1 -0
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +22 -12
- package/dist/multiscan.js.map +1 -1
- package/dist/opengrep-findings.d.ts.map +1 -1
- package/dist/opengrep-findings.js +34 -20
- package/dist/opengrep-findings.js.map +1 -1
- package/dist/patch-tui.d.ts +1 -1
- package/dist/patch-tui.d.ts.map +1 -1
- package/dist/patch-tui.js +94 -36
- package/dist/patch-tui.js.map +1 -1
- package/dist/private-finding-import.d.ts +246 -0
- package/dist/private-finding-import.d.ts.map +1 -0
- package/dist/private-finding-import.js +387 -0
- package/dist/private-finding-import.js.map +1 -0
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +2 -2
- package/dist/project-config.js.map +1 -1
- package/dist/provider-profile.d.ts +10 -2
- package/dist/provider-profile.d.ts.map +1 -1
- package/dist/provider-profile.js +72 -10
- package/dist/provider-profile.js.map +1 -1
- package/dist/publication.js +7 -1
- package/dist/publication.js.map +1 -1
- package/dist/reader-selection.d.ts +13 -0
- package/dist/reader-selection.d.ts.map +1 -0
- package/dist/reader-selection.js +81 -0
- package/dist/reader-selection.js.map +1 -0
- package/dist/record.d.ts +6 -1
- package/dist/record.d.ts.map +1 -1
- package/dist/record.js +53 -2
- package/dist/record.js.map +1 -1
- package/dist/remediation.d.ts +5 -0
- package/dist/remediation.d.ts.map +1 -1
- package/dist/remediation.js +30 -0
- package/dist/remediation.js.map +1 -1
- package/dist/result.d.ts +2 -0
- package/dist/result.d.ts.map +1 -1
- package/dist/result.js +3 -1
- package/dist/result.js.map +1 -1
- package/dist/runtime.d.ts +5 -3
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +110 -57
- package/dist/runtime.js.map +1 -1
- package/dist/scan-activity.js +40 -17
- package/dist/scan-activity.js.map +1 -1
- package/dist/scan-comparison.d.ts +1 -1
- package/dist/scan-comparison.d.ts.map +1 -1
- package/dist/scan-comparison.js +11 -13
- package/dist/scan-comparison.js.map +1 -1
- package/dist/scan-dashboard.d.ts +1 -0
- package/dist/scan-dashboard.d.ts.map +1 -1
- package/dist/scan-dashboard.js +37 -48
- package/dist/scan-dashboard.js.map +1 -1
- package/dist/scan-executor.d.ts +2 -0
- package/dist/scan-executor.d.ts.map +1 -1
- package/dist/scan-executor.js.map +1 -1
- package/dist/scan-history-renderer.d.ts.map +1 -1
- package/dist/scan-history-renderer.js +22 -9
- package/dist/scan-history-renderer.js.map +1 -1
- package/dist/scan-logs.d.ts.map +1 -1
- package/dist/scan-logs.js +5 -5
- package/dist/scan-logs.js.map +1 -1
- package/dist/scanner-import.d.ts +48 -3
- package/dist/scanner-import.d.ts.map +1 -1
- package/dist/scanner-import.js +214 -39
- package/dist/scanner-import.js.map +1 -1
- package/dist/scanner-repository-url.d.ts +14 -0
- package/dist/scanner-repository-url.d.ts.map +1 -0
- package/dist/scanner-repository-url.js +67 -0
- package/dist/scanner-repository-url.js.map +1 -0
- package/dist/semgrep-findings.d.ts.map +1 -1
- package/dist/semgrep-findings.js +50 -88
- package/dist/semgrep-findings.js.map +1 -1
- package/dist/semgrep-platform-findings.d.ts +12 -0
- package/dist/semgrep-platform-findings.d.ts.map +1 -0
- package/dist/semgrep-platform-findings.js +198 -0
- package/dist/semgrep-platform-findings.js.map +1 -0
- package/dist/severity-rubric.d.ts +20 -0
- package/dist/severity-rubric.d.ts.map +1 -0
- package/dist/severity-rubric.js +73 -0
- package/dist/severity-rubric.js.map +1 -0
- package/dist/severity-store.js +15 -5
- package/dist/severity-store.js.map +1 -1
- package/dist/snyk-findings.d.ts.map +1 -1
- package/dist/snyk-findings.js +97 -106
- package/dist/snyk-findings.js.map +1 -1
- package/dist/sonar-collector.d.ts +16 -0
- package/dist/sonar-collector.d.ts.map +1 -0
- package/dist/sonar-collector.js +383 -0
- package/dist/sonar-collector.js.map +1 -0
- package/dist/sonar-findings.d.ts +49 -0
- package/dist/sonar-findings.d.ts.map +1 -0
- package/dist/sonar-findings.js +288 -0
- package/dist/sonar-findings.js.map +1 -0
- package/dist/sonar-import.d.ts +111 -0
- package/dist/sonar-import.d.ts.map +1 -0
- package/dist/sonar-import.js +279 -0
- package/dist/sonar-import.js.map +1 -0
- package/dist/suggest-owners.d.ts.map +1 -1
- package/dist/suggest-owners.js +2 -1
- package/dist/suggest-owners.js.map +1 -1
- package/dist/targets.d.ts +3 -0
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +18 -12
- package/dist/targets.js.map +1 -1
- package/dist/terminal-columns.d.ts +4 -0
- package/dist/terminal-columns.d.ts.map +1 -0
- package/dist/terminal-columns.js +19 -0
- package/dist/terminal-columns.js.map +1 -0
- package/dist/validation-records.d.ts +0 -3
- package/dist/validation-records.d.ts.map +1 -1
- package/dist/validation-records.js +0 -16
- package/dist/validation-records.js.map +1 -1
- package/dist/veracode-findings.d.ts +7 -0
- package/dist/veracode-findings.d.ts.map +1 -0
- package/dist/veracode-findings.js +371 -0
- package/dist/veracode-findings.js.map +1 -0
- package/dist/windows-path.d.ts.map +1 -1
- package/dist/windows-path.js +1 -0
- package/dist/windows-path.js.map +1 -1
- package/dist/wiz-csv.d.ts +2 -2
- package/dist/wiz-csv.d.ts.map +1 -1
- package/dist/wiz-csv.js +1 -3
- package/dist/wiz-csv.js.map +1 -1
- package/dist/wiz-findings.d.ts +10 -2
- package/dist/wiz-findings.d.ts.map +1 -1
- package/dist/wiz-findings.js +88 -49
- package/dist/wiz-findings.js.map +1 -1
- package/docs/classify-severity-records.md +1 -1
- package/docs/cli.md +320 -481
- package/docs/dedupe-records.md +27 -4
- package/docs/findings-service.md +21 -8
- package/docs/hosted-scans.md +16 -1
- package/package.json +9 -10
- package/schemas/external-findings.schema.json +12 -1
- package/schemas/hosted-scan-v2.fixture.json +16 -1
- package/_bundled_plugin/scripts/validate_tracking_source.py +0 -82
- package/_bundled_plugin/scripts/workbench_local_dedupe.py +0 -136
- package/dist/deduplication/records-protocol.d.ts +0 -4
- package/dist/deduplication/records-protocol.d.ts.map +0 -1
- package/dist/deduplication/records-protocol.js +0 -35
- package/dist/deduplication/records-protocol.js.map +0 -1
package/dist/codex-prompt.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export declare const MAX_CODEX_INPUT_CHARACTERS: number;
|
|
2
|
+
export declare function characterCount(value: string): number;
|
|
1
3
|
export declare function shellEnvironmentReference(name: string, suffix?: string): string;
|
|
2
4
|
export declare function pluginPythonCommand(): string;
|
|
3
5
|
export declare function jsonForPrompt(value: unknown): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex-prompt.d.ts","sourceRoot":"","sources":["../src/codex-prompt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"codex-prompt.d.ts","sourceRoot":"","sources":["../src/codex-prompt.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B,QAAU,CAAC;AAElD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,SAAK,GAAG,MAAM,CAE3E;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKpD"}
|
package/dist/codex-prompt.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
// Codex's upstream limit applies to Unicode characters in one user message.
|
|
2
|
+
// https://github.com/openai/codex/blob/956f590ad549e75913894614ce0cbec4d5fd677a/codex-rs/protocol/src/user_input.rs#L8-L9
|
|
3
|
+
export const MAX_CODEX_INPUT_CHARACTERS = 1 << 20;
|
|
4
|
+
export function characterCount(value) {
|
|
5
|
+
return value[Symbol.iterator]().reduce((count) => count + 1, 0);
|
|
6
|
+
}
|
|
1
7
|
export function shellEnvironmentReference(name, suffix = "") {
|
|
2
8
|
return `"${process.platform === "win32" ? "$env:" : "$"}${name}${suffix}"`;
|
|
3
9
|
}
|
package/dist/codex-prompt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex-prompt.js","sourceRoot":"","sources":["../src/codex-prompt.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,yBAAyB,CAAC,IAAY,EAAE,MAAM,GAAG,EAAE;IACjE,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,GAAG,MAAM,GAAG,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,OAAO,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,yBAAyB,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC7F,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;SACzB,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC;SAC/B,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC;SAC/B,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AACrC,CAAC","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"codex-prompt.js","sourceRoot":"","sources":["../src/codex-prompt.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,0HAA0H;AAC1H,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAI,EAAE,CAAC;AAElD,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,IAAY,EAAE,MAAM,GAAG,EAAE;IACjE,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,GAAG,MAAM,GAAG,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,OAAO,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,yBAAyB,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC7F,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;SACzB,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC;SAC/B,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC;SAC/B,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AACrC,CAAC","sourcesContent":["// Codex's upstream limit applies to Unicode characters in one user message.\n// https://github.com/openai/codex/blob/956f590ad549e75913894614ce0cbec4d5fd677a/codex-rs/protocol/src/user_input.rs#L8-L9\nexport const MAX_CODEX_INPUT_CHARACTERS = 1 << 20;\n\nexport function characterCount(value: string): number {\n return value[Symbol.iterator]().reduce((count) => count + 1, 0);\n}\n\nexport function shellEnvironmentReference(name: string, suffix = \"\"): string {\n return `\"${process.platform === \"win32\" ? \"$env:\" : \"$\"}${name}${suffix}\"`;\n}\n\nexport function pluginPythonCommand(): string {\n return `${process.platform === \"win32\" ? \"& \" : \"\"}${shellEnvironmentReference(\"PYTHON\")}`;\n}\n\nexport function jsonForPrompt(value: unknown): string {\n return JSON.stringify(value)\n .replaceAll(\"\\u0085\", \"\\\\u0085\")\n .replaceAll(\"\\u2028\", \"\\\\u2028\")\n .replaceAll(\"\\u2029\", \"\\\\u2029\");\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-scan.d.ts","sourceRoot":"","sources":["../src/component-scan.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,aAAa,
|
|
1
|
+
{"version":3,"file":"component-scan.d.ts","sourceRoot":"","sources":["../src/component-scan.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,aAAa,EAMb,KAAK,kBAAkB,EAExB,MAAM,UAAU,CAAC;AAClB,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC9B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAKL,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,QAAQ,EACR,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAQ3E,MAAM,WAAW,oBAAoB;IAGnC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,aAAa,CAAC,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M,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,6BAA6B,CAAC;IAC9C,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,mBAAmB,CAAC,CAiO9B"}
|
package/dist/component-scan.js
CHANGED
|
@@ -2,9 +2,9 @@ import { notify } from "./value.js";
|
|
|
2
2
|
import { writeFile } from "node:fs/promises";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { basename, join, relative, resolve, sep } from "node:path";
|
|
5
|
-
import { CodexSecurity, DEFAULT_DEPENDENCIES, scanAuthentication, selectedScanEnvironment, } from "./api.js";
|
|
5
|
+
import { CodexSecurity, DEFAULT_DEPENDENCIES, scanAuthentication, scanCodexHome, selectedScanEnvironment, } from "./api.js";
|
|
6
6
|
import { normalizeComponentPlan, planComponents, } from "./component-plan.js";
|
|
7
|
-
import { hasCommandAuth, mergedCodexConfig, scanModelProvider, } from "./config.js";
|
|
7
|
+
import { hasCommandAuth, mergedCodexConfig, scanModelProvider, scanProviderEnvKey, } from "./config.js";
|
|
8
8
|
import { readThreatModelPath } from "./artifact-export.js";
|
|
9
9
|
import { errorMessage } from "./errors.js";
|
|
10
10
|
import { matchScanFindingsInternal, } from "./scan-comparison.js";
|
|
@@ -20,10 +20,11 @@ export async function runComponentScans(options) {
|
|
|
20
20
|
let environment = options.environment;
|
|
21
21
|
if (auth !== undefined && auth !== "auto") {
|
|
22
22
|
const source = environment ?? process.env;
|
|
23
|
-
const configuration = await mergedCodexConfig(options.config ?? {});
|
|
23
|
+
const configuration = await mergedCodexConfig(options.config ?? {}, scanCodexHome(source));
|
|
24
24
|
const provider = scanModelProvider(configuration);
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const providerEnvKey = scanProviderEnvKey(configuration);
|
|
26
|
+
scanAuthentication(source, auth, provider, hasCommandAuth(configuration), false, providerEnvKey);
|
|
27
|
+
environment = selectedScanEnvironment(source, auth, provider, providerEnvKey);
|
|
27
28
|
}
|
|
28
29
|
const repository = await normalizeRepository(options.repository, options.signal);
|
|
29
30
|
const protectedRoot = (await enclosingGitWorktreeRoot(repository, options.signal)) ?? repository;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-scan.js","sourceRoot":"","sources":["../src/component-scan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,GAIxB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,sBAAsB,EACtB,cAAc,GAGf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,iBAAiB,GAElB,MAAM,aAAa,CAAC;AAOrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAM3C,OAAO,EACL,yBAAyB,GAE1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AA2F7E,MAAM,C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oBAAoB,OAAO,CAAC,EAAE,KAAK,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACzJ,CAAC,CAAC;QACF,EAAE;QACF,aAAa;QACb,EAAE;QACF,GAAG,QAAQ,CAAC,GAAG,CACb,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CACvB,KAAK,OAAO,CAAC,QAAQ,CAAC,KAAK,KAAK,OAAO,CAAC,KAAK,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,IAAI,WAAW,OAAO,WAAW,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CACnJ;QACD,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,KAAK,UAAU,SAAS,CAAC,IAAY,EAAE,KAAc;IACnD,MAAM,SAAS,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;QAC3D,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,KAAK;KACZ,CAAC,CAAC;AACL,CAAC;AAED,SAAS,WAAW,CAAC,OAAyB;IAC5C,OAAO,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;AACnD,CAAC","sourcesContent":["import { notify } from \"./value.js\";\nimport { writeFile } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { basename, join, relative, resolve, sep } from \"node:path\";\nimport {\n CodexSecurity,\n DEFAULT_DEPENDENCIES,\n scanAuthentication,\n selectedScanEnvironment,\n type CodexSecuritySurface,\n type ScanAuthentication,\n type ScanOptions,\n} from \"./api.js\";\nimport {\n normalizeComponentPlan,\n planComponents,\n type ComponentPlan,\n type ComponentPlanningOptions,\n} from \"./component-plan.js\";\nimport {\n hasCommandAuth,\n mergedCodexConfig,\n scanModelProvider,\n type CodexSecurityConfig,\n} from \"./config.js\";\nimport type {\n ScanCost,\n ScanSessionEvent,\n ScanUsageObservation,\n} from \"./cost.js\";\nimport type { ScanTokenUsage } from \"./cost-model.js\";\nimport { readThreatModelPath } from \"./artifact-export.js\";\nimport { errorMessage } from \"./errors.js\";\nimport type { Finding } from \"./models.js\";\nimport type { ScanResult } from \"./result.js\";\nimport type { ScanActivity } from \"./scan-activity.js\";\nimport type { ScanSettings } from \"./scan-settings.js\";\nimport type { ScanProgress, ScanWorkerStatus } from \"./worker-progress.js\";\nimport {\n matchScanFindingsInternal,\n type ScanComparisonResult,\n} from \"./scan-comparison.js\";\nimport { prepareOutputDir, requireOutputOutsideRepository } from \"./runtime.js\";\nimport { enclosingGitWorktreeRoot, normalizeRepository } from \"./targets.js\";\n\nexport interface ComponentScanOptions {\n /** @internal Calling surface, inherited by planning, scans, and matching. */\n surface?: CodexSecuritySurface;\n repository: string;\n outputDir: string;\n components?: ComponentPlan[\"components\"];\n auto?: boolean;\n planOnly?: boolean;\n workers?: number;\n config?: CodexSecurityConfig;\n scanOptions?: Omit<ScanSettings, \"target\" | \"outputDir\">;\n signal?: AbortSignal;\n createSecurity?: (\n config: CodexSecurityConfig,\n ) => Pick<CodexSecurity, \"run\" | \"close\">;\n planComponents?: (\n repository: string,\n options: ComponentPlanningOptions,\n ) => Promise<ComponentPlan>;\n environment?: NodeJS.ProcessEnv;\n /** @internal */\n matchFindings?: typeof matchScanFindingsInternal;\n onPlan?: (components: ComponentReceipt[]) => void;\n onScanEvent?: (event: ComponentScanEvent) => void;\n onComplete?: (result: ComponentScanResult) => void;\n onDeduplicationStarted?: () => void;\n onProgress?: (component: ComponentReceipt) => void;\n}\n\nexport interface ComponentReceipt {\n id: string;\n name: string;\n paths: string[];\n status: \"pending\" | \"started\" | \"completed\" | \"failed\";\n outputDir: string;\n scanId?: string;\n threatModelPath?: string;\n findingCount?: number;\n cost?: Readonly<ScanCost>;\n error?: string;\n}\n\ntype ComponentScanUpdate =\n | { type: \"authentication\"; value: ScanAuthentication }\n | { type: \"progress\"; value: ScanProgress }\n | { type: \"activity\"; value: ScanActivity }\n | { type: \"session\"; value: ScanSessionEvent }\n | { type: \"cost\"; value: Readonly<ScanCost> }\n | { type: \"usage\"; value: Readonly<ScanTokenUsage> }\n | { type: \"usage-observation\"; value: Readonly<ScanUsageObservation> }\n | { type: \"workers\"; value: ScanWorkerStatus }\n | { type: \"warning\"; value: string };\n\nexport type ComponentScanEvent = ComponentScanUpdate & { componentId: string };\n\ninterface FindingSource {\n componentId: string;\n scanId: string;\n occurrenceId: string;\n scanDir: string;\n}\n\ninterface CombinedFinding {\n finding: Finding;\n sources: FindingSource[];\n}\n\nexport interface ComponentDeduplicationSummary {\n status: \"completed\" | \"failed\";\n confirmedGroups: number;\n uncertainPairs: number;\n error?: string;\n}\n\nexport interface ComponentScanResult {\n total: number;\n completed: number;\n failed: number;\n planPath: string;\n summaryPath?: string;\n findingsPath?: string;\n reportPath?: string;\n retryPlanPath?: string;\n findingCount?: number;\n sourceFindingCount?: number;\n deduplication?: ComponentDeduplicationSummary;\n policyFailed?: boolean;\n}\n\nexport async function runComponentScans(\n options: ComponentScanOptions,\n): Promise<ComponentScanResult> {\n const workers = options.workers ?? 4;\n if (!Number.isSafeInteger(workers) || workers < 1)\n throw new Error(\"Component workers must be a positive integer.\");\n if (Boolean(options.auto) === (options.components !== undefined))\n throw new Error(\"Choose components or automatic planning, not both.\");\n const auth = options.scanOptions?.auth;\n let environment = options.environment;\n if (auth !== undefined && auth !== \"auto\") {\n const source = environment ?? process.env;\n const configuration = await mergedCodexConfig(options.config ?? {});\n const provider = scanModelProvider(configuration);\n scanAuthentication(source, auth, provider, hasCommandAuth(configuration));\n environment = selectedScanEnvironment(source, auth, provider);\n }\n const repository = await normalizeRepository(\n options.repository,\n options.signal,\n );\n const protectedRoot =\n (await enclosingGitWorktreeRoot(repository, options.signal)) ?? repository;\n const output = await prepareOutputDir(\n options.outputDir,\n basename(repository),\n undefined,\n (path) => requireOutputOutsideRepository(protectedRoot, path),\n );\n const plan = await normalizeComponentPlan(\n repository,\n options.auto\n ? await (options.planComponents ?? planComponents)(repository, {\n auth,\n surface: options.surface ?? \"sdk\",\n cyberAccessProgram: options.scanOptions?.cyberAccessProgram,\n config: options.config,\n environment,\n signal: options.signal,\n })\n : { components: options.components },\n options.signal,\n );\n const planPath = join(output, \"components.json\");\n await writeJson(planPath, plan);\n const base = {\n total: plan.components.length,\n completed: 0,\n failed: 0,\n planPath,\n };\n if (options.planOnly) return base;\n\n const receipts: ComponentReceipt[] = plan.components.map(\n (component, index) => ({\n ...component,\n id: `component-${index + 1}`,\n status: \"pending\",\n outputDir: join(output, `component-${index + 1}`),\n }),\n );\n notify(() => options.onPlan?.(receipts.map(copyReceipt)));\n const results = new Map<string, ScanResult>();\n let next = 0;\n const settled = await Promise.allSettled(\n Array.from({ length: Math.min(workers, receipts.length) }, async () => {\n const security = (\n options.createSecurity ??\n ((config) =>\n new CodexSecurity(\n config,\n {\n ...DEFAULT_DEPENDENCIES,\n environment: options.environment ?? process.env,\n },\n { surface: options.surface ?? \"sdk\" },\n ))\n )(options.config ?? {});\n try {\n while (!options.signal?.aborted) {\n const receipt = receipts[next++];\n if (receipt === undefined) return;\n receipt.status = \"started\";\n notify(() => options.onProgress?.(copyReceipt(receipt)));\n const emit = (event: ComponentScanUpdate): void =>\n notify(() =>\n options.onScanEvent?.({ ...event, componentId: receipt.id }),\n );\n const observers: ScanOptions =\n options.onScanEvent === undefined\n ? {}\n : {\n onAuthentication: (value) =>\n emit({ type: \"authentication\", value }),\n onProgress: (value) => emit({ type: \"progress\", value }),\n onActivity: (value) => emit({ type: \"activity\", value }),\n onSessionEvent: (value) => emit({ type: \"session\", value }),\n onCost: (value) => emit({ type: \"cost\", value }),\n onUsage: (value) => emit({ type: \"usage\", value }),\n onUsageObservation: (value) =>\n emit({ type: \"usage-observation\", value }),\n onWorkerStatus: (value) => emit({ type: \"workers\", value }),\n onWarning: (value) => emit({ type: \"warning\", value }),\n };\n try {\n const result = await security.run(repository, {\n ...options.scanOptions,\n ...observers,\n mode: options.scanOptions?.mode ?? \"standard\",\n target: receipt.paths.map((path) => resolve(repository, path)),\n outputDir: receipt.outputDir,\n signal: options.signal,\n });\n if (result.manifest.scan.status !== \"completed\")\n throw new Error(`Component scan ${result.manifest.scan.status}.`);\n results.set(receipt.id, result);\n receipt.scanId = result.manifest.scan.id;\n receipt.findingCount = result.findings.findings.length;\n if (result.cost !== null) receipt.cost = result.cost;\n receipt.status = \"completed\";\n if (result.threatModelPath !== null)\n receipt.threatModelPath = result.threatModelPath;\n } catch (error) {\n receipt.status = \"failed\";\n receipt.error = errorMessage(error);\n if (!options.signal?.aborted) {\n const path = await readThreatModelPath(receipt.outputDir, {\n pythonPath: options.config?.pythonPath,\n protectedRoot,\n signal: options.signal,\n });\n if (path !== null) receipt.threatModelPath = path;\n }\n }\n notify(() => options.onProgress?.(copyReceipt(receipt)));\n }\n } finally {\n await security.close();\n }\n }),\n );\n const failed = settled.find((result) => result.status === \"rejected\");\n for (const receipt of receipts) {\n if (receipt.status === \"pending\" || receipt.status === \"started\") {\n receipt.status = \"failed\";\n receipt.error = options.signal?.aborted\n ? \"Scan canceled.\"\n : \"Component scan did not finish.\";\n notify(() => options.onProgress?.(copyReceipt(receipt)));\n }\n }\n const { findings, matches, uncertain, related, error } =\n await deduplicateFindings(receipts, results, { ...options, environment });\n const deduplication: ComponentDeduplicationSummary = {\n status: error === undefined ? \"completed\" : \"failed\",\n confirmedGroups: matches.length,\n uncertainPairs: uncertain.length,\n ...(error === undefined ? {} : { error }),\n };\n const retryComponents = receipts\n .filter(({ status }) => status === \"failed\")\n .map(({ name, paths }) => ({ name, paths }));\n const retryPlanPath =\n retryComponents.length === 0\n ? undefined\n : join(output, \"retry-components.json\");\n if (retryPlanPath !== undefined)\n await writeJson(retryPlanPath, { components: retryComponents });\n const failureSeverity = options.scanOptions?.failureSeverity;\n const summary = {\n ...base,\n completed: receipts.filter(({ status }) => status === \"completed\").length,\n failed: receipts.filter(({ status }) => status === \"failed\").length,\n summaryPath: join(output, \"summary.json\"),\n findingsPath: join(output, \"findings.json\"),\n reportPath: join(output, \"report.md\"),\n ...(retryPlanPath === undefined ? {} : { retryPlanPath }),\n findingCount: findings.length,\n sourceFindingCount: findings.reduce(\n (total, finding) => total + finding.sources.length,\n 0,\n ),\n deduplication,\n ...(failureSeverity === undefined\n ? {}\n : {\n policyFailed: [...results.values()].some((result) =>\n result.hasFindingsAtOrAbove(failureSeverity),\n ),\n }),\n };\n await writeJson(summary.findingsPath, {\n documentType: \"codex-security.component-findings\",\n schemaVersion: \"1.0\",\n findings,\n deduplication: { ...deduplication, matches, uncertain, related },\n });\n await writeJson(summary.summaryPath, {\n ...summary,\n repository,\n components: receipts,\n });\n await writeFile(\n summary.reportPath,\n renderReport(summary, receipts, findings),\n { flag: \"wx\", mode: 0o600 },\n );\n notify(() => options.onComplete?.(summary));\n options.signal?.throwIfAborted();\n if (failed?.status === \"rejected\") throw failed.reason;\n return summary;\n}\n\nasync function deduplicateFindings(\n receipts: ComponentReceipt[],\n results: Map<string, ScanResult>,\n options: ComponentScanOptions,\n): Promise<\n ScanComparisonResult & { findings: CombinedFinding[]; error?: string }\n> {\n const scans = receipts.flatMap((receipt) => {\n const findings = results.get(receipt.id)?.findings.findings ?? [];\n return findings.length ? [{ receipt, findings }] : [];\n });\n let findings: CombinedFinding[] = scans.flatMap(({ receipt, findings }) =>\n findings.map((finding) => ({\n finding,\n sources: [\n {\n componentId: receipt.id,\n scanId: receipt.scanId!,\n occurrenceId: finding.occurrenceId,\n scanDir: receipt.outputDir,\n },\n ],\n })),\n );\n const matching: ScanComparisonResult = { matches: [], uncertain: [] };\n const [first, ...remaining] = scans;\n const componentFindings = ({\n receipt,\n findings,\n }: (typeof scans)[number]): Finding[] =>\n findings.map((finding) => ({\n ...finding,\n findingId: `${receipt.id}:${finding.findingId}`,\n }));\n const previous = first === undefined ? [] : componentFindings(first);\n let error: string | undefined;\n try {\n options.signal?.throwIfAborted();\n if (remaining.length) notify(() => options.onDeduplicationStarted?.());\n for (const component of remaining) {\n const current = componentFindings(component);\n const comparison = await (\n options.matchFindings ?? matchScanFindingsInternal\n )(\n { before: [...previous], after: current },\n {\n allowHistoricalUncertainty: true,\n auth: options.scanOptions?.auth,\n cyberAccessProgram: options.scanOptions?.cyberAccessProgram,\n config: options.config ?? {},\n environment: options.environment,\n signal: options.signal,\n workingDirectory: tmpdir(),\n },\n { surface: options.surface ?? \"sdk\" },\n );\n matching.matches.push(...comparison.matches);\n matching.uncertain.push(...comparison.uncertain);\n if (comparison.related !== undefined) {\n matching.related ??= [];\n matching.related.push(...comparison.related);\n }\n for (const match of comparison.matches) {\n findings = mergeFindingGroups(\n findings,\n new Set([...match.beforeOccurrenceIds, ...match.afterOccurrenceIds]),\n );\n }\n previous.push(...current);\n }\n } catch (failure) {\n error = options.signal?.aborted\n ? \"Cross-component matching was canceled.\"\n : errorMessage(failure);\n }\n const remainSeparate = ({\n beforeOccurrenceId,\n afterOccurrenceId,\n }: ScanComparisonResult[\"uncertain\"][number]): boolean =>\n !findings.some(\n ({ sources }) =>\n sources.some(\n ({ occurrenceId }) => occurrenceId === beforeOccurrenceId,\n ) &&\n sources.some(({ occurrenceId }) => occurrenceId === afterOccurrenceId),\n );\n matching.uncertain = matching.uncertain.filter(remainSeparate);\n if (matching.related !== undefined) {\n matching.related = matching.related.filter(remainSeparate);\n }\n return { findings, ...matching, ...(error === undefined ? {} : { error }) };\n}\n\nfunction mergeFindingGroups(\n findings: CombinedFinding[],\n occurrenceIds: Set<string>,\n): CombinedFinding[] {\n const selected = findings.filter(({ sources }) =>\n sources.some(({ occurrenceId }) => occurrenceIds.has(occurrenceId)),\n );\n if (selected.length < 2) return findings;\n const merged = {\n finding: selected.map(({ finding }) => finding).reduce(strongerFinding),\n sources: selected.flatMap(({ sources }) => sources),\n };\n return findings.flatMap((group) =>\n group === selected[0] ? [merged] : selected.includes(group) ? [] : [group],\n );\n}\n\nfunction strongerFinding(first: Finding, second: Finding): Finding {\n const levels = [\"critical\", \"high\", \"medium\", \"low\", \"informational\"];\n return levels.indexOf(second.severity.level) <\n levels.indexOf(first.severity.level)\n ? second\n : first;\n}\n\nfunction renderReport(\n summary: ComponentScanResult,\n receipts: ComponentReceipt[],\n findings: CombinedFinding[],\n): string {\n return [\n \"# Component scan report\",\n \"\",\n `${summary.completed} complete, ${summary.failed} failed. ${findings.length} finding groups.`,\n ...(summary.deduplication?.status === \"failed\"\n ? [\"\", `Cross-component matching failed: ${summary.deduplication.error}`]\n : []),\n ...(summary.deduplication?.uncertainPairs\n ? [\n \"\",\n `${summary.deduplication.uncertainPairs} possible duplicate pairs remain separate. See findings.json.`,\n ]\n : []),\n \"\",\n \"Coverage applies only to the selected components. See each scan for exclusions and deferred work.\",\n ...(summary.retryPlanPath === undefined\n ? []\n : [\"\", \"[Retry plan for failed components](./retry-components.json)\"]),\n \"\",\n \"## Components\",\n \"\",\n ...receipts.map((receipt) => {\n const modelLink = receipt.threatModelPath\n ? ` · [Threat model](./${receipt.id}/${relative(receipt.outputDir, receipt.threatModelPath).split(sep).join(\"/\")})`\n : \"\";\n return `- ${JSON.stringify(receipt.name)}: ${receipt.status}. [Scan files](./${receipt.id}/)${modelLink}${receipt.error ? ` — ${receipt.error}` : \"\"}`;\n }),\n \"\",\n \"## Findings\",\n \"\",\n ...findings.map(\n ({ finding, sources }) =>\n `- ${finding.severity.level}: ${finding.title} (${sources.map(({ componentId }) => `[${componentId}](./${componentId}/report.md)`).join(\", \")})`,\n ),\n \"\",\n ].join(\"\\n\");\n}\n\nasync function writeJson(path: string, value: unknown): Promise<void> {\n await writeFile(path, `${JSON.stringify(value, null, 2)}\\n`, {\n flag: \"wx\",\n mode: 0o600,\n });\n}\n\nfunction copyReceipt(receipt: ComponentReceipt): ComponentReceipt {\n return { ...rece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AG,QAAQ,CAAC,GAAG,CACb,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CACvB,KAAK,OAAO,CAAC,QAAQ,CAAC,KAAK,KAAK,OAAO,CAAC,KAAK,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,IAAI,WAAW,OAAO,WAAW,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CACnJ;QACD,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,KAAK,UAAU,SAAS,CAAC,IAAY,EAAE,KAAc;IACnD,MAAM,SAAS,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;QAC3D,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,KAAK;KACZ,CAAC,CAAC;AACL,CAAC;AAED,SAAS,WAAW,CAAC,OAAyB;IAC5C,OAAO,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;AACnD,CAAC","sourcesContent":["import { notify } from \"./value.js\";\nimport { writeFile } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { basename, join, relative, resolve, sep } from \"node:path\";\nimport {\n CodexSecurity,\n DEFAULT_DEPENDENCIES,\n scanAuthentication,\n scanCodexHome,\n selectedScanEnvironment,\n type CodexSecuritySurface,\n type ScanAuthentication,\n type ScanOptions,\n} from \"./api.js\";\nimport {\n normalizeComponentPlan,\n planComponents,\n type ComponentPlan,\n type ComponentPlanningOptions,\n} from \"./component-plan.js\";\nimport {\n hasCommandAuth,\n mergedCodexConfig,\n scanModelProvider,\n scanProviderEnvKey,\n type CodexSecurityConfig,\n} from \"./config.js\";\nimport type {\n ScanCost,\n ScanSessionEvent,\n ScanUsageObservation,\n} from \"./cost.js\";\nimport type { ScanTokenUsage } from \"./cost-model.js\";\nimport { readThreatModelPath } from \"./artifact-export.js\";\nimport { errorMessage } from \"./errors.js\";\nimport type { Finding } from \"./models.js\";\nimport type { ScanResult } from \"./result.js\";\nimport type { ScanActivity } from \"./scan-activity.js\";\nimport type { ScanSettings } from \"./scan-settings.js\";\nimport type { ScanProgress, ScanWorkerStatus } from \"./worker-progress.js\";\nimport {\n matchScanFindingsInternal,\n type ScanComparisonResult,\n} from \"./scan-comparison.js\";\nimport { prepareOutputDir, requireOutputOutsideRepository } from \"./runtime.js\";\nimport { enclosingGitWorktreeRoot, normalizeRepository } from \"./targets.js\";\n\nexport interface ComponentScanOptions {\n /** @internal Calling surface, inherited by planning, scans, and matching. */\n surface?: CodexSecuritySurface;\n repository: string;\n outputDir: string;\n components?: ComponentPlan[\"components\"];\n auto?: boolean;\n planOnly?: boolean;\n workers?: number;\n config?: CodexSecurityConfig;\n scanOptions?: Omit<ScanSettings, \"target\" | \"outputDir\">;\n signal?: AbortSignal;\n createSecurity?: (\n config: CodexSecurityConfig,\n ) => Pick<CodexSecurity, \"run\" | \"close\">;\n planComponents?: (\n repository: string,\n options: ComponentPlanningOptions,\n ) => Promise<ComponentPlan>;\n environment?: NodeJS.ProcessEnv;\n /** @internal */\n matchFindings?: typeof matchScanFindingsInternal;\n onPlan?: (components: ComponentReceipt[]) => void;\n onScanEvent?: (event: ComponentScanEvent) => void;\n onComplete?: (result: ComponentScanResult) => void;\n onDeduplicationStarted?: () => void;\n onProgress?: (component: ComponentReceipt) => void;\n}\n\nexport interface ComponentReceipt {\n id: string;\n name: string;\n paths: string[];\n status: \"pending\" | \"started\" | \"completed\" | \"failed\";\n outputDir: string;\n scanId?: string;\n threatModelPath?: string;\n findingCount?: number;\n cost?: Readonly<ScanCost>;\n error?: string;\n}\n\ntype ComponentScanUpdate =\n | { type: \"authentication\"; value: ScanAuthentication }\n | { type: \"progress\"; value: ScanProgress }\n | { type: \"activity\"; value: ScanActivity }\n | { type: \"session\"; value: ScanSessionEvent }\n | { type: \"cost\"; value: Readonly<ScanCost> }\n | { type: \"usage\"; value: Readonly<ScanTokenUsage> }\n | { type: \"usage-observation\"; value: Readonly<ScanUsageObservation> }\n | { type: \"workers\"; value: ScanWorkerStatus }\n | { type: \"warning\"; value: string };\n\nexport type ComponentScanEvent = ComponentScanUpdate & { componentId: string };\n\ninterface FindingSource {\n componentId: string;\n scanId: string;\n occurrenceId: string;\n scanDir: string;\n}\n\ninterface CombinedFinding {\n finding: Finding;\n sources: FindingSource[];\n}\n\nexport interface ComponentDeduplicationSummary {\n status: \"completed\" | \"failed\";\n confirmedGroups: number;\n uncertainPairs: number;\n error?: string;\n}\n\nexport interface ComponentScanResult {\n total: number;\n completed: number;\n failed: number;\n planPath: string;\n summaryPath?: string;\n findingsPath?: string;\n reportPath?: string;\n retryPlanPath?: string;\n findingCount?: number;\n sourceFindingCount?: number;\n deduplication?: ComponentDeduplicationSummary;\n policyFailed?: boolean;\n}\n\nexport async function runComponentScans(\n options: ComponentScanOptions,\n): Promise<ComponentScanResult> {\n const workers = options.workers ?? 4;\n if (!Number.isSafeInteger(workers) || workers < 1)\n throw new Error(\"Component workers must be a positive integer.\");\n if (Boolean(options.auto) === (options.components !== undefined))\n throw new Error(\"Choose components or automatic planning, not both.\");\n const auth = options.scanOptions?.auth;\n let environment = options.environment;\n if (auth !== undefined && auth !== \"auto\") {\n const source = environment ?? process.env;\n const configuration = await mergedCodexConfig(\n options.config ?? {},\n scanCodexHome(source),\n );\n const provider = scanModelProvider(configuration);\n const providerEnvKey = scanProviderEnvKey(configuration);\n scanAuthentication(\n source,\n auth,\n provider,\n hasCommandAuth(configuration),\n false,\n providerEnvKey,\n );\n environment = selectedScanEnvironment(\n source,\n auth,\n provider,\n providerEnvKey,\n );\n }\n const repository = await normalizeRepository(\n options.repository,\n options.signal,\n );\n const protectedRoot =\n (await enclosingGitWorktreeRoot(repository, options.signal)) ?? repository;\n const output = await prepareOutputDir(\n options.outputDir,\n basename(repository),\n undefined,\n (path) => requireOutputOutsideRepository(protectedRoot, path),\n );\n const plan = await normalizeComponentPlan(\n repository,\n options.auto\n ? await (options.planComponents ?? planComponents)(repository, {\n auth,\n surface: options.surface ?? \"sdk\",\n cyberAccessProgram: options.scanOptions?.cyberAccessProgram,\n config: options.config,\n environment,\n signal: options.signal,\n })\n : { components: options.components },\n options.signal,\n );\n const planPath = join(output, \"components.json\");\n await writeJson(planPath, plan);\n const base = {\n total: plan.components.length,\n completed: 0,\n failed: 0,\n planPath,\n };\n if (options.planOnly) return base;\n\n const receipts: ComponentReceipt[] = plan.components.map(\n (component, index) => ({\n ...component,\n id: `component-${index + 1}`,\n status: \"pending\",\n outputDir: join(output, `component-${index + 1}`),\n }),\n );\n notify(() => options.onPlan?.(receipts.map(copyReceipt)));\n const results = new Map<string, ScanResult>();\n let next = 0;\n const settled = await Promise.allSettled(\n Array.from({ length: Math.min(workers, receipts.length) }, async () => {\n const security = (\n options.createSecurity ??\n ((config) =>\n new CodexSecurity(\n config,\n {\n ...DEFAULT_DEPENDENCIES,\n environment: options.environment ?? process.env,\n },\n { surface: options.surface ?? \"sdk\" },\n ))\n )(options.config ?? {});\n try {\n while (!options.signal?.aborted) {\n const receipt = receipts[next++];\n if (receipt === undefined) return;\n receipt.status = \"started\";\n notify(() => options.onProgress?.(copyReceipt(receipt)));\n const emit = (event: ComponentScanUpdate): void =>\n notify(() =>\n options.onScanEvent?.({ ...event, componentId: receipt.id }),\n );\n const observers: ScanOptions =\n options.onScanEvent === undefined\n ? {}\n : {\n onAuthentication: (value) =>\n emit({ type: \"authentication\", value }),\n onProgress: (value) => emit({ type: \"progress\", value }),\n onActivity: (value) => emit({ type: \"activity\", value }),\n onSessionEvent: (value) => emit({ type: \"session\", value }),\n onCost: (value) => emit({ type: \"cost\", value }),\n onUsage: (value) => emit({ type: \"usage\", value }),\n onUsageObservation: (value) =>\n emit({ type: \"usage-observation\", value }),\n onWorkerStatus: (value) => emit({ type: \"workers\", value }),\n onWarning: (value) => emit({ type: \"warning\", value }),\n };\n try {\n const result = await security.run(repository, {\n ...options.scanOptions,\n ...observers,\n mode: options.scanOptions?.mode ?? \"standard\",\n target: receipt.paths.map((path) => resolve(repository, path)),\n outputDir: receipt.outputDir,\n signal: options.signal,\n });\n if (result.manifest.scan.status !== \"completed\")\n throw new Error(`Component scan ${result.manifest.scan.status}.`);\n results.set(receipt.id, result);\n receipt.scanId = result.manifest.scan.id;\n receipt.findingCount = result.findings.findings.length;\n if (result.cost !== null) receipt.cost = result.cost;\n receipt.status = \"completed\";\n if (result.threatModelPath !== null)\n receipt.threatModelPath = result.threatModelPath;\n } catch (error) {\n receipt.status = \"failed\";\n receipt.error = errorMessage(error);\n if (!options.signal?.aborted) {\n const path = await readThreatModelPath(receipt.outputDir, {\n pythonPath: options.config?.pythonPath,\n protectedRoot,\n signal: options.signal,\n });\n if (path !== null) receipt.threatModelPath = path;\n }\n }\n notify(() => options.onProgress?.(copyReceipt(receipt)));\n }\n } finally {\n await security.close();\n }\n }),\n );\n const failed = settled.find((result) => result.status === \"rejected\");\n for (const receipt of receipts) {\n if (receipt.status === \"pending\" || receipt.status === \"started\") {\n receipt.status = \"failed\";\n receipt.error = options.signal?.aborted\n ? \"Scan canceled.\"\n : \"Component scan did not finish.\";\n notify(() => options.onProgress?.(copyReceipt(receipt)));\n }\n }\n const { findings, matches, uncertain, related, error } =\n await deduplicateFindings(receipts, results, { ...options, environment });\n const deduplication: ComponentDeduplicationSummary = {\n status: error === undefined ? \"completed\" : \"failed\",\n confirmedGroups: matches.length,\n uncertainPairs: uncertain.length,\n ...(error === undefined ? {} : { error }),\n };\n const retryComponents = receipts\n .filter(({ status }) => status === \"failed\")\n .map(({ name, paths }) => ({ name, paths }));\n const retryPlanPath =\n retryComponents.length === 0\n ? undefined\n : join(output, \"retry-components.json\");\n if (retryPlanPath !== undefined)\n await writeJson(retryPlanPath, { components: retryComponents });\n const failureSeverity = options.scanOptions?.failureSeverity;\n const summary = {\n ...base,\n completed: receipts.filter(({ status }) => status === \"completed\").length,\n failed: receipts.filter(({ status }) => status === \"failed\").length,\n summaryPath: join(output, \"summary.json\"),\n findingsPath: join(output, \"findings.json\"),\n reportPath: join(output, \"report.md\"),\n ...(retryPlanPath === undefined ? {} : { retryPlanPath }),\n findingCount: findings.length,\n sourceFindingCount: findings.reduce(\n (total, finding) => total + finding.sources.length,\n 0,\n ),\n deduplication,\n ...(failureSeverity === undefined\n ? {}\n : {\n policyFailed: [...results.values()].some((result) =>\n result.hasFindingsAtOrAbove(failureSeverity),\n ),\n }),\n };\n await writeJson(summary.findingsPath, {\n documentType: \"codex-security.component-findings\",\n schemaVersion: \"1.0\",\n findings,\n deduplication: { ...deduplication, matches, uncertain, related },\n });\n await writeJson(summary.summaryPath, {\n ...summary,\n repository,\n components: receipts,\n });\n await writeFile(\n summary.reportPath,\n renderReport(summary, receipts, findings),\n { flag: \"wx\", mode: 0o600 },\n );\n notify(() => options.onComplete?.(summary));\n options.signal?.throwIfAborted();\n if (failed?.status === \"rejected\") throw failed.reason;\n return summary;\n}\n\nasync function deduplicateFindings(\n receipts: ComponentReceipt[],\n results: Map<string, ScanResult>,\n options: ComponentScanOptions,\n): Promise<\n ScanComparisonResult & { findings: CombinedFinding[]; error?: string }\n> {\n const scans = receipts.flatMap((receipt) => {\n const findings = results.get(receipt.id)?.findings.findings ?? [];\n return findings.length ? [{ receipt, findings }] : [];\n });\n let findings: CombinedFinding[] = scans.flatMap(({ receipt, findings }) =>\n findings.map((finding) => ({\n finding,\n sources: [\n {\n componentId: receipt.id,\n scanId: receipt.scanId!,\n occurrenceId: finding.occurrenceId,\n scanDir: receipt.outputDir,\n },\n ],\n })),\n );\n const matching: ScanComparisonResult = { matches: [], uncertain: [] };\n const [first, ...remaining] = scans;\n const componentFindings = ({\n receipt,\n findings,\n }: (typeof scans)[number]): Finding[] =>\n findings.map((finding) => ({\n ...finding,\n findingId: `${receipt.id}:${finding.findingId}`,\n }));\n const previous = first === undefined ? [] : componentFindings(first);\n let error: string | undefined;\n try {\n options.signal?.throwIfAborted();\n if (remaining.length) notify(() => options.onDeduplicationStarted?.());\n for (const component of remaining) {\n const current = componentFindings(component);\n const comparison = await (\n options.matchFindings ?? matchScanFindingsInternal\n )(\n { before: [...previous], after: current },\n {\n allowHistoricalUncertainty: true,\n auth: options.scanOptions?.auth,\n cyberAccessProgram: options.scanOptions?.cyberAccessProgram,\n config: options.config ?? {},\n environment: options.environment,\n signal: options.signal,\n workingDirectory: tmpdir(),\n },\n { surface: options.surface ?? \"sdk\" },\n );\n matching.matches.push(...comparison.matches);\n matching.uncertain.push(...comparison.uncertain);\n if (comparison.related !== undefined) {\n matching.related ??= [];\n matching.related.push(...comparison.related);\n }\n for (const match of comparison.matches) {\n findings = mergeFindingGroups(\n findings,\n new Set([...match.beforeOccurrenceIds, ...match.afterOccurrenceIds]),\n );\n }\n previous.push(...current);\n }\n } catch (failure) {\n error = options.signal?.aborted\n ? \"Cross-component matching was canceled.\"\n : errorMessage(failure);\n }\n const remainSeparate = ({\n beforeOccurrenceId,\n afterOccurrenceId,\n }: ScanComparisonResult[\"uncertain\"][number]): boolean =>\n !findings.some(\n ({ sources }) =>\n sources.some(\n ({ occurrenceId }) => occurrenceId === beforeOccurrenceId,\n ) &&\n sources.some(({ occurrenceId }) => occurrenceId === afterOccurrenceId),\n );\n matching.uncertain = matching.uncertain.filter(remainSeparate);\n if (matching.related !== undefined) {\n matching.related = matching.related.filter(remainSeparate);\n }\n return { findings, ...matching, ...(error === undefined ? {} : { error }) };\n}\n\nfunction mergeFindingGroups(\n findings: CombinedFinding[],\n occurrenceIds: Set<string>,\n): CombinedFinding[] {\n const selected = findings.filter(({ sources }) =>\n sources.some(({ occurrenceId }) => occurrenceIds.has(occurrenceId)),\n );\n if (selected.length < 2) return findings;\n const merged = {\n finding: selected.map(({ finding }) => finding).reduce(strongerFinding),\n sources: selected.flatMap(({ sources }) => sources),\n };\n return findings.flatMap((group) =>\n group === selected[0] ? [merged] : selected.includes(group) ? [] : [group],\n );\n}\n\nfunction strongerFinding(first: Finding, second: Finding): Finding {\n const levels = [\"critical\", \"high\", \"medium\", \"low\", \"informational\"];\n return levels.indexOf(second.severity.level) <\n levels.indexOf(first.severity.level)\n ? second\n : first;\n}\n\nfunction renderReport(\n summary: ComponentScanResult,\n receipts: ComponentReceipt[],\n findings: CombinedFinding[],\n): string {\n return [\n \"# Component scan report\",\n \"\",\n `${summary.completed} complete, ${summary.failed} failed. ${findings.length} finding groups.`,\n ...(summary.deduplication?.status === \"failed\"\n ? [\"\", `Cross-component matching failed: ${summary.deduplication.error}`]\n : []),\n ...(summary.deduplication?.uncertainPairs\n ? [\n \"\",\n `${summary.deduplication.uncertainPairs} possible duplicate pairs remain separate. See findings.json.`,\n ]\n : []),\n \"\",\n \"Coverage applies only to the selected components. See each scan for exclusions and deferred work.\",\n ...(summary.retryPlanPath === undefined\n ? []\n : [\"\", \"[Retry plan for failed components](./retry-components.json)\"]),\n \"\",\n \"## Components\",\n \"\",\n ...receipts.map((receipt) => {\n const modelLink = receipt.threatModelPath\n ? ` · [Threat model](./${receipt.id}/${relative(receipt.outputDir, receipt.threatModelPath).split(sep).join(\"/\")})`\n : \"\";\n return `- ${JSON.stringify(receipt.name)}: ${receipt.status}. [Scan files](./${receipt.id}/)${modelLink}${receipt.error ? ` — ${receipt.error}` : \"\"}`;\n }),\n \"\",\n \"## Findings\",\n \"\",\n ...findings.map(\n ({ finding, sources }) =>\n `- ${finding.severity.level}: ${finding.title} (${sources.map(({ componentId }) => `[${componentId}](./${componentId}/report.md)`).join(\", \")})`,\n ),\n \"\",\n ].join(\"\\n\");\n}\n\nasync function writeJson(path: string, value: unknown): Promise<void> {\n await writeFile(path, `${JSON.stringify(value, null, 2)}\\n`, {\n flag: \"wx\",\n mode: 0o600,\n });\n}\n\nfunction copyReceipt(receipt: ComponentReceipt): ComponentReceipt {\n return { ...receipt, paths: [...receipt.paths] };\n}\n"]}
|
package/dist/config.d.ts
CHANGED
|
@@ -52,13 +52,14 @@ export declare const EXTERNAL_CODEX_PROVIDERS: {
|
|
|
52
52
|
};
|
|
53
53
|
export type ExternalModelProvider = keyof typeof EXTERNAL_CODEX_PROVIDERS;
|
|
54
54
|
export declare function isExternalModelProvider(provider: unknown): provider is ExternalModelProvider;
|
|
55
|
+
export declare const MODEL_FILE_SETTINGS: readonly ["model_instructions_file", "model_catalog_json", "experimental_compact_prompt_file"];
|
|
55
56
|
export declare const DEFAULT_CODEX_CONFIG: Readonly<JsonObject>;
|
|
56
57
|
export declare function scanModelConfiguration(config: Readonly<JsonObject>): ScanModelConfiguration;
|
|
57
58
|
export declare function scanModel(config: Readonly<JsonObject>): unknown;
|
|
58
59
|
export declare function scanModelProvider(config: Readonly<JsonObject>): unknown;
|
|
59
60
|
export declare function scanApprovalPolicy(config: Readonly<JsonObject>): "never" | "on-request";
|
|
60
61
|
export declare function resolveCodexProfile(config: JsonObject): JsonObject;
|
|
61
|
-
export declare function mergedCodexConfig(config: CodexSecurityConfig): Promise<JsonObject>;
|
|
62
|
+
export declare function mergedCodexConfig(config: CodexSecurityConfig, profileHome?: string): Promise<JsonObject>;
|
|
62
63
|
export declare function writeCodexConfig(path: string, config: JsonObject): Promise<void>;
|
|
63
64
|
export declare function mergeCodexOverrides(base: JsonObject, overrides: JsonObject): JsonObject;
|
|
64
65
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAC7D,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,SAAS,EAAE,GAAG,UAAU,CAAC;AACjE,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,CAAC,E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B,yBAAyB,EACzB,oBAAoB,EACpB,kCAAkC,CAC1B,CAAC;AAEX,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,UAAU,CAoBpD,CAAC;AAEH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,GAC3B,sBAAsB,CAoBxB;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,OAAO,CAG/D;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,OAAO,CAGvE;AAyFD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,GAC3B,OAAO,GAAG,YAAY,CAKxB;AAgBD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAMlE;AAwHD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,mBAAmB,EAC3B,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,UAAU,CAAC,CAyBrB;AA2BD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,IAAI,CAAC,CAUf;AAyJD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,UAAU,GACpB,UAAU,CAIZ"}
|
package/dist/config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { mkdir, open, rename, unlink } from "node:fs/promises";
|
|
2
|
+
import { mkdir, open, readFile, rename, unlink } from "node:fs/promises";
|
|
3
3
|
import { dirname, join, resolve } from "node:path";
|
|
4
4
|
import { parse, stringify } from "smol-toml";
|
|
5
5
|
import { ConfigurationError } from "./errors.js";
|
|
@@ -30,6 +30,11 @@ export function isExternalModelProvider(provider) {
|
|
|
30
30
|
return (typeof provider === "string" &&
|
|
31
31
|
Object.hasOwn(EXTERNAL_CODEX_PROVIDERS, provider));
|
|
32
32
|
}
|
|
33
|
+
export const MODEL_FILE_SETTINGS = [
|
|
34
|
+
"model_instructions_file",
|
|
35
|
+
"model_catalog_json",
|
|
36
|
+
"experimental_compact_prompt_file",
|
|
37
|
+
];
|
|
33
38
|
export const DEFAULT_CODEX_CONFIG = Object.freeze({
|
|
34
39
|
approval_policy: "on-request",
|
|
35
40
|
approvals_reviewer: "auto_review",
|
|
@@ -73,6 +78,17 @@ export function scanModelProvider(config) {
|
|
|
73
78
|
const selectedProfile = selectedScanProfile(config);
|
|
74
79
|
return selectedProfile?.["model_provider"] ?? config["model_provider"];
|
|
75
80
|
}
|
|
81
|
+
/** @internal Use the selected native provider's configured credential key. */
|
|
82
|
+
export function scanProviderEnvKey(config) {
|
|
83
|
+
const selected = scanModelProvider(config);
|
|
84
|
+
if (!isExternalModelProvider(selected))
|
|
85
|
+
return undefined;
|
|
86
|
+
const providers = resolveCodexProfile(config)["model_providers"];
|
|
87
|
+
const provider = isObject(providers) ? providers[selected] : undefined;
|
|
88
|
+
return isObject(provider) && typeof provider["env_key"] === "string"
|
|
89
|
+
? provider["env_key"]
|
|
90
|
+
: EXTERNAL_CODEX_PROVIDERS[selected].env_key;
|
|
91
|
+
}
|
|
76
92
|
/** @internal Native Codex validates the auth table, including invalid selections. */
|
|
77
93
|
export function hasCommandAuth(config) {
|
|
78
94
|
const selected = scanModelProvider(config);
|
|
@@ -123,6 +139,9 @@ export function quoteTomlString(value) {
|
|
|
123
139
|
export function inlineToml(value) {
|
|
124
140
|
if (value === null)
|
|
125
141
|
throw new ConfigurationError("Codex TOML overrides cannot contain null values.");
|
|
142
|
+
// Match the Codex SDK's numeric spelling, including integers above 2**53 - 1.
|
|
143
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
144
|
+
return String(value);
|
|
126
145
|
if (Array.isArray(value))
|
|
127
146
|
return `[${value.map(inlineToml).join(",")}]`;
|
|
128
147
|
if (isObject(value)) {
|
|
@@ -171,57 +190,112 @@ export function scanCyberAccessConfig(config, program) {
|
|
|
171
190
|
},
|
|
172
191
|
};
|
|
173
192
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
193
|
+
/** @internal Read file-profile settings before wrapper defaults or CLI model validation. */
|
|
194
|
+
export async function readCodexFileProfile(overrides, profileHome) {
|
|
195
|
+
let nativeProfile = {};
|
|
196
|
+
const profileName = overrides["profile"];
|
|
197
|
+
if (profileName != null && typeof profileName !== "string") {
|
|
198
|
+
throw new ConfigurationError("Codex profile must be a name.");
|
|
177
199
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
throw new ConfigurationError("The selected Codex Security plugin requires native multi-agent v2; " +
|
|
184
|
-
"agents.max_threads is a legacy v1 setting. Use " +
|
|
185
|
-
"features.multi_agent_v2.max_concurrent_threads_per_session instead.");
|
|
186
|
-
}
|
|
187
|
-
const features = overrides["features"];
|
|
188
|
-
if (isObject(features) && "multi_agent_v2" in features) {
|
|
189
|
-
const multiAgentV2 = features["multi_agent_v2"];
|
|
190
|
-
if (!isObject(multiAgentV2)) {
|
|
191
|
-
throw new ConfigurationError("The selected Codex Security plugin requires native multi-agent v2; " +
|
|
192
|
-
"features.multi_agent_v2 must remain a table with enabled = true.");
|
|
200
|
+
if (profileHome !== undefined &&
|
|
201
|
+
typeof profileName === "string" &&
|
|
202
|
+
selectedScanProfile(overrides) === undefined) {
|
|
203
|
+
if (!/^[A-Za-z0-9_-]+$/u.test(profileName)) {
|
|
204
|
+
throw new ConfigurationError("Codex profile must be a plain name.");
|
|
193
205
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
206
|
+
try {
|
|
207
|
+
nativeProfile = parse(await readFile(join(profileHome, `${profileName}.config.toml`), "utf8"));
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
if (error.code !== "ENOENT") {
|
|
211
|
+
throw new ConfigurationError(`Could not read Codex profile ${profileName}.`, {
|
|
212
|
+
cause: error,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
197
215
|
}
|
|
216
|
+
if ("profile" in nativeProfile || "profiles" in nativeProfile) {
|
|
217
|
+
throw new ConfigurationError(`Codex profile ${profileName} contains legacy profile settings.`);
|
|
218
|
+
}
|
|
219
|
+
validateOverrideKeys(nativeProfile);
|
|
220
|
+
validateOverrides(nativeProfile);
|
|
221
|
+
// CLI overrides otherwise resolve this file against the scan directory.
|
|
222
|
+
for (const key of [...MODEL_FILE_SETTINGS, "sqlite_home", "log_dir"]) {
|
|
223
|
+
resolveConfigPath(nativeProfile, key, profileHome);
|
|
224
|
+
}
|
|
225
|
+
resolveNestedConfigPaths(nativeProfile, profileHome);
|
|
226
|
+
normalizeLegacyWindowsSandboxOverride(nativeProfile);
|
|
198
227
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
228
|
+
return nativeProfile;
|
|
229
|
+
}
|
|
230
|
+
function resolveConfigPath(config, key, directory) {
|
|
231
|
+
const path = config[key];
|
|
232
|
+
if (typeof path === "string" && !/^~(?:[/\\]|$)/u.test(path)) {
|
|
233
|
+
config[key] = resolve(directory, path);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
/** @internal Keep agent, skill, and TLS file paths anchored to their config directory. */
|
|
237
|
+
export function resolveNestedConfigPaths(config, directory) {
|
|
238
|
+
const agents = config["agents"];
|
|
239
|
+
if (isObject(agents)) {
|
|
240
|
+
for (const agent of Object.values(agents)) {
|
|
241
|
+
if (isObject(agent))
|
|
242
|
+
resolveConfigPath(agent, "config_file", directory);
|
|
204
243
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
244
|
+
}
|
|
245
|
+
const skills = config["skills"];
|
|
246
|
+
if (isObject(skills) && Array.isArray(skills["config"])) {
|
|
247
|
+
for (const skill of skills["config"]) {
|
|
248
|
+
if (!isObject(skill))
|
|
249
|
+
continue;
|
|
250
|
+
resolveConfigPath(skill, "path", directory);
|
|
208
251
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
252
|
+
}
|
|
253
|
+
const otel = config["otel"];
|
|
254
|
+
if (!isObject(otel))
|
|
255
|
+
return;
|
|
256
|
+
for (const key of ["exporter", "trace_exporter", "metrics_exporter"]) {
|
|
257
|
+
const exporter = otel[key];
|
|
258
|
+
if (!isObject(exporter))
|
|
259
|
+
continue;
|
|
260
|
+
for (const configuration of Object.values(exporter)) {
|
|
261
|
+
if (!isObject(configuration) || !isObject(configuration["tls"]))
|
|
262
|
+
continue;
|
|
263
|
+
const tls = configuration["tls"];
|
|
264
|
+
for (const field of [
|
|
265
|
+
"ca-certificate",
|
|
266
|
+
"client-certificate",
|
|
267
|
+
"client-private-key",
|
|
268
|
+
]) {
|
|
269
|
+
resolveConfigPath(tls, field, directory);
|
|
270
|
+
}
|
|
213
271
|
}
|
|
214
272
|
}
|
|
273
|
+
}
|
|
274
|
+
export async function mergedCodexConfig(config, profileHome) {
|
|
275
|
+
if (config.codexOverrides !== undefined && !isObject(config.codexOverrides)) {
|
|
276
|
+
throw new ConfigurationError("codexOverrides must be an object.");
|
|
277
|
+
}
|
|
278
|
+
validateOverrideKeys(config.codexOverrides ?? {});
|
|
279
|
+
const overrides = structuredClone(config.codexOverrides ?? {});
|
|
280
|
+
validateOverrides(overrides);
|
|
215
281
|
normalizeLegacyWindowsSandboxOverride(overrides);
|
|
216
|
-
|
|
217
|
-
|
|
282
|
+
const nativeProfile = await readCodexFileProfile(overrides, profileHome);
|
|
283
|
+
const profiles = overrides["profiles"];
|
|
284
|
+
if (isObject(profiles)) {
|
|
285
|
+
for (const profile of Object.values(profiles)) {
|
|
286
|
+
if (isObject(profile)) {
|
|
287
|
+
normalizeLegacyWindowsSandboxOverride(profile);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
218
290
|
}
|
|
219
291
|
const defaults = structuredClone(DEFAULT_CODEX_CONFIG);
|
|
220
|
-
|
|
292
|
+
const effectiveOverrides = deepMerge(nativeProfile, overrides);
|
|
293
|
+
validateNativeMultiAgentV2Overrides(effectiveOverrides);
|
|
294
|
+
if (scanModelProvider(effectiveOverrides) === "amazon-bedrock") {
|
|
221
295
|
// Bedrock models can reject reasoning.summary before the scan starts.
|
|
222
296
|
defaults["model_reasoning_summary"] = "none";
|
|
223
297
|
}
|
|
224
|
-
return deepMerge(defaults,
|
|
298
|
+
return deepMerge(defaults, effectiveOverrides);
|
|
225
299
|
}
|
|
226
300
|
/** @internal Preserve existing native Windows backend selections. */
|
|
227
301
|
export function normalizeLegacyWindowsSandboxOverride(overrides) {
|
|
@@ -244,8 +318,6 @@ export function normalizeLegacyWindowsSandboxOverride(overrides) {
|
|
|
244
318
|
};
|
|
245
319
|
}
|
|
246
320
|
export async function writeCodexConfig(path, config) {
|
|
247
|
-
const parent = dirname(path);
|
|
248
|
-
await mkdir(parent, { recursive: true, mode: 0o700 });
|
|
249
321
|
let contents;
|
|
250
322
|
try {
|
|
251
323
|
contents = stringify(config);
|
|
@@ -255,6 +327,12 @@ export async function writeCodexConfig(path, config) {
|
|
|
255
327
|
cause: error,
|
|
256
328
|
});
|
|
257
329
|
}
|
|
330
|
+
await writePrivateConfig(path, contents);
|
|
331
|
+
}
|
|
332
|
+
/** @internal Write private configuration without changing its serialized contents. */
|
|
333
|
+
export async function writePrivateConfig(path, contents) {
|
|
334
|
+
const parent = dirname(path);
|
|
335
|
+
await mkdir(parent, { recursive: true, mode: 0o700 });
|
|
258
336
|
const temporary = join(parent, `.${randomUUID()}.config.toml.tmp`);
|
|
259
337
|
let created = false;
|
|
260
338
|
try {
|
|
@@ -326,6 +404,50 @@ function validateOverrides(overrides) {
|
|
|
326
404
|
}
|
|
327
405
|
}
|
|
328
406
|
}
|
|
407
|
+
function validateNativeMultiAgentV2Overrides(overrides) {
|
|
408
|
+
const agents = overrides["agents"];
|
|
409
|
+
if (isObject(agents) && "max_threads" in agents) {
|
|
410
|
+
throw new ConfigurationError("The selected Codex Security plugin requires native multi-agent v2; " +
|
|
411
|
+
"agents.max_threads is a legacy v1 setting. Use " +
|
|
412
|
+
"features.multi_agent_v2.max_concurrent_threads_per_session instead.");
|
|
413
|
+
}
|
|
414
|
+
const features = overrides["features"];
|
|
415
|
+
if (isObject(features)) {
|
|
416
|
+
if ("multi_agent_v2" in features) {
|
|
417
|
+
const multiAgentV2 = features["multi_agent_v2"];
|
|
418
|
+
if (!isObject(multiAgentV2)) {
|
|
419
|
+
throw new ConfigurationError("The selected Codex Security plugin requires native multi-agent v2; " +
|
|
420
|
+
"features.multi_agent_v2 must remain a table with enabled = true.");
|
|
421
|
+
}
|
|
422
|
+
if ("enabled" in multiAgentV2 && multiAgentV2["enabled"] !== true) {
|
|
423
|
+
throw new ConfigurationError("The selected Codex Security plugin requires native multi-agent v2; " +
|
|
424
|
+
"features.multi_agent_v2.enabled cannot be disabled.");
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
const profiles = overrides["profiles"];
|
|
429
|
+
if (!isObject(profiles)) {
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
for (const [name, profile] of Object.entries(profiles)) {
|
|
433
|
+
if (!isObject(profile)) {
|
|
434
|
+
continue;
|
|
435
|
+
}
|
|
436
|
+
const profileAgents = profile["agents"];
|
|
437
|
+
if (isObject(profileAgents) && "max_threads" in profileAgents) {
|
|
438
|
+
throw new ConfigurationError(`The selected Codex Security plugin requires native multi-agent v2; profile ${name} agents.max_threads is a legacy v1 setting.`);
|
|
439
|
+
}
|
|
440
|
+
const profileFeatures = profile["features"];
|
|
441
|
+
if (!isObject(profileFeatures) || !("multi_agent_v2" in profileFeatures)) {
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
const profileV2 = profileFeatures["multi_agent_v2"];
|
|
445
|
+
if (!isObject(profileV2) ||
|
|
446
|
+
("enabled" in profileV2 && profileV2["enabled"] !== true)) {
|
|
447
|
+
throw new ConfigurationError(`The selected Codex Security plugin requires native multi-agent v2; profile ${name} features.multi_agent_v2 cannot be disabled.`);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
329
451
|
export function mergeCodexOverrides(base, overrides) {
|
|
330
452
|
validateOverrideKeys(base);
|
|
331
453
|
validateOverrideKeys(overrides);
|