@openai/codex-security 0.1.4 → 0.1.6
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 +127 -13
- package/_bundled_plugin/.codex-plugin/plugin.json +1 -1
- package/_bundled_plugin/.mcp.json +8 -1
- package/_bundled_plugin/examples/completed-scan/findings.json +6 -0
- package/_bundled_plugin/examples/completed-scan/scan-manifest.json +1 -1
- package/_bundled_plugin/mcp/mcp-app.html.br +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-001 +0 -0
- package/_bundled_plugin/preflight/capability-profiles.toml +0 -57
- package/_bundled_plugin/references/config-preflight.md +1 -1
- package/_bundled_plugin/references/final-report.md +15 -7
- package/_bundled_plugin/references/finding-detail-fields.md +10 -2
- package/_bundled_plugin/references/scan-artifacts.md +11 -9
- package/_bundled_plugin/references/scan-contract.md +3 -1
- package/_bundled_plugin/schemas/definitions/artifact-common.schema.json +42 -0
- package/_bundled_plugin/schemas/definitions/discovery-candidate.schema.json +100 -0
- package/_bundled_plugin/schemas/tools/candidate-attack-paths.schema.json +181 -0
- package/_bundled_plugin/schemas/tools/candidate-validations.schema.json +166 -0
- package/_bundled_plugin/schemas/tools/deep-reducer.schema.json +120 -0
- package/_bundled_plugin/schemas/tools/discovery-candidates.schema.json +83 -0
- package/_bundled_plugin/schemas/tools/review-items.schema.json +80 -0
- package/_bundled_plugin/schemas/tools/scan-draft.schema.json +572 -0
- package/_bundled_plugin/schemas/tools/worker-threat-model.schema.json +18 -0
- package/_bundled_plugin/scripts/deep_scan_config.py +11 -3
- package/_bundled_plugin/scripts/deep_scan_workbench.py +153 -133
- package/_bundled_plugin/scripts/finalize_scan_contract.py +39 -0
- package/_bundled_plugin/scripts/generate_in_scope_files.py +134 -0
- package/_bundled_plugin/scripts/workbench_cli.py +33 -1
- package/_bundled_plugin/scripts/workbench_db.py +181 -118
- package/_bundled_plugin/scripts/workbench_feedback.py +2 -0
- package/_bundled_plugin/scripts/workbench_native_indexes.py +5 -49
- package/_bundled_plugin/scripts/workbench_progress.py +86 -3
- package/_bundled_plugin/scripts/workbench_remediation.py +19 -1
- package/_bundled_plugin/scripts/workbench_scan_history.py +7 -1
- package/_bundled_plugin/scripts/workbench_scan_start.py +11 -5
- package/_bundled_plugin/scripts/workbench_scan_usage.py +557 -0
- package/_bundled_plugin/scripts/workbench_schema.py +501 -0
- package/_bundled_plugin/scripts/workbench_target.py +14 -1
- package/_bundled_plugin/scripts/workbench_validation.py +117 -13
- package/_bundled_plugin/skills/attack-path-analysis/SKILL.md +4 -4
- package/_bundled_plugin/skills/deep-security-scan/SKILL.md +34 -28
- package/_bundled_plugin/skills/finding-discovery/SKILL.md +1 -1
- package/_bundled_plugin/skills/security-diff-scan/SKILL.md +11 -8
- package/_bundled_plugin/skills/security-scan/SKILL.md +16 -9
- package/_bundled_plugin/skills/security-scan/references/repository-wide-scan.md +26 -14
- package/_bundled_plugin/skills/security-scan/references/scan-artifacts-and-ledger.md +1 -1
- package/_bundled_plugin/skills/threat-model/SKILL.md +2 -2
- package/_bundled_plugin/skills/validation/SKILL.md +5 -5
- package/_bundled_plugin/skills/vulnerability-writeup/SKILL.md +145 -227
- package/_bundled_plugin/skills/vulnerability-writeup/references/report-format.md +53 -68
- package/dist/api.d.ts +30 -8
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +438 -66
- package/dist/api.js.map +1 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +262 -44
- package/dist/auth.js.map +1 -1
- package/dist/cli.d.ts +4 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +713 -148
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +28 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +39 -2
- package/dist/config.js.map +1 -1
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +14 -0
- package/dist/contract.js.map +1 -1
- package/dist/cost.d.ts +7 -0
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +397 -26
- package/dist/cost.js.map +1 -1
- package/dist/errors.d.ts +2 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +48 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/multiscan.d.ts +1 -0
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +5 -7
- package/dist/multiscan.js.map +1 -1
- package/dist/runtime.d.ts +40 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +742 -46
- package/dist/runtime.js.map +1 -1
- package/dist/scan-activity.d.ts +13 -0
- package/dist/scan-activity.d.ts.map +1 -0
- package/dist/scan-activity.js +319 -0
- package/dist/scan-activity.js.map +1 -0
- package/dist/scan-dashboard.d.ts +47 -0
- package/dist/scan-dashboard.d.ts.map +1 -0
- package/dist/scan-dashboard.js +444 -0
- package/dist/scan-dashboard.js.map +1 -0
- package/dist/scan-history-renderer.d.ts.map +1 -1
- package/dist/scan-history-renderer.js +4 -1
- package/dist/scan-history-renderer.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/worker-progress.d.ts +7 -0
- package/dist/worker-progress.d.ts.map +1 -1
- package/dist/worker-progress.js +68 -0
- package/dist/worker-progress.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Generate the shared, deterministically ordered security-scan file inventory."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import argparse
|
|
7
|
+
import subprocess
|
|
8
|
+
import sys
|
|
9
|
+
import tempfile
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class InventoryError(ValueError):
|
|
14
|
+
"""Raised when the repository, scope, or inventory cannot be used safely."""
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def resolve_repository(value: str) -> Path:
|
|
18
|
+
"""Resolve the repository once so every scope is bound to its real root."""
|
|
19
|
+
try:
|
|
20
|
+
repository = Path(value).expanduser().resolve(strict=True)
|
|
21
|
+
except (OSError, ValueError) as error:
|
|
22
|
+
raise InventoryError(f"--repo: cannot resolve repository: {value}") from error
|
|
23
|
+
if not repository.is_dir():
|
|
24
|
+
raise InventoryError(f"--repo: expected a directory: {repository}")
|
|
25
|
+
return repository
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def resolve_scope(repository: Path, value: str) -> str:
|
|
29
|
+
"""Preserve ripgrep's relative path spelling while rejecting escaped scopes."""
|
|
30
|
+
if not value or "\0" in value:
|
|
31
|
+
raise InventoryError("--scope: expected a non-empty file or directory")
|
|
32
|
+
|
|
33
|
+
requested = Path(value).expanduser()
|
|
34
|
+
scope = requested if requested.is_absolute() else repository / requested
|
|
35
|
+
try:
|
|
36
|
+
resolved = scope.resolve(strict=True)
|
|
37
|
+
except (OSError, ValueError) as error:
|
|
38
|
+
raise InventoryError(f"--scope: path does not exist: {value}") from error
|
|
39
|
+
|
|
40
|
+
try:
|
|
41
|
+
relative = resolved.relative_to(repository)
|
|
42
|
+
except ValueError as error:
|
|
43
|
+
raise InventoryError(f"--scope: path must remain inside --repo: {value}") from error
|
|
44
|
+
|
|
45
|
+
if not resolved.is_dir() and not resolved.is_file():
|
|
46
|
+
raise InventoryError(f"--scope: expected a file or directory: {value}")
|
|
47
|
+
|
|
48
|
+
if requested.is_absolute():
|
|
49
|
+
return relative.as_posix() if relative.parts else "."
|
|
50
|
+
return value
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def resolve_output(value: str) -> Path:
|
|
54
|
+
"""Reject direct symlink outputs without constraining the artifact root."""
|
|
55
|
+
if not value or "\0" in value:
|
|
56
|
+
raise InventoryError("--out: expected an inventory file path")
|
|
57
|
+
requested = Path(value).expanduser()
|
|
58
|
+
if requested.is_symlink():
|
|
59
|
+
raise InventoryError("--out: refusing to replace a symbolic link")
|
|
60
|
+
try:
|
|
61
|
+
output = requested.resolve(strict=False)
|
|
62
|
+
except (OSError, ValueError) as error:
|
|
63
|
+
raise InventoryError(f"--out: cannot resolve inventory path: {value}") from error
|
|
64
|
+
if output.exists() and not output.is_file():
|
|
65
|
+
raise InventoryError(f"--out: expected a regular file path: {output}")
|
|
66
|
+
return output
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def generate_in_scope_files(repository: Path, scope: str, output: Path) -> int:
|
|
70
|
+
"""Atomically write the exact ripgrep inventory sorted as ``LC_ALL=C``."""
|
|
71
|
+
command = ["rg", "--files", "--hidden", "--no-ignore", "--glob", "!.git/**", "--", scope]
|
|
72
|
+
with tempfile.TemporaryFile(mode="w+b") as inventory:
|
|
73
|
+
try:
|
|
74
|
+
result = subprocess.run(
|
|
75
|
+
command,
|
|
76
|
+
cwd=repository,
|
|
77
|
+
stdout=inventory,
|
|
78
|
+
stderr=subprocess.PIPE,
|
|
79
|
+
check=False,
|
|
80
|
+
)
|
|
81
|
+
except OSError as error:
|
|
82
|
+
raise InventoryError(f"could not run ripgrep: {error}") from error
|
|
83
|
+
|
|
84
|
+
if result.returncode not in (0, 1):
|
|
85
|
+
detail = result.stderr.decode("utf-8", errors="replace").strip()
|
|
86
|
+
message = f"ripgrep exited with status {result.returncode}"
|
|
87
|
+
if detail:
|
|
88
|
+
message = f"{message}: {detail}"
|
|
89
|
+
raise InventoryError(message)
|
|
90
|
+
|
|
91
|
+
inventory.seek(0)
|
|
92
|
+
rows = sorted(inventory)
|
|
93
|
+
|
|
94
|
+
output.parent.mkdir(parents=True, exist_ok=True)
|
|
95
|
+
temporary: Path | None = None
|
|
96
|
+
try:
|
|
97
|
+
with tempfile.NamedTemporaryFile(
|
|
98
|
+
mode="wb",
|
|
99
|
+
dir=output.parent,
|
|
100
|
+
prefix=f".{output.name}.",
|
|
101
|
+
suffix=".tmp",
|
|
102
|
+
delete=False,
|
|
103
|
+
) as handle:
|
|
104
|
+
temporary = Path(handle.name)
|
|
105
|
+
handle.writelines(rows)
|
|
106
|
+
temporary.replace(output)
|
|
107
|
+
finally:
|
|
108
|
+
if temporary is not None:
|
|
109
|
+
temporary.unlink(missing_ok=True)
|
|
110
|
+
|
|
111
|
+
return len(rows)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def main() -> None:
|
|
115
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
116
|
+
parser.add_argument("--repo", required=True, help="Repository root.")
|
|
117
|
+
parser.add_argument("--scope", required=True, help="File or directory within the repository.")
|
|
118
|
+
parser.add_argument("--out", required=True, help="Destination for the file inventory.")
|
|
119
|
+
args = parser.parse_args()
|
|
120
|
+
|
|
121
|
+
try:
|
|
122
|
+
repository = resolve_repository(args.repo)
|
|
123
|
+
scope = resolve_scope(repository, args.scope)
|
|
124
|
+
output = resolve_output(args.out)
|
|
125
|
+
count = generate_in_scope_files(repository, scope, output)
|
|
126
|
+
except (OSError, ValueError) as error:
|
|
127
|
+
print(f"generate_in_scope_files: {error}", file=sys.stderr)
|
|
128
|
+
raise SystemExit(2) from error
|
|
129
|
+
|
|
130
|
+
print(f"Recorded {count} in-scope files.")
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
if __name__ == "__main__":
|
|
134
|
+
main()
|
|
@@ -75,7 +75,7 @@ def parse_args(description: str) -> argparse.Namespace:
|
|
|
75
75
|
begin_diff_resolution.add_argument("--workspace-id", required=True)
|
|
76
76
|
begin_diff_resolution.add_argument("--request-id", required=True)
|
|
77
77
|
begin_diff_resolution.add_argument("--target-path", required=True)
|
|
78
|
-
begin_diff_resolution.add_argument("--user-context"
|
|
78
|
+
begin_diff_resolution.add_argument("--user-context")
|
|
79
79
|
|
|
80
80
|
cancel_diff_resolution = subparsers.add_parser("cancel-diff-resolution")
|
|
81
81
|
cancel_diff_resolution.add_argument("--workspace-id", required=True)
|
|
@@ -113,6 +113,8 @@ def parse_args(description: str) -> argparse.Namespace:
|
|
|
113
113
|
start_scan = subparsers.add_parser("start-scan")
|
|
114
114
|
start_scan.add_argument("--workspace-id", required=True)
|
|
115
115
|
start_scan.add_argument("--scan-root")
|
|
116
|
+
start_scan.add_argument("--model")
|
|
117
|
+
start_scan.add_argument("--reasoning-effort")
|
|
116
118
|
|
|
117
119
|
disable_setup_ui = subparsers.add_parser("disable-setup-ui")
|
|
118
120
|
disable_setup_ui.add_argument("--workspace-id", required=True)
|
|
@@ -129,6 +131,25 @@ def parse_args(description: str) -> argparse.Namespace:
|
|
|
129
131
|
start_prompt_only_scan.add_argument("--diff-head-revision")
|
|
130
132
|
start_prompt_only_scan.add_argument("--diff-content-digest")
|
|
131
133
|
start_prompt_only_scan.add_argument("--scan-root")
|
|
134
|
+
start_prompt_only_scan.add_argument("--model")
|
|
135
|
+
start_prompt_only_scan.add_argument("--reasoning-effort")
|
|
136
|
+
|
|
137
|
+
start_headless_standard_scan = subparsers.add_parser("start-headless-standard-scan")
|
|
138
|
+
start_headless_standard_scan.add_argument("--thread-id", required=True)
|
|
139
|
+
start_headless_standard_scan.add_argument("--target-path", required=True)
|
|
140
|
+
start_headless_standard_scan.add_argument("--scope", required=True)
|
|
141
|
+
start_headless_standard_scan.add_argument("--target-summary")
|
|
142
|
+
start_headless_standard_scan.add_argument("--user-context")
|
|
143
|
+
start_headless_standard_scan.add_argument("--scan-root")
|
|
144
|
+
start_headless_standard_scan.add_argument("--model")
|
|
145
|
+
start_headless_standard_scan.add_argument("--reasoning-effort")
|
|
146
|
+
start_headless_standard_scan.set_defaults(
|
|
147
|
+
mode="standard",
|
|
148
|
+
diff_target_kind=None,
|
|
149
|
+
diff_base_revision=None,
|
|
150
|
+
diff_head_revision=None,
|
|
151
|
+
diff_content_digest=None,
|
|
152
|
+
)
|
|
132
153
|
|
|
133
154
|
deep_scan.register_subcommands(subparsers, positive_int)
|
|
134
155
|
|
|
@@ -139,6 +160,14 @@ def parse_args(description: str) -> argparse.Namespace:
|
|
|
139
160
|
get_scan_feedback = subparsers.add_parser("get-scan-feedback")
|
|
140
161
|
get_scan_feedback.add_argument("--scan-id", required=True)
|
|
141
162
|
|
|
163
|
+
update_scan_context = subparsers.add_parser("update-scan-context")
|
|
164
|
+
update_scan_context.add_argument("--scan-id", required=True)
|
|
165
|
+
update_scan_context.add_argument("--user-context", required=True)
|
|
166
|
+
update_scan_context_owner = update_scan_context.add_mutually_exclusive_group(required=True)
|
|
167
|
+
update_scan_context_owner.add_argument("--workspace-id")
|
|
168
|
+
update_scan_context_owner.add_argument("--thread-id")
|
|
169
|
+
update_scan_context.add_argument("--claim-token")
|
|
170
|
+
|
|
142
171
|
list_scans = subparsers.add_parser("list-scans")
|
|
143
172
|
list_scans.add_argument("--query")
|
|
144
173
|
list_scans.add_argument("--target-id")
|
|
@@ -209,6 +238,8 @@ def parse_args(description: str) -> argparse.Namespace:
|
|
|
209
238
|
update_progress.add_argument("--reportable-findings-count", type=non_negative_int)
|
|
210
239
|
update_progress.add_argument("--deep-review-pass", type=positive_int)
|
|
211
240
|
update_progress.add_argument("--claim-token")
|
|
241
|
+
update_progress.add_argument("--model")
|
|
242
|
+
update_progress.add_argument("--reasoning-effort")
|
|
212
243
|
|
|
213
244
|
prepare_scan_completion = subparsers.add_parser("prepare-scan-completion")
|
|
214
245
|
prepare_scan_completion.add_argument("--scan-id", required=True)
|
|
@@ -218,6 +249,7 @@ def parse_args(description: str) -> argparse.Namespace:
|
|
|
218
249
|
complete_scan.add_argument("--scan-id", required=True)
|
|
219
250
|
complete_scan.add_argument("--claim-token")
|
|
220
251
|
complete_scan.add_argument("--cost-json")
|
|
252
|
+
complete_scan.add_argument("--thread-id")
|
|
221
253
|
|
|
222
254
|
cancel_scan = subparsers.add_parser("cancel-scan")
|
|
223
255
|
cancel_scan.add_argument("--scan-id", required=True)
|