@openai/codex-security 0.9.1 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -788
- package/_bundled_plugin/.codex-plugin/plugin.json +2 -0
- package/_bundled_plugin/.mcp.json +3 -0
- package/_bundled_plugin/mcp/helpers.mjs.br +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/server.mjs.br +0 -0
- package/_bundled_plugin/references/access-advisory.md +1 -1
- package/_bundled_plugin/references/artifact-storage.md +1 -1
- package/_bundled_plugin/references/baseline-auditor.md +18 -0
- package/_bundled_plugin/references/core-scan.md +5 -42
- package/_bundled_plugin/references/final-report.md +1 -1
- package/_bundled_plugin/references/focused-investigator.md +13 -0
- package/_bundled_plugin/references/scan-prologue.md +2 -2
- package/_bundled_plugin/references/scan-runtime.md +4 -2
- package/_bundled_plugin/references/security-guidance.md +14 -1
- package/_bundled_plugin/references/threat-model.md +1 -0
- package/_bundled_plugin/references/validate-scan-findings.md +3 -0
- package/_bundled_plugin/scripts/deep_scan_workbench.py +30 -12
- package/_bundled_plugin/scripts/dispatch_inventory_tool +7 -0
- package/_bundled_plugin/scripts/finalize_scan_contract.py +47 -9
- package/_bundled_plugin/scripts/launch_codex_security_mcp +54 -16
- package/_bundled_plugin/scripts/launch_codex_security_mcp.cmd +2 -0
- package/_bundled_plugin/scripts/posix_scan_local_files.py +26 -1
- package/_bundled_plugin/scripts/snapshot_sqlite.py +8 -2
- package/_bundled_plugin/scripts/windows_scan_local_files.py +216 -25
- package/_bundled_plugin/scripts/workbench/handoff.py +55 -25
- package/_bundled_plugin/scripts/workbench/storage.py +25 -5
- package/_bundled_plugin/scripts/workbench_cli.py +24 -2
- package/_bundled_plugin/scripts/workbench_constants.py +2 -0
- package/_bundled_plugin/scripts/workbench_db.py +257 -268
- package/_bundled_plugin/scripts/workbench_feedback.py +49 -4
- package/_bundled_plugin/scripts/workbench_native_indexes.py +226 -29
- package/_bundled_plugin/scripts/workbench_progress.py +159 -3
- package/_bundled_plugin/scripts/workbench_publication.py +2 -3
- package/_bundled_plugin/scripts/workbench_remediation.py +142 -2
- package/_bundled_plugin/scripts/workbench_saved_results.py +48 -8
- package/_bundled_plugin/scripts/workbench_scan_history.py +291 -134
- package/_bundled_plugin/scripts/workbench_scan_start.py +208 -11
- package/_bundled_plugin/scripts/workbench_scan_usage.py +36 -10
- package/_bundled_plugin/scripts/workbench_schema.py +220 -14
- package/_bundled_plugin/scripts/workbench_setup.py +1 -1
- package/_bundled_plugin/scripts/workbench_source_scopes.py +8 -0
- package/_bundled_plugin/scripts/workbench_target.py +486 -85
- package/_bundled_plugin/scripts/workbench_target_state.py +1108 -22
- package/_bundled_plugin/shared/workbench-history-repairs.json +64 -14
- package/_bundled_plugin/shared/workbench-migrations.json +66 -0
- package/_bundled_plugin/skills/attack-path-analysis/SKILL.md +4 -2
- package/_bundled_plugin/skills/attack-path-analysis/references/severity-policy.md +2 -2
- package/_bundled_plugin/skills/fix-finding/SKILL.md +1 -0
- package/_bundled_plugin/skills/publish-findings/SKILL.md +26 -160
- package/_bundled_plugin/skills/publish-findings/agents/openai.yaml +2 -2
- package/_bundled_plugin/skills/publish-findings/references/checkmarx-import.md +2 -2
- package/_bundled_plugin/skills/publish-findings/scripts/collect_checkmarx.py +3 -58
- package/_bundled_plugin/skills/publish-findings/scripts/collector_paths.py +63 -0
- package/_bundled_plugin/skills/security-scan/SKILL.md +9 -46
- package/_bundled_plugin/skills/security-scan/agents/openai.yaml +2 -2
- package/_bundled_plugin/skills/security-scan/references/desktop-scan.md +3 -21
- package/_bundled_plugin/skills/security-scan/references/managed-scan.md +11 -0
- package/_bundled_plugin/skills/security-scan/references/scan-results.md +15 -0
- package/_bundled_plugin/skills/security-scan/references/scoped-paths.md +23 -0
- package/_bundled_plugin/skills/security-scan/references/sdk-files.md +24 -0
- package/bin/codex-security.mjs +2 -2
- package/dist/api.d.ts +7 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +459 -157
- package/dist/api.js.map +1 -1
- package/dist/armorcode-findings.d.ts +9 -0
- package/dist/armorcode-findings.d.ts.map +1 -0
- package/dist/armorcode-findings.js +145 -0
- package/dist/armorcode-findings.js.map +1 -0
- package/dist/artifact-export.d.ts +2 -0
- package/dist/artifact-export.d.ts.map +1 -1
- package/dist/artifact-export.js +29 -13
- package/dist/artifact-export.js.map +1 -1
- package/dist/auth.d.ts +6 -2
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +33 -12
- package/dist/auth.js.map +1 -1
- package/dist/batch-cost.d.ts +18 -0
- package/dist/batch-cost.d.ts.map +1 -0
- package/dist/batch-cost.js +41 -0
- package/dist/batch-cost.js.map +1 -0
- package/dist/blackduck-findings.d.ts +1 -1
- package/dist/blackduck-findings.d.ts.map +1 -1
- package/dist/blackduck-findings.js +5 -18
- package/dist/blackduck-findings.js.map +1 -1
- package/dist/bundled-plugin.d.ts +4 -0
- package/dist/bundled-plugin.d.ts.map +1 -0
- package/dist/bundled-plugin.js +23 -0
- package/dist/bundled-plugin.js.map +1 -0
- package/dist/classify-scan-severity.d.ts +1 -1
- package/dist/classify-scan-severity.d.ts.map +1 -1
- package/dist/classify-scan-severity.js +11 -3
- package/dist/classify-scan-severity.js.map +1 -1
- package/dist/classify-severity-diagnostics.d.ts +10 -0
- package/dist/classify-severity-diagnostics.d.ts.map +1 -0
- package/dist/classify-severity-diagnostics.js +57 -0
- package/dist/classify-severity-diagnostics.js.map +1 -0
- package/dist/classify-severity-records.d.ts +4 -0
- package/dist/classify-severity-records.d.ts.map +1 -1
- package/dist/classify-severity-records.js +35 -8
- package/dist/classify-severity-records.js.map +1 -1
- package/dist/classify-severity.d.ts.map +1 -1
- package/dist/classify-severity.js +9 -6
- package/dist/classify-severity.js.map +1 -1
- package/dist/cli-argument.d.ts +4 -0
- package/dist/cli-argument.d.ts.map +1 -0
- package/dist/cli-argument.js +17 -0
- package/dist/cli-argument.js.map +1 -0
- package/dist/cli-help.d.ts +1 -1
- package/dist/cli-help.d.ts.map +1 -1
- package/dist/cli-help.js +71 -29
- package/dist/cli-help.js.map +1 -1
- package/dist/cli-hook.d.ts +3 -0
- package/dist/cli-hook.d.ts.map +1 -0
- package/dist/cli-hook.js +87 -0
- package/dist/cli-hook.js.map +1 -0
- package/dist/cli-integrations.d.ts +13 -0
- package/dist/cli-integrations.d.ts.map +1 -0
- package/dist/cli-integrations.js +333 -0
- package/dist/cli-integrations.js.map +1 -0
- package/dist/cli-mcp.d.ts +15 -0
- package/dist/cli-mcp.d.ts.map +1 -0
- package/dist/cli-mcp.js +178 -0
- package/dist/cli-mcp.js.map +1 -0
- package/dist/cli-token-view.d.ts +10 -0
- package/dist/cli-token-view.d.ts.map +1 -0
- package/dist/cli-token-view.js +41 -0
- package/dist/cli-token-view.js.map +1 -0
- package/dist/cli.d.ts +8 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1860 -903
- package/dist/cli.js.map +1 -1
- package/dist/cloud-publish.d.ts.map +1 -1
- package/dist/cloud-publish.js +33 -31
- package/dist/cloud-publish.js.map +1 -1
- package/dist/codex-sdk-environment.d.ts +6 -0
- package/dist/codex-sdk-environment.d.ts.map +1 -1
- package/dist/codex-sdk-environment.js +19 -0
- package/dist/codex-sdk-environment.js.map +1 -1
- package/dist/command-words.d.ts +3 -0
- package/dist/command-words.d.ts.map +1 -0
- package/dist/command-words.js +46 -0
- package/dist/command-words.js.map +1 -0
- package/dist/component-plan.d.ts.map +1 -1
- package/dist/component-plan.js +3 -3
- package/dist/component-plan.js.map +1 -1
- package/dist/component-scan.d.ts +3 -1
- package/dist/component-scan.d.ts.map +1 -1
- package/dist/component-scan.js +40 -7
- package/dist/component-scan.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +30 -1
- package/dist/config.js.map +1 -1
- package/dist/continuum-aws.d.ts +6 -0
- package/dist/continuum-aws.d.ts.map +1 -0
- package/dist/continuum-aws.js +202 -0
- package/dist/continuum-aws.js.map +1 -0
- package/dist/continuum-collector.d.ts +44 -0
- package/dist/continuum-collector.d.ts.map +1 -0
- package/dist/continuum-collector.js +266 -0
- package/dist/continuum-collector.js.map +1 -0
- package/dist/continuum-findings.d.ts +31 -2
- package/dist/continuum-findings.d.ts.map +1 -1
- package/dist/continuum-findings.js +497 -59
- package/dist/continuum-findings.js.map +1 -1
- package/dist/contract.d.ts +1 -0
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +3 -0
- package/dist/contract.js.map +1 -1
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +1 -45
- package/dist/cost.js.map +1 -1
- package/dist/crowdstrike-findings.d.ts +7 -0
- package/dist/crowdstrike-findings.d.ts.map +1 -0
- package/dist/crowdstrike-findings.js +210 -0
- package/dist/crowdstrike-findings.js.map +1 -0
- package/dist/custom-validation-prompt.d.ts +1 -1
- package/dist/custom-validation-prompt.d.ts.map +1 -1
- package/dist/custom-validation-prompt.js +29 -19
- package/dist/custom-validation-prompt.js.map +1 -1
- package/dist/deduplication/local.d.ts +3 -1
- package/dist/deduplication/local.d.ts.map +1 -1
- package/dist/deduplication/local.js +8 -1
- package/dist/deduplication/local.js.map +1 -1
- package/dist/deduplication/refusal.d.ts.map +1 -1
- package/dist/deduplication/refusal.js +2 -1
- package/dist/deduplication/refusal.js.map +1 -1
- package/dist/deduplication/scan.d.ts +2 -0
- package/dist/deduplication/scan.d.ts.map +1 -1
- package/dist/deduplication/scan.js +24 -7
- package/dist/deduplication/scan.js.map +1 -1
- package/dist/deep-scan.d.ts.map +1 -1
- package/dist/deep-scan.js +16 -15
- package/dist/deep-scan.js.map +1 -1
- package/dist/endor-findings.d.ts +2 -2
- package/dist/endor-findings.d.ts.map +1 -1
- package/dist/endor-findings.js +6 -23
- package/dist/endor-findings.js.map +1 -1
- package/dist/errors.d.ts +3 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +7 -3
- package/dist/errors.js.map +1 -1
- package/dist/executable-path.d.ts +3 -0
- package/dist/executable-path.d.ts.map +1 -1
- package/dist/executable-path.js +26 -0
- package/dist/executable-path.js.map +1 -1
- package/dist/external-findings-import.d.ts.map +1 -1
- package/dist/external-findings-import.js +12 -1
- package/dist/external-findings-import.js.map +1 -1
- package/dist/external-findings-local.d.ts +66 -4
- package/dist/external-findings-local.d.ts.map +1 -1
- package/dist/external-findings-local.js +258 -59
- package/dist/external-findings-local.js.map +1 -1
- package/dist/external-findings-publish.d.ts +6 -1
- package/dist/external-findings-publish.d.ts.map +1 -1
- package/dist/external-findings-publish.js +330 -1633
- package/dist/external-findings-publish.js.map +1 -1
- package/dist/external-findings-read.d.ts +11 -2
- package/dist/external-findings-read.d.ts.map +1 -1
- package/dist/external-findings-read.js +56 -53
- package/dist/external-findings-read.js.map +1 -1
- package/dist/external-findings.d.ts +1 -1
- package/dist/external-findings.d.ts.map +1 -1
- package/dist/external-findings.js +12 -1
- package/dist/external-findings.js.map +1 -1
- package/dist/external-import-contract.d.ts +6 -11
- package/dist/external-import-contract.d.ts.map +1 -1
- package/dist/external-import-contract.js +35 -177
- 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-prompt.d.ts.map +1 -1
- package/dist/finding-prompt.js +2 -2
- package/dist/finding-prompt.js.map +1 -1
- package/dist/github-dependabot-findings.d.ts.map +1 -1
- package/dist/github-dependabot-findings.js +3 -4
- package/dist/github-dependabot-findings.js.map +1 -1
- package/dist/github-findings.d.ts.map +1 -1
- package/dist/github-findings.js +19 -287
- package/dist/github-findings.js.map +1 -1
- package/dist/host-protocol.d.ts +6 -0
- package/dist/host-protocol.d.ts.map +1 -1
- package/dist/host-protocol.js +11 -1
- package/dist/host-protocol.js.map +1 -1
- package/dist/host-records-protocol.d.ts +2 -0
- package/dist/host-records-protocol.d.ts.map +1 -1
- package/dist/host-records-protocol.js +4 -0
- package/dist/host-records-protocol.js.map +1 -1
- package/dist/hosted-remediation.d.ts +1 -0
- package/dist/hosted-remediation.d.ts.map +1 -1
- package/dist/hosted-remediation.js +23 -3
- package/dist/hosted-remediation.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/inspector-findings.d.ts.map +1 -1
- package/dist/inspector-findings.js +19 -35
- package/dist/inspector-findings.js.map +1 -1
- package/dist/knowledge-base.d.ts +1 -1
- package/dist/knowledge-base.d.ts.map +1 -1
- package/dist/knowledge-base.js +34 -27
- package/dist/knowledge-base.js.map +1 -1
- package/dist/linear.d.ts +11 -0
- package/dist/linear.d.ts.map +1 -1
- package/dist/linear.js.map +1 -1
- package/dist/local-git-metadata.d.ts +5 -2
- package/dist/local-git-metadata.d.ts.map +1 -1
- package/dist/local-git-metadata.js +8 -4
- package/dist/local-git-metadata.js.map +1 -1
- package/dist/multiscan.d.ts +4 -0
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +83 -39
- package/dist/multiscan.js.map +1 -1
- package/dist/opengrep-findings.d.ts +4 -2
- package/dist/opengrep-findings.d.ts.map +1 -1
- package/dist/opengrep-findings.js +39 -22
- package/dist/opengrep-findings.js.map +1 -1
- package/dist/private-finding-import.d.ts +8 -13
- package/dist/private-finding-import.d.ts.map +1 -1
- package/dist/private-finding-import.js +69 -129
- package/dist/private-finding-import.js.map +1 -1
- package/dist/project-config-schema.d.ts +2 -0
- package/dist/project-config-schema.d.ts.map +1 -1
- package/dist/project-config-schema.js +1 -0
- package/dist/project-config-schema.js.map +1 -1
- package/dist/project-config.d.ts +1 -0
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +56 -13
- package/dist/project-config.js.map +1 -1
- package/dist/prompt-files.d.ts +7 -2
- package/dist/prompt-files.d.ts.map +1 -1
- package/dist/prompt-files.js +42 -20
- package/dist/prompt-files.js.map +1 -1
- package/dist/provider-profile.d.ts.map +1 -1
- package/dist/provider-profile.js +4 -9
- package/dist/provider-profile.js.map +1 -1
- package/dist/publication.d.ts +1 -1
- package/dist/publication.d.ts.map +1 -1
- package/dist/publication.js.map +1 -1
- package/dist/record.d.ts +1 -5
- package/dist/record.d.ts.map +1 -1
- package/dist/record.js +3 -51
- package/dist/record.js.map +1 -1
- package/dist/remediation.d.ts.map +1 -1
- package/dist/remediation.js +3 -1
- package/dist/remediation.js.map +1 -1
- package/dist/runtime.d.ts +35 -7
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +782 -153
- package/dist/runtime.js.map +1 -1
- package/dist/saved-scan-bootstrap.d.ts +6 -1
- package/dist/saved-scan-bootstrap.d.ts.map +1 -1
- package/dist/saved-scan-bootstrap.js +267 -115
- package/dist/saved-scan-bootstrap.js.map +1 -1
- package/dist/scan-archive-path.d.ts +2 -0
- package/dist/scan-archive-path.d.ts.map +1 -0
- package/dist/scan-archive-path.js +5 -0
- package/dist/scan-archive-path.js.map +1 -0
- package/dist/scan-comparison.d.ts +20 -2
- package/dist/scan-comparison.d.ts.map +1 -1
- package/dist/scan-comparison.js +26 -5
- 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 +18 -2
- package/dist/scan-dashboard.js.map +1 -1
- package/dist/scan-executor.d.ts.map +1 -1
- package/dist/scan-executor.js +4 -2
- package/dist/scan-executor.js.map +1 -1
- package/dist/scan-history-renderer.d.ts +1 -0
- package/dist/scan-history-renderer.d.ts.map +1 -1
- package/dist/scan-history-renderer.js +25 -9
- package/dist/scan-history-renderer.js.map +1 -1
- package/dist/scan-logs.d.ts.map +1 -1
- package/dist/scan-logs.js +28 -4
- package/dist/scan-logs.js.map +1 -1
- package/dist/scan-settings.d.ts +1 -0
- package/dist/scan-settings.d.ts.map +1 -1
- package/dist/scan-settings.js +1 -0
- package/dist/scan-settings.js.map +1 -1
- package/dist/scanner-import.d.ts +5 -11
- package/dist/scanner-import.d.ts.map +1 -1
- package/dist/scanner-import.js +16 -89
- package/dist/scanner-import.js.map +1 -1
- package/dist/security-policy.d.ts.map +1 -1
- package/dist/security-policy.js +26 -6
- package/dist/security-policy.js.map +1 -1
- package/dist/semgrep-findings.d.ts.map +1 -1
- package/dist/semgrep-findings.js +14 -48
- package/dist/semgrep-findings.js.map +1 -1
- package/dist/semgrep-platform-findings.d.ts +20 -70
- package/dist/semgrep-platform-findings.d.ts.map +1 -1
- package/dist/semgrep-platform-findings.js +116 -333
- package/dist/semgrep-platform-findings.js.map +1 -1
- package/dist/severity-review.d.ts.map +1 -1
- package/dist/severity-review.js +1 -0
- package/dist/severity-review.js.map +1 -1
- package/dist/snyk-findings.d.ts +2 -0
- package/dist/snyk-findings.d.ts.map +1 -1
- package/dist/snyk-findings.js +5 -8
- package/dist/snyk-findings.js.map +1 -1
- package/dist/snyk-rest-findings.d.ts +3 -20
- package/dist/snyk-rest-findings.d.ts.map +1 -1
- package/dist/snyk-rest-findings.js +45 -217
- package/dist/snyk-rest-findings.js.map +1 -1
- package/dist/sonar-findings.d.ts +1 -1
- package/dist/sonar-findings.d.ts.map +1 -1
- package/dist/sonar-findings.js +2 -4
- package/dist/sonar-findings.js.map +1 -1
- package/dist/sonar-import.d.ts +3 -0
- package/dist/sonar-import.d.ts.map +1 -1
- package/dist/sonar-import.js +28 -30
- package/dist/sonar-import.js.map +1 -1
- package/dist/stored-finding-projection.d.ts +6 -0
- package/dist/stored-finding-projection.d.ts.map +1 -0
- package/dist/stored-finding-projection.js +129 -0
- package/dist/stored-finding-projection.js.map +1 -0
- package/dist/stored-findings-publication.d.ts +23 -0
- package/dist/stored-findings-publication.d.ts.map +1 -0
- package/dist/stored-findings-publication.js +169 -0
- package/dist/stored-findings-publication.js.map +1 -0
- package/dist/targets.d.ts +8 -1
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +103 -23
- package/dist/targets.js.map +1 -1
- package/dist/tenable-findings.d.ts +1 -4
- package/dist/tenable-findings.d.ts.map +1 -1
- package/dist/tenable-findings.js.map +1 -1
- package/dist/trivy-findings.d.ts.map +1 -1
- package/dist/trivy-findings.js +0 -11
- package/dist/trivy-findings.js.map +1 -1
- package/dist/trusted-executable.d.ts +7 -0
- package/dist/trusted-executable.d.ts.map +1 -1
- package/dist/trusted-executable.js +148 -37
- package/dist/trusted-executable.js.map +1 -1
- package/dist/value.js +3 -1
- package/dist/value.js.map +1 -1
- package/dist/veracode-findings.d.ts +1 -3
- package/dist/veracode-findings.d.ts.map +1 -1
- package/dist/veracode-findings.js +13 -38
- package/dist/veracode-findings.js.map +1 -1
- package/dist/version.d.ts +3 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +184 -32
- package/dist/version.js.map +1 -1
- package/dist/wiz-findings.d.ts +2 -2
- package/dist/wiz-findings.d.ts.map +1 -1
- package/dist/wiz-findings.js +14 -92
- package/dist/wiz-findings.js.map +1 -1
- package/docs/classify-severity-records.md +30 -0
- package/docs/cli.md +537 -124
- package/docs/findings-service.md +22 -9
- package/docs/hosted-remediation.md +13 -4
- package/docs/sdk.md +918 -0
- package/package.json +15 -6
- package/schemas/external-findings.schema.json +2 -1
- package/schemas/project-config.schema.json +5 -0
- package/dist/hosted-scanner-v1.d.ts +0 -6
- package/dist/hosted-scanner-v1.d.ts.map +0 -1
- package/dist/hosted-scanner-v1.js +0 -60
- package/dist/hosted-scanner-v1.js.map +0 -1
- package/dist/reader-selection.d.ts +0 -15
- package/dist/reader-selection.d.ts.map +0 -1
- package/dist/reader-selection.js +0 -89
- package/dist/reader-selection.js.map +0 -1
- package/dist/semgrep-platform-v1.d.ts +0 -6
- package/dist/semgrep-platform-v1.d.ts.map +0 -1
- package/dist/semgrep-platform-v1.js +0 -83
- package/dist/semgrep-platform-v1.js.map +0 -1
- package/dist/snyk-rest-v1.d.ts +0 -28
- package/dist/snyk-rest-v1.d.ts.map +0 -1
- package/dist/snyk-rest-v1.js +0 -132
- package/dist/snyk-rest-v1.js.map +0 -1
|
@@ -12,7 +12,6 @@ import sys
|
|
|
12
12
|
from contextlib import closing
|
|
13
13
|
from pathlib import Path
|
|
14
14
|
from typing import Any
|
|
15
|
-
from urllib.parse import quote
|
|
16
15
|
|
|
17
16
|
# Some plugin hosts launch Python with safe-path isolation enabled.
|
|
18
17
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
@@ -27,6 +26,7 @@ from finalize_scan_contract import (
|
|
|
27
26
|
write_export_output,
|
|
28
27
|
write_sarif_projection,
|
|
29
28
|
)
|
|
29
|
+
from snapshot_sqlite import readonly_sqlite_uri
|
|
30
30
|
from validate_scan_contract import validate_contract
|
|
31
31
|
from workbench_constants import PRIMARY_FINDING_LOCATION_SQL
|
|
32
32
|
|
|
@@ -226,9 +226,8 @@ def finding_issues(db: Any, payload: Any) -> dict[str, Any]:
|
|
|
226
226
|
except PermissionError:
|
|
227
227
|
pass # Let SQLite report the open failure used by the host's state fallback.
|
|
228
228
|
if payload["action"] == "inspect":
|
|
229
|
-
database_uri = f"file:{quote(str(path), safe='')}?mode=ro"
|
|
230
229
|
try:
|
|
231
|
-
connection = sqlite3.connect(
|
|
230
|
+
connection = sqlite3.connect(readonly_sqlite_uri(path), uri=True, timeout=5)
|
|
232
231
|
except sqlite3.OperationalError as exc:
|
|
233
232
|
if str(exc) == "unable to open database file":
|
|
234
233
|
exc._codex_security_state_unavailable = True
|
|
@@ -11,7 +11,7 @@ import re
|
|
|
11
11
|
import sqlite3
|
|
12
12
|
import sys
|
|
13
13
|
from collections.abc import Callable
|
|
14
|
-
from contextlib import ExitStack, suppress
|
|
14
|
+
from contextlib import AbstractContextManager, ExitStack, suppress
|
|
15
15
|
from datetime import datetime, timedelta, timezone
|
|
16
16
|
from pathlib import Path
|
|
17
17
|
from typing import Any, BinaryIO
|
|
@@ -30,7 +30,11 @@ from finalize_scan_contract import (
|
|
|
30
30
|
stage_scan_local_bytes,
|
|
31
31
|
)
|
|
32
32
|
from posix_scan_local_files import managed_fd
|
|
33
|
-
from workbench_constants import
|
|
33
|
+
from workbench_constants import (
|
|
34
|
+
CLAIM_LEASE_SECONDS,
|
|
35
|
+
DELIVERED_ACTION_LEASE_SECONDS,
|
|
36
|
+
PATCH_PREVIEW_BYTES,
|
|
37
|
+
)
|
|
34
38
|
from workbench_target import git_command, git_output
|
|
35
39
|
from workbench_validation import optional_text, require_occurrence, require_uuid
|
|
36
40
|
|
|
@@ -46,6 +50,142 @@ COMMANDS = {
|
|
|
46
50
|
SCAN_STATUS_ERROR = "Remediation is available only for successfully completed scans."
|
|
47
51
|
|
|
48
52
|
|
|
53
|
+
def patch_artifact_preview(
|
|
54
|
+
scan_dir: Path,
|
|
55
|
+
relative_path: str | None,
|
|
56
|
+
expected_digest: str | None,
|
|
57
|
+
open_scan_file: Callable[[Path, str], AbstractContextManager[BinaryIO]],
|
|
58
|
+
) -> tuple[str | None, dict[str, int | bool] | None]:
|
|
59
|
+
if relative_path is None or expected_digest is None:
|
|
60
|
+
return None, None
|
|
61
|
+
digest = hashlib.sha256()
|
|
62
|
+
preview = bytearray()
|
|
63
|
+
additions = 0
|
|
64
|
+
deletions = 0
|
|
65
|
+
file_count = 0
|
|
66
|
+
old_headers = 0
|
|
67
|
+
new_headers = 0
|
|
68
|
+
at_line_start = True
|
|
69
|
+
try:
|
|
70
|
+
with open_scan_file(scan_dir, relative_path) as patch:
|
|
71
|
+
while chunk := patch.readline(1024 * 1024):
|
|
72
|
+
digest.update(chunk)
|
|
73
|
+
if len(preview) <= PATCH_PREVIEW_BYTES:
|
|
74
|
+
preview.extend(chunk[: PATCH_PREVIEW_BYTES + 1 - len(preview)])
|
|
75
|
+
if at_line_start:
|
|
76
|
+
if chunk.startswith(b"diff --git "):
|
|
77
|
+
file_count += 1
|
|
78
|
+
elif chunk.startswith(b"+++ "):
|
|
79
|
+
new_headers += 1
|
|
80
|
+
elif chunk.startswith(b"--- "):
|
|
81
|
+
old_headers += 1
|
|
82
|
+
elif chunk.startswith(b"+"):
|
|
83
|
+
additions += 1
|
|
84
|
+
elif chunk.startswith(b"-"):
|
|
85
|
+
deletions += 1
|
|
86
|
+
at_line_start = chunk.endswith(b"\n")
|
|
87
|
+
except SystemExit:
|
|
88
|
+
return None, None
|
|
89
|
+
if f"sha256:{digest.hexdigest()}" != expected_digest:
|
|
90
|
+
return None, None
|
|
91
|
+
preview_truncated = len(preview) > PATCH_PREVIEW_BYTES
|
|
92
|
+
preview_text = preview[:PATCH_PREVIEW_BYTES].decode("utf-8", errors="replace")
|
|
93
|
+
if preview_truncated:
|
|
94
|
+
preview_text = f"{preview_text}\n... patch preview truncated ..."
|
|
95
|
+
return preview_text, {
|
|
96
|
+
"additions": additions,
|
|
97
|
+
"deletions": deletions,
|
|
98
|
+
"fileCount": file_count or min(old_headers, new_headers),
|
|
99
|
+
"previewTruncated": preview_truncated,
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def reverse_reviewed_patch(
|
|
104
|
+
target: Path,
|
|
105
|
+
checkout: Path,
|
|
106
|
+
metadata: Path | None,
|
|
107
|
+
pinned_metadata: Path | None,
|
|
108
|
+
patch_digest: str,
|
|
109
|
+
pins: ExitStack,
|
|
110
|
+
patch: Path,
|
|
111
|
+
pathspec: str | None,
|
|
112
|
+
) -> tuple[Path | None, Path | None]:
|
|
113
|
+
"""Reverse reviewed bytes and select the Git references for subsequent content snapshots."""
|
|
114
|
+
|
|
115
|
+
arguments = ["--reverse", "--whitespace=nowarn"]
|
|
116
|
+
if pathspec is None:
|
|
117
|
+
arguments.append("--no-index")
|
|
118
|
+
elif pathspec != ".":
|
|
119
|
+
arguments.append(f"--directory={pathspec}")
|
|
120
|
+
arguments.append(str(patch))
|
|
121
|
+
|
|
122
|
+
def reverse(*, git_dir: Path | None, check: bool = False):
|
|
123
|
+
return git_command(
|
|
124
|
+
checkout,
|
|
125
|
+
"apply",
|
|
126
|
+
*(["--check"] if check else []),
|
|
127
|
+
*arguments,
|
|
128
|
+
text=False,
|
|
129
|
+
git_dir=git_dir,
|
|
130
|
+
work_tree=checkout if git_dir else None,
|
|
131
|
+
environment_overrides={"LC_ALL": "C", "LANGUAGE": "C"} if check else None,
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
applied = reverse(git_dir=metadata)
|
|
135
|
+
short = None
|
|
136
|
+
diagnostic = b"fatal: '$GIT_DIR' too big"
|
|
137
|
+
if (
|
|
138
|
+
os.name == "nt"
|
|
139
|
+
and metadata is not None
|
|
140
|
+
and applied.returncode == 128
|
|
141
|
+
and not applied.stdout
|
|
142
|
+
and b"GIT_DIR" in applied.stderr
|
|
143
|
+
):
|
|
144
|
+
# Confirm translated messages without applying the reverse patch twice.
|
|
145
|
+
failure = (
|
|
146
|
+
applied
|
|
147
|
+
if diagnostic in applied.stderr.splitlines()
|
|
148
|
+
else reverse(git_dir=metadata, check=True)
|
|
149
|
+
)
|
|
150
|
+
if (
|
|
151
|
+
failure.returncode == 128
|
|
152
|
+
and not failure.stdout
|
|
153
|
+
and diagnostic in failure.stderr.splitlines()
|
|
154
|
+
):
|
|
155
|
+
short = prepare_replay_gitfile(checkout, pinned_metadata, patch_digest, pins)
|
|
156
|
+
applied = reverse(git_dir=short)
|
|
157
|
+
if applied.returncode != 0:
|
|
158
|
+
raise SystemExit(
|
|
159
|
+
"The selected checkout does not contain the reviewed remediation patch. Apply exactly that patch before recording it as applied."
|
|
160
|
+
)
|
|
161
|
+
replay_root = None
|
|
162
|
+
if pathspec is None and short is not None:
|
|
163
|
+
selected_root = git_output(target, "rev-parse", "--show-toplevel")
|
|
164
|
+
if selected_root and Path(selected_root).samefile(target):
|
|
165
|
+
replay_root = short
|
|
166
|
+
return short, replay_root
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def prepare_replay_gitfile(
|
|
170
|
+
checkout: Path, pinned_metadata: Path | None, patch_digest: str, pins: ExitStack
|
|
171
|
+
) -> Path:
|
|
172
|
+
"""Retain the verified patch and short metadata reference through the final snapshot."""
|
|
173
|
+
if pinned_metadata is None:
|
|
174
|
+
raise SystemExit(
|
|
175
|
+
"Could not bind the selected Windows Git directory and private patch replay directory."
|
|
176
|
+
)
|
|
177
|
+
from windows_scan_local_files import open_read_fd, pinned_replay_gitfile
|
|
178
|
+
|
|
179
|
+
try:
|
|
180
|
+
short = pins.enter_context(pinned_replay_gitfile(checkout, pinned_metadata))
|
|
181
|
+
fd = open_read_fd(checkout.parent, "reviewed.patch", "reviewed remediation patch")
|
|
182
|
+
patch = pins.enter_context(os.fdopen(fd, "rb"))
|
|
183
|
+
matching_patch_metadata(patch, patch_digest)
|
|
184
|
+
except (OSError, ValueError) as exc:
|
|
185
|
+
raise SystemExit(f"Could not verify the reviewed patch replay: {exc}") from exc
|
|
186
|
+
return short
|
|
187
|
+
|
|
188
|
+
|
|
49
189
|
def require_available(connection: sqlite3.Connection, args: Any, require_scan: Any) -> None:
|
|
50
190
|
"""Require a successfully completed scan for commands that act on a remediation request."""
|
|
51
191
|
if args.command not in COMMANDS:
|
|
@@ -1252,9 +1252,16 @@ def mark_running_scan_failed(
|
|
|
1252
1252
|
return updated.rowcount == 1
|
|
1253
1253
|
|
|
1254
1254
|
|
|
1255
|
-
def touch_scan_progress(
|
|
1255
|
+
def touch_scan_progress(
|
|
1256
|
+
connection: sqlite3.Connection,
|
|
1257
|
+
scan_id: str,
|
|
1258
|
+
timestamp: str,
|
|
1259
|
+
scope_file_count: int | None = None,
|
|
1260
|
+
) -> bool:
|
|
1256
1261
|
updated = connection.execute(
|
|
1257
|
-
"UPDATE scan_progress SET updated_at =
|
|
1262
|
+
"UPDATE scan_progress SET updated_at = ?, scope_file_count = COALESCE(?, scope_file_count) "
|
|
1263
|
+
"WHERE scan_id = ?",
|
|
1264
|
+
(timestamp, scope_file_count, scan_id),
|
|
1258
1265
|
)
|
|
1259
1266
|
return updated.rowcount == 1
|
|
1260
1267
|
|
|
@@ -1267,6 +1274,18 @@ def fail_scan(db: Any, connection: Any, args: Any) -> dict[str, Any]:
|
|
|
1267
1274
|
def fail_scan_locked(db: Any, connection: Any, args: Any) -> dict[str, Any]:
|
|
1268
1275
|
scan_id = db.require_uuid(args.scan_id, "scan-id")
|
|
1269
1276
|
cost_json = db.parse_scan_cost(args.cost_json)
|
|
1277
|
+
observed = db.require_scan(connection, scan_id)
|
|
1278
|
+
scope_file_count = None
|
|
1279
|
+
if observed["status"] == "running" and observed["mode"] == "standard":
|
|
1280
|
+
db.handoff.require_tokenless_scan_owner(
|
|
1281
|
+
connection, observed, getattr(args, "model_thread_id", None)
|
|
1282
|
+
)
|
|
1283
|
+
db.handoff.require_current_continuation(
|
|
1284
|
+
observed,
|
|
1285
|
+
args.claim_token,
|
|
1286
|
+
error_message="Scan failure is owned by another continuation.",
|
|
1287
|
+
)
|
|
1288
|
+
scope_file_count = db.progress.reported_scope_file_count(db, observed)
|
|
1270
1289
|
connection.execute("BEGIN IMMEDIATE")
|
|
1271
1290
|
with connection:
|
|
1272
1291
|
timestamp = db.now()
|
|
@@ -1289,7 +1308,12 @@ def fail_scan_locked(db: Any, connection: Any, args: Any) -> dict[str, Any]:
|
|
|
1289
1308
|
if not mark_running_scan_failed(connection, scan_id, message, timestamp):
|
|
1290
1309
|
raise SystemExit("Only a running scan can be marked failed.")
|
|
1291
1310
|
db.deep_scan.fail_from_parent_scan(connection, scan["id"], message, timestamp)
|
|
1292
|
-
if not touch_scan_progress(
|
|
1311
|
+
if not touch_scan_progress(
|
|
1312
|
+
connection,
|
|
1313
|
+
scan_id,
|
|
1314
|
+
timestamp,
|
|
1315
|
+
scope_file_count if scan["scan_dir"] == observed["scan_dir"] else None,
|
|
1316
|
+
):
|
|
1293
1317
|
raise SystemExit("Codex Security scan progress not found.")
|
|
1294
1318
|
record_stopped_scan_usage(db, connection, scan_id, cost_json)
|
|
1295
1319
|
preserve_stopped_results_after_transition(db, connection, scan["id"])
|
|
@@ -1301,9 +1325,23 @@ def cancel_scan(db: Any, connection: Any, args: Any) -> dict[str, Any]:
|
|
|
1301
1325
|
return cancel_scan_locked(db, connection, args)
|
|
1302
1326
|
|
|
1303
1327
|
|
|
1328
|
+
def require_cancel_owner(
|
|
1329
|
+
db: Any, connection: Any, scan: sqlite3.Row, thread_id: str | None
|
|
1330
|
+
) -> None:
|
|
1331
|
+
workspace = db.require_workspace(connection, scan["workspace_id"])
|
|
1332
|
+
owning_thread_id = scan["continuation_thread_id"] or workspace["thread_id"]
|
|
1333
|
+
if thread_id is not None and owning_thread_id != thread_id:
|
|
1334
|
+
raise SystemExit("A scan can only be canceled from its owning Codex thread.")
|
|
1335
|
+
|
|
1336
|
+
|
|
1304
1337
|
def cancel_scan_locked(db: Any, connection: Any, args: Any) -> dict[str, Any]:
|
|
1305
1338
|
scan_id = db.require_uuid(args.scan_id, "scan-id")
|
|
1306
1339
|
thread_id = db.optional_text(args.thread_id, maximum=512)
|
|
1340
|
+
observed = db.require_scan(connection, scan_id)
|
|
1341
|
+
scope_file_count = None
|
|
1342
|
+
if observed["status"] == "running" and observed["mode"] == "standard":
|
|
1343
|
+
require_cancel_owner(db, connection, observed, thread_id)
|
|
1344
|
+
scope_file_count = db.progress.reported_scope_file_count(db, observed)
|
|
1307
1345
|
cost_json = db.parse_scan_cost(getattr(args, "cost_json", None))
|
|
1308
1346
|
# The app displays the active scan. A conversation may only receive the scan it canceled.
|
|
1309
1347
|
result_scan_id = scan_id if thread_id is not None else None
|
|
@@ -1311,10 +1349,7 @@ def cancel_scan_locked(db: Any, connection: Any, args: Any) -> dict[str, Any]:
|
|
|
1311
1349
|
with connection:
|
|
1312
1350
|
timestamp = db.now()
|
|
1313
1351
|
scan = db.require_scan(connection, scan_id)
|
|
1314
|
-
|
|
1315
|
-
owning_thread_id = scan["continuation_thread_id"] or workspace["thread_id"]
|
|
1316
|
-
if thread_id is not None and owning_thread_id != thread_id:
|
|
1317
|
-
raise SystemExit("A scan can only be canceled from its owning Codex thread.")
|
|
1352
|
+
require_cancel_owner(db, connection, scan, thread_id)
|
|
1318
1353
|
if scan["canceled_at"] is not None:
|
|
1319
1354
|
connection.commit()
|
|
1320
1355
|
record_stopped_scan_usage(db, connection, scan_id, cost_json)
|
|
@@ -1337,7 +1372,12 @@ def cancel_scan_locked(db: Any, connection: Any, args: Any) -> dict[str, Any]:
|
|
|
1337
1372
|
if updated.rowcount != 1:
|
|
1338
1373
|
raise SystemExit("Only a running scan can be canceled.")
|
|
1339
1374
|
db.deep_scan.cancel_from_parent_scan(connection, scan["id"], timestamp)
|
|
1340
|
-
if not touch_scan_progress(
|
|
1375
|
+
if not touch_scan_progress(
|
|
1376
|
+
connection,
|
|
1377
|
+
scan_id,
|
|
1378
|
+
timestamp,
|
|
1379
|
+
scope_file_count if scan["scan_dir"] == observed["scan_dir"] else None,
|
|
1380
|
+
):
|
|
1341
1381
|
raise SystemExit("Codex Security scan progress not found.")
|
|
1342
1382
|
record_stopped_scan_usage(db, connection, scan_id, cost_json)
|
|
1343
1383
|
preserve_stopped_results_after_transition(db, connection, scan["id"])
|