@openai/codex-security 0.8.2 → 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 +43 -61
- 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/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_db.py +186 -360
- 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_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 +213 -20
- 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 +64 -35
- package/_bundled_plugin/skills/publish-findings/references/wiz-import.md +2 -21
- package/_bundled_plugin/skills/threat-model-visualize/scripts/build_explorer.py +14 -8
- 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 +411 -160
- package/dist/api.js.map +1 -1
- package/dist/auth.js +6 -1
- 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 +608 -258
- 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 +4 -0
- package/dist/custom-validation.js.map +1 -1
- package/dist/deduplication/deduplication-prompts.d.ts +4 -4
- package/dist/deduplication/deduplication-prompts.d.ts.map +1 -1
- package/dist/deduplication/deduplication-prompts.js +2 -2
- package/dist/deduplication/deduplication-prompts.js.map +1 -1
- package/dist/deduplication/deduplication-reviewer.d.ts +14 -11
- package/dist/deduplication/deduplication-reviewer.d.ts.map +1 -1
- package/dist/deduplication/deduplication-reviewer.js +11 -4
- package/dist/deduplication/deduplication-reviewer.js.map +1 -1
- package/dist/deduplication/deduplication.js.map +1 -1
- package/dist/deduplication/finding-schema.d.ts +19 -1
- package/dist/deduplication/finding-schema.d.ts.map +1 -1
- package/dist/deduplication/finding-schema.js +25 -0
- package/dist/deduplication/finding-schema.js.map +1 -1
- package/dist/deduplication/local.d.ts.map +1 -1
- package/dist/deduplication/local.js +3 -8
- package/dist/deduplication/local.js.map +1 -1
- package/dist/deduplication/records.d.ts +8 -2
- package/dist/deduplication/records.d.ts.map +1 -1
- package/dist/deduplication/records.js +36 -8
- package/dist/deduplication/records.js.map +1 -1
- package/dist/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 +7 -37
- 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 +5 -11
- package/dist/external-findings-import.js.map +1 -1
- package/dist/external-findings-local.d.ts +9 -0
- package/dist/external-findings-local.d.ts.map +1 -1
- package/dist/external-findings-local.js +325 -179
- package/dist/external-findings-local.js.map +1 -1
- package/dist/external-findings-publish.d.ts +12 -0
- package/dist/external-findings-publish.d.ts.map +1 -1
- package/dist/external-findings-publish.js +1202 -214
- package/dist/external-findings-publish.js.map +1 -1
- package/dist/external-findings-read.d.ts +8 -0
- package/dist/external-findings-read.d.ts.map +1 -1
- package/dist/external-findings-read.js +65 -54
- package/dist/external-findings-read.js.map +1 -1
- package/dist/external-findings.d.ts +2 -0
- package/dist/external-findings.d.ts.map +1 -1
- package/dist/external-findings.js +111 -0
- 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 +2 -2
- package/dist/host-protocol.d.ts.map +1 -1
- package/dist/host-protocol.js.map +1 -1
- package/dist/host-records-protocol.d.ts +10 -11
- package/dist/host-records-protocol.d.ts.map +1 -1
- package/dist/host-records-protocol.js +69 -9
- package/dist/host-records-protocol.js.map +1 -1
- package/dist/hosted-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 +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/inspector-findings.d.ts.map +1 -1
- package/dist/inspector-findings.js +13 -18
- package/dist/inspector-findings.js.map +1 -1
- 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.map +1 -1
- package/dist/patch-tui.js +90 -35
- 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 +2 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +95 -52
- 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 +16 -37
- 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 +46 -6
- package/dist/scanner-import.d.ts.map +1 -1
- package/dist/scanner-import.js +208 -42
- 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 +20 -48
- 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 +21 -20
- 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 +310 -477
- package/docs/dedupe-records.md +10 -0
- package/docs/findings-service.md +21 -8
- package/docs/hosted-scans.md +16 -1
- package/package.json +8 -9
- 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 -49
- package/dist/deduplication/records-protocol.js.map +0 -1
package/dist/result.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.js","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AASjC,OAAO,EAAE,gBAAgB,EAAiB,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
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IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,UAAU;SACtB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { statSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type {\n CoverageDocument,\n Finding,\n FindingsDocument,\n ScanManifest,\n SeverityLevel,\n ThreatModel,\n} from \"./models.js\";\nimport { estimateScanCost, type ScanCost } from \"./cost.js\";\nimport { meetsSeverity, severityThresholdRank } from \"./scan-settings.js\";\n\nexport interface TurnResultMetadata {\n id?: string;\n status?: string;\n model?: string;\n durationMs?: number;\n finalResponse?: string;\n usage?: unknown;\n [key: string]: unknown;\n}\n\nexport interface RepositoryFinding extends Pick<\n Finding,\n \"findingId\" | \"occurrenceId\" | \"title\" | \"summary\" | \"severity\"\n> {\n scanId: string;\n targetId: string;\n status: \"open\" | \"closed\";\n confirmedInLatestScan: boolean;\n knownSince?: string;\n knownScanIds?: string[];\n matchedFindingIds?: string[];\n [key: string]: unknown;\n}\n\nexport interface ScanResultOptions {\n manifest: ScanManifest;\n findings: FindingsDocument;\n review?: NonNullable<ScanManifest[\"scan\"][\"review\"]>;\n coverage?: CoverageDocument;\n mode?: NonNullable<ScanManifest[\"scan\"][\"mode\"]>;\n scanDir: string;\n threadId: string;\n turnResult: TurnResultMetadata;\n /** Cost saved when this scan completed. */\n recordedCost?: Readonly<ScanCost>;\n sarifPath?: string | null;\n threatModelPath?: string | null;\n repositoryFindings?: readonly RepositoryFinding[];\n ownerSuggestionsPath?: string;\n ownerSuggestionsError?: string;\n}\n\nexport class ScanResult {\n public readonly mode: NonNullable<ScanManifest[\"scan\"][\"mode\"]>;\n public readonly manifest: ScanManifest;\n public readonly findings: FindingsDocument;\n public readonly review: NonNullable<ScanManifest[\"scan\"][\"review\"]>;\n public readonly scanDir: string;\n public readonly threadId: string;\n public readonly turnResult: Readonly<TurnResultMetadata>;\n public readonly cost: Readonly<ScanCost> | null;\n public readonly sarifPath: string | null;\n public readonly threatModelPath: string | null;\n public repositoryFindings: readonly RepositoryFinding[] | undefined;\n public ownerSuggestionsPath: string | undefined;\n public ownerSuggestionsError: string | undefined;\n\n public constructor(options: ScanResultOptions) {\n this.mode =\n options.mode ?? options.manifest.scan.mode ?? options.coverage!.mode;\n this.manifest = options.manifest;\n this.findings = options.findings;\n this.review = options.review ??\n options.manifest.scan.review ?? {\n excludedPaths: options.coverage!.explicitExclusions.map(\n (item) => item.pattern,\n ),\n };\n this.scanDir = options.scanDir;\n this.threadId = options.threadId;\n this.turnResult = options.turnResult;\n this.repositoryFindings = options.repositoryFindings;\n this.ownerSuggestionsPath = options.ownerSuggestionsPath;\n this.ownerSuggestionsError = options.ownerSuggestionsError;\n this.threatModelPath = options.threatModelPath ?? null;\n this.cost =\n options.recordedCost ??\n estimateScanCost(options.turnResult.model, options.turnResult.usage);\n if (options.sarifPath !== undefined) {\n this.sarifPath = options.sarifPath;\n } else {\n const defaultSarifPath = join(\n options.scanDir,\n \"exports\",\n \"results.sarif\",\n );\n try {\n this.sarifPath = statSync(defaultSarifPath, {\n throwIfNoEntry: false,\n })?.isFile()\n ? defaultSarifPath\n : null;\n } catch {\n this.sarifPath = null;\n }\n }\n }\n\n public get threatModel(): ThreatModel | null {\n return this.manifest.scan.threatModel ?? null;\n }\n\n public get reportPath(): string {\n return join(this.scanDir, \"report.md\");\n }\n\n public get pluginVersion(): string {\n return this.manifest.scan.producer.version;\n }\n\n public get manifestPath(): string {\n return join(this.scanDir, \"scan-manifest.json\");\n }\n\n public get findingsPath(): string {\n return join(this.scanDir, \"findings.json\");\n }\n\n public get artifactsDir(): string {\n return join(this.scanDir, \"artifacts\");\n }\n\n public hasFindingsAtOrAbove(threshold: SeverityLevel): boolean {\n severityThresholdRank(threshold);\n return this.findings.findings.some((finding) =>\n meetsSeverity(finding, threshold),\n );\n }\n\n public toJSON(): Record<string, unknown> {\n return {\n manifest: this.manifest,\n repositoryFindings: this.repositoryFindings,\n ...(this.ownerSuggestionsPath === undefined\n ? {}\n : { ownerSuggestionsPath: this.ownerSuggestionsPath }),\n ...(this.ownerSuggestionsError === undefined\n ? {}\n : { ownerSuggestionsError: this.ownerSuggestionsError }),\n findings: this.findings,\n review: this.review,\n scanDir: this.scanDir,\n threadId: this.threadId,\n reportPath: this.reportPath,\n threatModel: this.threatModel,\n threatModelPath: this.threatModelPath,\n artifactsDir: this.artifactsDir,\n sarifPath: this.sarifPath,\n cost: this.cost,\n turn: this.turnResult,\n };\n }\n}\n"]}
|
package/dist/runtime.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export declare function requireSecureCredentialHome(path: string, options?: Para
|
|
|
69
69
|
}): Promise<BigIntStats>;
|
|
70
70
|
export declare function requirePrivateCredentialHome(metadata: Pick<Stats, "mode" | "uid">, path: string, options?: Parameters<typeof requirePrivateDirectory>[3]): Promise<void>;
|
|
71
71
|
export declare function preparePolicyOutputDirectory(path: string, options?: Parameters<typeof requirePrivateDirectory>[3]): Promise<void>;
|
|
72
|
-
declare function requirePrivateDirectory(metadata: Pick<Stats, "mode" | "uid">, path: string, description: string, options
|
|
72
|
+
export declare function requirePrivateDirectory(metadata: Pick<Stats, "mode" | "uid">, path: string, description: string, options?: {
|
|
73
73
|
platform?: NodeJS.Platform;
|
|
74
74
|
secureWindowsHome?: (path: string) => Promise<void>;
|
|
75
75
|
}): Promise<void>;
|
|
@@ -88,6 +88,7 @@ export declare function inspectWindowsCredentialAcl(descriptor: string, currentU
|
|
|
88
88
|
export declare function streamWindowsCredentialAclDescriptors(command: string, args: readonly string[], inspectDescriptor: (descriptor: string) => Promise<void>, options?: {
|
|
89
89
|
environment?: NodeJS.ProcessEnv;
|
|
90
90
|
}): Promise<void>;
|
|
91
|
+
export declare function windowsCredentialAncestorAclScript(path: string): string;
|
|
91
92
|
export declare function inspectWindowsCredentialAclSnapshot(path: string, currentUserSid: string, options: {
|
|
92
93
|
command: string;
|
|
93
94
|
args: readonly string[];
|
package/dist/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
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AC,CAqFjB;AAED,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,MAAM,EACd,WAAW,GAAE,kBAAgC,GAC5C,kBAAkB,CASpB;AAED,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,kBAAkB,EAC/B,GAAG,CAAC,EAAE,mBAAmB,GACxB,kBAAkB,CAYpB;AAED,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,kBAAkB,GAC9B,kBAAkB,CAOpB;AAeD,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAErE;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,WAAW,EAAE,kBAAkB,EAC/B,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,EAC3B,MAAM,CAAC,EAAE,WAAW,EACpB,gBAAgB,UAAQ,EACxB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,kBAAkB,CAAC,CAmF7B;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,YAAY,EACrB,WAAW,EAAE,kBAAkB,EAC/B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CA+Bf;AA6LD,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEhE;AAkCD,wBAAgB,UAAU,CACxB,KAAK,EAAE,MAAM,EACb,WAAW,GAAE,kBAAgC,GAC5C,MAAM,CAaR"}
|
package/dist/runtime.js
CHANGED
|
@@ -139,7 +139,11 @@ export async function prepareCodexSecurityCredentialHome(environment = process.e
|
|
|
139
139
|
catch (error) {
|
|
140
140
|
if (error instanceof OutputDirectoryError)
|
|
141
141
|
throw error;
|
|
142
|
-
|
|
142
|
+
const code = nodeErrorCode(error);
|
|
143
|
+
const recovery = code === "EACCES" || code === "EPERM" || code === "EROFS"
|
|
144
|
+
? "\nCheck permissions or set CODEX_SECURITY_STATE_DIR to a private, writable directory outside the repository."
|
|
145
|
+
: "";
|
|
146
|
+
throw new OutputDirectoryError(`Unable to prepare the Codex Security credential home: ${path}\n${errorMessage(error)}${recovery}`, { cause: error });
|
|
143
147
|
}
|
|
144
148
|
}
|
|
145
149
|
/**
|
|
@@ -203,7 +207,7 @@ export async function preparePolicyOutputDirectory(path, options = {}) {
|
|
|
203
207
|
}
|
|
204
208
|
await requirePrivateDirectory(metadata, path, "policy output directory", options);
|
|
205
209
|
}
|
|
206
|
-
async function requirePrivateDirectory(metadata, path, description, options) {
|
|
210
|
+
export async function requirePrivateDirectory(metadata, path, description, options = {}) {
|
|
207
211
|
if ((options.platform ?? process.platform) !== "win32") {
|
|
208
212
|
requirePrivateOutputDirectory(metadata, path);
|
|
209
213
|
return;
|
|
@@ -525,13 +529,36 @@ export async function streamWindowsCredentialAclDescriptors(command, args, inspe
|
|
|
525
529
|
throw new WindowsCredentialDescendantsChangedError("Windows credential descendants changed during ACL inspection");
|
|
526
530
|
}
|
|
527
531
|
}
|
|
532
|
+
// win32.parse stops at the UNC marker for extended-length share paths.
|
|
533
|
+
const WINDOWS_CREDENTIAL_UNC_ROOT = /^[\\/]{2}[?.][\\/]UNC[\\/][^\\/]+[\\/][^\\/]+[\\/]?/iu;
|
|
534
|
+
function windowsCredentialRootLength(path) {
|
|
535
|
+
const root = WINDOWS_CREDENTIAL_UNC_ROOT.exec(path)?.[0] ?? win32.parse(path).root;
|
|
536
|
+
if (win32.isAbsolute(path) && win32.relative(root, path) === "") {
|
|
537
|
+
throw new Error("A private Windows directory must be below a volume or share root");
|
|
538
|
+
}
|
|
539
|
+
return root.length;
|
|
540
|
+
}
|
|
541
|
+
export function windowsCredentialAncestorAclScript(path) {
|
|
542
|
+
const rootLength = windowsCredentialRootLength(path);
|
|
543
|
+
return [
|
|
544
|
+
"$path = $env:CODEX_SECURITY_CREDENTIAL_ACL_PATH",
|
|
545
|
+
// Stop at the drive or UNC share root, then inspect the outermost ancestor first.
|
|
546
|
+
`$ancestors = @(while ($path.Length -gt ${rootLength}) { $parent = Microsoft.PowerShell.Management\\Split-Path -Path $path -Parent; if (-not $parent -or $parent -eq $path) { break }; $parent; $path = $parent })`,
|
|
547
|
+
"for ($i = $ancestors.Count - 1; $i -ge 0; $i--) { Write-CredentialAcl $ancestors[$i] }",
|
|
548
|
+
].join("\n");
|
|
549
|
+
}
|
|
528
550
|
export async function inspectWindowsCredentialAclSnapshot(path, currentUserSid, options) {
|
|
551
|
+
const rootLength = windowsCredentialRootLength(path);
|
|
529
552
|
const ancestors = [];
|
|
530
|
-
|
|
553
|
+
let ancestor = win32.dirname(path);
|
|
554
|
+
while (true) {
|
|
531
555
|
ancestors.push(ancestor);
|
|
532
|
-
|
|
556
|
+
const parent = win32.dirname(ancestor);
|
|
557
|
+
if (ancestor.length <= rootLength || ancestor === parent)
|
|
533
558
|
break;
|
|
559
|
+
ancestor = parent;
|
|
534
560
|
}
|
|
561
|
+
ancestors.reverse();
|
|
535
562
|
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
536
563
|
let home;
|
|
537
564
|
let descendantsArePrivate = true;
|
|
@@ -565,9 +592,12 @@ export async function inspectWindowsCredentialAclSnapshot(path, currentUserSid,
|
|
|
565
592
|
}
|
|
566
593
|
}
|
|
567
594
|
catch (error) {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
595
|
+
let guidance = "Choose a location outside this ancestor with trusted ownership and permissions.";
|
|
596
|
+
if (index === 0) {
|
|
597
|
+
guidance = WINDOWS_CREDENTIAL_UNC_ROOT.test(win32.toNamespacedPath(ancestorPath))
|
|
598
|
+
? "This share root is unsupported. Choose a location outside this share with trusted ownership and permissions."
|
|
599
|
+
: "This volume root is unsupported. Choose a location on a volume with trusted ancestry; another directory on the same volume will not resolve this.";
|
|
600
|
+
}
|
|
571
601
|
throw new Error(`Windows private-directory ancestor could not be trusted: ${ancestorPath}. ${errorMessage(error)}. ${guidance}`, { cause: error });
|
|
572
602
|
}
|
|
573
603
|
return;
|
|
@@ -615,6 +645,7 @@ export async function inspectWindowsCredentialAclSnapshot(path, currentUserSid,
|
|
|
615
645
|
throw new Error("Windows credential descendants could not be verified");
|
|
616
646
|
}
|
|
617
647
|
async function secureWindowsCredentialHome(path) {
|
|
648
|
+
const ancestorAclScript = windowsCredentialAncestorAclScript(path);
|
|
618
649
|
const systemRoot = process.env["SystemRoot"] ?? "C:\\Windows";
|
|
619
650
|
const systemDirectory = join(systemRoot, "System32");
|
|
620
651
|
const powershell = join(systemDirectory, "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
@@ -662,8 +693,7 @@ async function secureWindowsCredentialHome(path) {
|
|
|
662
693
|
" if ($entry.PSIsContainer) { Read-CredentialDescendants $entry.FullName }",
|
|
663
694
|
" }",
|
|
664
695
|
"}",
|
|
665
|
-
|
|
666
|
-
"while ($true) { $parent = Microsoft.PowerShell.Management\\Split-Path -Path $path -Parent; if (-not $parent -or $parent -eq $path) { break }; Write-CredentialAcl $parent; $path = $parent }",
|
|
696
|
+
ancestorAclScript,
|
|
667
697
|
"Write-CredentialAcl $env:CODEX_SECURITY_CREDENTIAL_ACL_PATH",
|
|
668
698
|
"Read-CredentialDescendants $env:CODEX_SECURITY_CREDENTIAL_ACL_PATH",
|
|
669
699
|
`"${WINDOWS_CREDENTIAL_ACL_COMPLETE_PREFIX}$script:descriptorCount"`,
|
|
@@ -1160,20 +1190,24 @@ workbench["main"](before_archive=before_archive)
|
|
|
1160
1190
|
export async function runWorkbench(options, args, input) {
|
|
1161
1191
|
const script = join(options.pluginRoot, "scripts", "workbench_db.py");
|
|
1162
1192
|
const signal = options.signal;
|
|
1193
|
+
// Explicitly selected external plugins retain their own workbench protocol.
|
|
1194
|
+
const nativeLocalDedupe = args[0] === "local-dedupe" &&
|
|
1195
|
+
(await sameFile(options.pluginRoot, await bundledPluginRoot()));
|
|
1163
1196
|
const run = async (arguments_, input, archiveHandshake = false) => {
|
|
1164
|
-
const native =
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1197
|
+
const native = nativeLocalDedupe ||
|
|
1198
|
+
[
|
|
1199
|
+
"database-info",
|
|
1200
|
+
"store-findings",
|
|
1201
|
+
"list-stored-findings",
|
|
1202
|
+
"store-external-findings",
|
|
1203
|
+
"list-external-findings",
|
|
1204
|
+
"find-potential-duplicates",
|
|
1205
|
+
"store-dedupe-groups",
|
|
1206
|
+
"list-dedupe-groups",
|
|
1207
|
+
"dashboard",
|
|
1208
|
+
"severity-classification",
|
|
1209
|
+
"read-severity-classification",
|
|
1210
|
+
].includes(arguments_[0] ?? "");
|
|
1177
1211
|
const node = native && process.versions["bun"]
|
|
1178
1212
|
? await resolveTrustedExecutable("node", options.environment, [
|
|
1179
1213
|
process.cwd(),
|
|
@@ -1198,12 +1232,9 @@ export async function runWorkbench(options, args, input) {
|
|
|
1198
1232
|
? (options.stateDirectory ??
|
|
1199
1233
|
codexSecurityStateDirectory(options.environment))
|
|
1200
1234
|
: undefined;
|
|
1201
|
-
//
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
if (framedArguments)
|
|
1205
|
-
program =
|
|
1206
|
-
WORKBENCH_ARGUMENTS_PROGRAM + (program ?? WORKBENCH_SCRIPT_PROGRAM);
|
|
1235
|
+
// Validate one JSON document before framing its unchanged source as payload.
|
|
1236
|
+
if (nativeLocalDedupe && input !== undefined)
|
|
1237
|
+
JSON.parse(input);
|
|
1207
1238
|
const result = await runCodexCommand({ command }, native
|
|
1208
1239
|
? [join(options.pluginRoot, "mcp", "helpers.mjs"), ...arguments_]
|
|
1209
1240
|
: [
|
|
@@ -1211,23 +1242,28 @@ export async function runWorkbench(options, args, input) {
|
|
|
1211
1242
|
"-X",
|
|
1212
1243
|
"utf8",
|
|
1213
1244
|
"-B",
|
|
1214
|
-
|
|
1245
|
+
"-c",
|
|
1246
|
+
WORKBENCH_ARGUMENTS_PROGRAM +
|
|
1247
|
+
(archiveHandshake
|
|
1248
|
+
? ARCHIVE_REGISTRATION_PROGRAM
|
|
1249
|
+
: WORKBENCH_SCRIPT_PROGRAM),
|
|
1215
1250
|
script,
|
|
1216
|
-
...(framedArguments ? [] : arguments_),
|
|
1217
1251
|
], pluginHelperEnvironment(node?.environment ?? options.environment),
|
|
1218
1252
|
// The SDK owns configuration normalization; the helper receives its resolved location.
|
|
1253
|
+
nativeLocalDedupe
|
|
1254
|
+
? `{"stateDirectory":${JSON.stringify(stateDirectory)},"payload":${input ?? "null"}}`
|
|
1255
|
+
: native
|
|
1256
|
+
? JSON.stringify(arguments_[0] === "database-info"
|
|
1257
|
+
? stateDirectory
|
|
1258
|
+
: {
|
|
1259
|
+
stateDirectory,
|
|
1260
|
+
payload: input === undefined ? undefined : JSON.parse(input),
|
|
1261
|
+
})
|
|
1262
|
+
: input, signal, archiveHandshake,
|
|
1263
|
+
// Frame Python arguments on stdin to preserve NUL and long diagnostics.
|
|
1219
1264
|
native
|
|
1220
|
-
?
|
|
1221
|
-
|
|
1222
|
-
: {
|
|
1223
|
-
stateDirectory,
|
|
1224
|
-
payload: input === undefined ? undefined : JSON.parse(input),
|
|
1225
|
-
})
|
|
1226
|
-
: input, signal, archiveHandshake,
|
|
1227
|
-
// Match native argv's UTF-8 encoding for the private argument frame.
|
|
1228
|
-
framedArguments
|
|
1229
|
-
? `${JSON.stringify(arguments_.map((argument) => argument.toWellFormed()))}\n`
|
|
1230
|
-
: undefined);
|
|
1265
|
+
? undefined
|
|
1266
|
+
: `${JSON.stringify(arguments_.map((argument) => argument.toWellFormed()))}\n`);
|
|
1231
1267
|
if (!result.success) {
|
|
1232
1268
|
throw new Error(result.stderr.trim() ||
|
|
1233
1269
|
result.stdout.trim() ||
|
|
@@ -1540,8 +1576,7 @@ export async function validatePreparedOutputDir(path, validateLocation, allowNon
|
|
|
1540
1576
|
const canonical = await realpath(path);
|
|
1541
1577
|
requireModelSafeOutputDir(canonical);
|
|
1542
1578
|
validateLocation?.(canonical);
|
|
1543
|
-
|
|
1544
|
-
if (!allowNonempty && entries.length !== 0) {
|
|
1579
|
+
if (!allowNonempty && (await readdir(canonical)).length !== 0) {
|
|
1545
1580
|
throw new OutputDirectoryError(`Scan output directory must be empty: ${path}`);
|
|
1546
1581
|
}
|
|
1547
1582
|
requireOutputDirectoryOwnership(metadata, path);
|
|
@@ -2344,19 +2379,23 @@ export async function runCodexCommand(command, args, environment, input, signal,
|
|
|
2344
2379
|
? resolve({ success: exitCode === 0, exitCode, stdout, stderr })
|
|
2345
2380
|
: reject(processError));
|
|
2346
2381
|
});
|
|
2347
|
-
|
|
2382
|
+
let forceTermination;
|
|
2383
|
+
const settleCanceledChild = () => {
|
|
2348
2384
|
if (!commandSignal?.aborted)
|
|
2349
2385
|
return;
|
|
2350
|
-
if (child.exitCode === null && child.signalCode === null)
|
|
2386
|
+
if (child.exitCode === null && child.signalCode === null) {
|
|
2387
|
+
// spawn already sent SIGTERM. Give the command time to exit cleanly.
|
|
2388
|
+
forceTermination ??= setTimeout(() => child.kill("SIGKILL"), 1_000);
|
|
2351
2389
|
return;
|
|
2390
|
+
}
|
|
2352
2391
|
child.stdin.destroy();
|
|
2353
2392
|
child.stdout.destroy();
|
|
2354
2393
|
child.stderr.destroy();
|
|
2355
2394
|
};
|
|
2356
|
-
commandSignal?.addEventListener("abort",
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2395
|
+
commandSignal?.addEventListener("abort", settleCanceledChild, { once: true });
|
|
2396
|
+
child.once("exit", settleCanceledChild);
|
|
2397
|
+
if (commandSignal?.aborted)
|
|
2398
|
+
settleCanceledChild();
|
|
2360
2399
|
if (archiveHandshake) {
|
|
2361
2400
|
signal?.addEventListener("abort", abort, { once: true });
|
|
2362
2401
|
if (signal?.aborted)
|
|
@@ -2374,8 +2413,9 @@ export async function runCodexCommand(command, args, environment, input, signal,
|
|
|
2374
2413
|
finally {
|
|
2375
2414
|
if (archiveHandshake)
|
|
2376
2415
|
signal?.removeEventListener("abort", abort);
|
|
2377
|
-
|
|
2378
|
-
|
|
2416
|
+
clearTimeout(forceTermination);
|
|
2417
|
+
commandSignal?.removeEventListener("abort", settleCanceledChild);
|
|
2418
|
+
child.removeListener("exit", settleCanceledChild);
|
|
2379
2419
|
}
|
|
2380
2420
|
}
|
|
2381
2421
|
export async function probeCodexSandbox(command, environment, signal) {
|
|
@@ -2399,7 +2439,10 @@ export async function probeCodexSandbox(command, environment, signal) {
|
|
|
2399
2439
|
signal?.throwIfAborted();
|
|
2400
2440
|
detail = processErrorDetail(error);
|
|
2401
2441
|
}
|
|
2402
|
-
|
|
2442
|
+
const guidance = process.platform === "linux"
|
|
2443
|
+
? "\nOn Linux this usually means unprivileged user namespaces are restricted (kernel.apparmor_restrict_unprivileged_userns=1 on Ubuntu 24.04 and later), which Bubblewrap needs; inside the container image, use the AppArmor profile and Compose override from the SDK README."
|
|
2444
|
+
: "";
|
|
2445
|
+
throw new SandboxUnavailableError(`Codex could not run a command in its sandbox: ${detail}\nTo reproduce, run '${command.command} ${args.join(" ")}'.${guidance}`);
|
|
2403
2446
|
}
|
|
2404
2447
|
async function runPluginCommand(command, args, environment, signal) {
|
|
2405
2448
|
try {
|