@openai/codex-security 0.1.7 → 0.1.9
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 +23 -11
- package/_bundled_plugin/.codex-plugin/plugin.json +1 -1
- package/_bundled_plugin/mcp/server.mjs +1 -1
- 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 +2 -2
- package/_bundled_plugin/references/config-preflight.md +6 -6
- package/_bundled_plugin/references/desktop-config-preflight.md +11 -0
- package/_bundled_plugin/references/final-report.md +10 -14
- package/_bundled_plugin/references/scan-artifacts.md +17 -17
- package/_bundled_plugin/references/shared-hard-rules.md +2 -2
- package/_bundled_plugin/scripts/deep_scan_workbench.py +422 -48
- package/_bundled_plugin/scripts/generate_rank_input.py +118 -1
- package/_bundled_plugin/scripts/workbench_cli.py +1 -50
- package/_bundled_plugin/scripts/workbench_constants.py +0 -3
- package/_bundled_plugin/scripts/workbench_db.py +7 -297
- package/_bundled_plugin/scripts/workbench_progress.py +11 -0
- package/_bundled_plugin/scripts/workbench_scan_history.py +8 -64
- package/_bundled_plugin/scripts/workbench_target.py +2 -6
- package/_bundled_plugin/scripts/workbench_validation.py +0 -211
- package/_bundled_plugin/skills/attack-path-analysis/SKILL.md +10 -10
- package/_bundled_plugin/skills/deep-security-scan/SKILL.md +25 -43
- package/_bundled_plugin/skills/finding-discovery/SKILL.md +2 -4
- package/_bundled_plugin/skills/security-diff-scan/SKILL.md +11 -23
- package/_bundled_plugin/skills/security-scan/SKILL.md +89 -26
- package/_bundled_plugin/skills/security-scan/references/desktop-scan.md +25 -0
- package/_bundled_plugin/skills/security-scan/references/repository-wide-scan.md +11 -38
- package/_bundled_plugin/skills/security-scan/references/scan-artifacts-and-ledger.md +5 -6
- package/_bundled_plugin/skills/triage-finding/SKILL.md +6 -14
- package/_bundled_plugin/skills/validation/SKILL.md +9 -9
- package/dist/api.d.ts +3 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +113 -82
- package/dist/api.js.map +1 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +18 -71
- package/dist/auth.js.map +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +57 -136
- package/dist/cli.js.map +1 -1
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +7 -228
- package/dist/contract.js.map +1 -1
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +0 -4
- package/dist/cost.js.map +1 -1
- package/dist/knowledge-base.js +4 -4
- package/dist/knowledge-base.js.map +1 -1
- package/dist/multiscan.d.ts +5 -1
- package/dist/multiscan.d.ts.map +1 -1
- package/dist/multiscan.js +232 -26
- package/dist/multiscan.js.map +1 -1
- package/dist/runtime.d.ts +13 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +136 -242
- package/dist/runtime.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.map +1 -1
- package/dist/worker-progress.js +8 -29
- package/dist/worker-progress.js.map +1 -1
- package/package.json +3 -3
- package/_bundled_plugin/mcp/mcp-app.html.br +0 -0
|
@@ -27,6 +27,7 @@ from __future__ import annotations
|
|
|
27
27
|
import argparse
|
|
28
28
|
import hashlib
|
|
29
29
|
import json
|
|
30
|
+
import os
|
|
30
31
|
import re
|
|
31
32
|
import subprocess
|
|
32
33
|
import sys
|
|
@@ -37,6 +38,7 @@ from pathlib import Path
|
|
|
37
38
|
# Some plugin hosts launch Python with safe-path isolation enabled.
|
|
38
39
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
39
40
|
from rank_preview import DEFAULT_PREVIEW_BYTES, TEXT_CODE_EXTENSIONS, preview_for
|
|
41
|
+
from workbench_target import git_directory_snapshot_paths
|
|
40
42
|
|
|
41
43
|
EXCLUDED_DIRS = {
|
|
42
44
|
".cache",
|
|
@@ -153,6 +155,18 @@ def parse_args() -> argparse.Namespace:
|
|
|
153
155
|
help=f"Maximum UTF-8 bytes in each preview. Defaults to {DEFAULT_PREVIEW_BYTES}.",
|
|
154
156
|
)
|
|
155
157
|
|
|
158
|
+
scoped = subparsers.add_parser(
|
|
159
|
+
"make-repo-scope-input",
|
|
160
|
+
help="List every explicitly scoped file without ranking or reading its contents.",
|
|
161
|
+
)
|
|
162
|
+
scoped.add_argument("--repo", required=True, help="Repository root.")
|
|
163
|
+
scoped.add_argument(
|
|
164
|
+
"--scopes-file",
|
|
165
|
+
required=True,
|
|
166
|
+
help="JSON array of repository-relative files and directories to scan together.",
|
|
167
|
+
)
|
|
168
|
+
scoped.add_argument("--out", required=True, help="Output scoped-source-input.jsonl path.")
|
|
169
|
+
|
|
156
170
|
bind = subparsers.add_parser(
|
|
157
171
|
"bind-repo-scopes",
|
|
158
172
|
help="Copy SDK scoped-path targets into the unsealed manifest and coverage documents.",
|
|
@@ -274,10 +288,36 @@ def path_is_excluded(path: Path) -> bool:
|
|
|
274
288
|
return path.name.endswith((".min.js", ".map"))
|
|
275
289
|
|
|
276
290
|
|
|
277
|
-
def resolve_scope(
|
|
291
|
+
def resolve_scope(
|
|
292
|
+
repo: Path,
|
|
293
|
+
scope: str,
|
|
294
|
+
*,
|
|
295
|
+
expand_user: bool = True,
|
|
296
|
+
reject_symlinks: bool = False,
|
|
297
|
+
) -> Path:
|
|
278
298
|
scope_path = Path(scope).expanduser() if expand_user else Path(scope)
|
|
279
299
|
if not scope_path.is_absolute():
|
|
280
300
|
scope_path = repo / scope_path
|
|
301
|
+
if reject_symlinks:
|
|
302
|
+
repository = repo.resolve()
|
|
303
|
+
try:
|
|
304
|
+
relative = scope_path.relative_to(repository)
|
|
305
|
+
except ValueError as exc:
|
|
306
|
+
raise SystemExit(f"Scope must be inside repo: {scope_path}") from exc
|
|
307
|
+
ancestor = repository
|
|
308
|
+
for part in relative.parts:
|
|
309
|
+
if part == "..":
|
|
310
|
+
if ancestor == repository:
|
|
311
|
+
raise SystemExit(f"Scope must be inside repo: {scope_path}")
|
|
312
|
+
ancestor = ancestor.parent
|
|
313
|
+
continue
|
|
314
|
+
ancestor /= part
|
|
315
|
+
try:
|
|
316
|
+
metadata = ancestor.stat(follow_symlinks=False)
|
|
317
|
+
except OSError as exc:
|
|
318
|
+
raise SystemExit(f"Scope path not found: {ancestor}") from exc
|
|
319
|
+
if ancestor.is_symlink() or getattr(metadata, "st_reparse_tag", 0) & 0x20000000:
|
|
320
|
+
raise SystemExit(f"Requested scope must not contain symbolic links: {ancestor}")
|
|
281
321
|
scope_path = scope_path.resolve()
|
|
282
322
|
repo_resolved = repo.resolve()
|
|
283
323
|
try:
|
|
@@ -459,6 +499,81 @@ def make_repo_rank_input(args: argparse.Namespace) -> None:
|
|
|
459
499
|
print(f"Wrote {len(rows)} rows to {output}")
|
|
460
500
|
|
|
461
501
|
|
|
502
|
+
def make_repo_scope_input(args: argparse.Namespace) -> None:
|
|
503
|
+
repo = Path(args.repo).expanduser().resolve()
|
|
504
|
+
if not repo.is_dir():
|
|
505
|
+
raise SystemExit(f"Repo path not found: {repo}")
|
|
506
|
+
|
|
507
|
+
scopes = load_scopes_file(Path(args.scopes_file).expanduser())
|
|
508
|
+
rows_by_path: dict[str, JsonRow] = {}
|
|
509
|
+
for scope in scopes:
|
|
510
|
+
scope_path = resolve_scope(repo, scope, expand_user=False, reject_symlinks=True)
|
|
511
|
+
if scope_path.is_file():
|
|
512
|
+
candidates = (scope_path,)
|
|
513
|
+
else:
|
|
514
|
+
git_candidates = git_directory_snapshot_paths(scope_path)
|
|
515
|
+
if git_candidates is not None:
|
|
516
|
+
candidates = git_candidates
|
|
517
|
+
else:
|
|
518
|
+
command = [
|
|
519
|
+
"rg",
|
|
520
|
+
"--files",
|
|
521
|
+
"--hidden",
|
|
522
|
+
"--no-require-git",
|
|
523
|
+
"--null",
|
|
524
|
+
"--glob",
|
|
525
|
+
"!.git/**",
|
|
526
|
+
"--",
|
|
527
|
+
str(scope_path.relative_to(repo)),
|
|
528
|
+
]
|
|
529
|
+
try:
|
|
530
|
+
result = subprocess.run(command, cwd=repo, capture_output=True, check=False)
|
|
531
|
+
except OSError as exc:
|
|
532
|
+
ignore_names = (".gitignore", ".ignore", ".rgignore")
|
|
533
|
+
ancestors = (scope_path, *scope_path.parents)
|
|
534
|
+
has_ignore_rules = (
|
|
535
|
+
any((ancestor / ".git").exists() for ancestor in (repo, *repo.parents))
|
|
536
|
+
or any(
|
|
537
|
+
(ancestor / name).is_file()
|
|
538
|
+
for ancestor in ancestors
|
|
539
|
+
if ancestor == repo or repo in ancestor.parents
|
|
540
|
+
for name in ignore_names
|
|
541
|
+
)
|
|
542
|
+
or any(
|
|
543
|
+
path.name in ignore_names
|
|
544
|
+
for path in scope_path.rglob("*")
|
|
545
|
+
if path.is_file()
|
|
546
|
+
)
|
|
547
|
+
)
|
|
548
|
+
if has_ignore_rules:
|
|
549
|
+
raise SystemExit(
|
|
550
|
+
"Could not safely enumerate ignored scoped files without Git or ripgrep."
|
|
551
|
+
) from exc
|
|
552
|
+
candidates = scope_path.rglob("*")
|
|
553
|
+
else:
|
|
554
|
+
if result.returncode not in (0, 1):
|
|
555
|
+
detail = result.stderr.decode("utf-8", errors="replace").strip()
|
|
556
|
+
raise SystemExit(f"Could not enumerate scoped repository files: {detail}")
|
|
557
|
+
candidates = (
|
|
558
|
+
repo / os.fsdecode(path) for path in result.stdout.split(b"\0") if path
|
|
559
|
+
)
|
|
560
|
+
for path in candidates:
|
|
561
|
+
try:
|
|
562
|
+
if path.is_symlink() or not path.is_file():
|
|
563
|
+
continue
|
|
564
|
+
relative = path.resolve(strict=True).relative_to(repo)
|
|
565
|
+
except (OSError, ValueError):
|
|
566
|
+
continue
|
|
567
|
+
if ".git" in relative.parts:
|
|
568
|
+
continue
|
|
569
|
+
rows_by_path.setdefault(relative.as_posix(), {"path": relative.as_posix()})
|
|
570
|
+
|
|
571
|
+
rows = sorted(rows_by_path.values(), key=lambda row: str(row["path"]))
|
|
572
|
+
output = Path(args.out).expanduser()
|
|
573
|
+
write_jsonl(output, rows)
|
|
574
|
+
print(f"Wrote {len(rows)} scoped paths to {output}")
|
|
575
|
+
|
|
576
|
+
|
|
462
577
|
def bind_repo_scopes(args: argparse.Namespace) -> None:
|
|
463
578
|
scopes = load_scopes_file(Path(args.scopes_file).expanduser())
|
|
464
579
|
manifest_path = Path(args.manifest).expanduser()
|
|
@@ -985,6 +1100,8 @@ def main() -> None:
|
|
|
985
1100
|
args = parse_args()
|
|
986
1101
|
if args.command == "make-repo-rank-input":
|
|
987
1102
|
make_repo_rank_input(args)
|
|
1103
|
+
elif args.command == "make-repo-scope-input":
|
|
1104
|
+
make_repo_scope_input(args)
|
|
988
1105
|
elif args.command == "bind-repo-scopes":
|
|
989
1106
|
bind_repo_scopes(args)
|
|
990
1107
|
elif args.command == "make-diff-rank-input":
|
|
@@ -28,8 +28,6 @@ def parse_args(description: str) -> argparse.Namespace:
|
|
|
28
28
|
parser = argparse.ArgumentParser(description=description)
|
|
29
29
|
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
30
30
|
|
|
31
|
-
subparsers.add_parser("get-setup-preference")
|
|
32
|
-
|
|
33
31
|
create_workspace = subparsers.add_parser("create-workspace")
|
|
34
32
|
create_workspace.add_argument("--workspace-id", required=True)
|
|
35
33
|
create_workspace.add_argument("--thread-id")
|
|
@@ -37,9 +35,6 @@ def parse_args(description: str) -> argparse.Namespace:
|
|
|
37
35
|
create_workspace.add_argument("--target-title")
|
|
38
36
|
create_workspace.add_argument("--target-summary")
|
|
39
37
|
create_workspace.add_argument("--user-context")
|
|
40
|
-
create_preflight = create_workspace.add_mutually_exclusive_group()
|
|
41
|
-
create_preflight.add_argument("--capability-preflight-json")
|
|
42
|
-
create_preflight.add_argument("--capability-preflight-json-file", type=Path)
|
|
43
38
|
create_workspace.add_argument("--scope")
|
|
44
39
|
create_workspace.add_argument("--mode", choices=MODES, default="standard")
|
|
45
40
|
create_workspace.add_argument("--diff-target-kind", choices=DIFF_TARGET_KINDS)
|
|
@@ -51,14 +46,6 @@ def parse_args(description: str) -> argparse.Namespace:
|
|
|
51
46
|
get_workspace.add_argument("--workspace-id", required=True)
|
|
52
47
|
get_workspace.add_argument("--thread-id")
|
|
53
48
|
|
|
54
|
-
get_latest_workspace = subparsers.add_parser("get-latest-workspace")
|
|
55
|
-
get_latest_workspace.add_argument("--thread-id", required=True)
|
|
56
|
-
|
|
57
|
-
list_workspace_scans = subparsers.add_parser("list-workspace-scans")
|
|
58
|
-
list_workspace_scans.add_argument("--workspace-id", required=True)
|
|
59
|
-
list_workspace_scans.add_argument("--offset", type=non_negative_int, default=0)
|
|
60
|
-
list_workspace_scans.add_argument("--limit", type=workspace_scan_limit, default=20)
|
|
61
|
-
|
|
62
49
|
inspect_target = subparsers.add_parser("inspect-target")
|
|
63
50
|
inspect_target.add_argument("--target-path", required=True)
|
|
64
51
|
|
|
@@ -71,25 +58,6 @@ def parse_args(description: str) -> argparse.Namespace:
|
|
|
71
58
|
inspect_setup.add_argument("--diff-head-revision")
|
|
72
59
|
inspect_setup.add_argument("--diff-content-digest")
|
|
73
60
|
|
|
74
|
-
begin_diff_resolution = subparsers.add_parser("begin-diff-resolution")
|
|
75
|
-
begin_diff_resolution.add_argument("--workspace-id", required=True)
|
|
76
|
-
begin_diff_resolution.add_argument("--request-id", required=True)
|
|
77
|
-
begin_diff_resolution.add_argument("--target-path", required=True)
|
|
78
|
-
begin_diff_resolution.add_argument("--user-context")
|
|
79
|
-
|
|
80
|
-
cancel_diff_resolution = subparsers.add_parser("cancel-diff-resolution")
|
|
81
|
-
cancel_diff_resolution.add_argument("--workspace-id", required=True)
|
|
82
|
-
cancel_diff_resolution.add_argument("--request-id", required=True)
|
|
83
|
-
|
|
84
|
-
set_diff_target = subparsers.add_parser("set-diff-target")
|
|
85
|
-
set_diff_target.add_argument("--workspace-id", required=True)
|
|
86
|
-
set_diff_target.add_argument("--request-id", required=True)
|
|
87
|
-
set_diff_target.add_argument("--target-summary", required=True)
|
|
88
|
-
set_diff_target.add_argument("--diff-target-kind", choices=DIFF_TARGET_KINDS, required=True)
|
|
89
|
-
set_diff_target.add_argument("--diff-base-revision")
|
|
90
|
-
set_diff_target.add_argument("--diff-head-revision")
|
|
91
|
-
set_diff_target.add_argument("--diff-content-digest")
|
|
92
|
-
|
|
93
61
|
save_workspace = subparsers.add_parser("save-workspace")
|
|
94
62
|
save_workspace.add_argument("--workspace-id", required=True)
|
|
95
63
|
save_workspace.add_argument("--target-path", required=True)
|
|
@@ -102,23 +70,12 @@ def parse_args(description: str) -> argparse.Namespace:
|
|
|
102
70
|
save_workspace.add_argument("--diff-head-revision")
|
|
103
71
|
save_workspace.add_argument("--diff-content-digest")
|
|
104
72
|
|
|
105
|
-
set_capability_preflight = subparsers.add_parser("set-capability-preflight")
|
|
106
|
-
set_capability_preflight.add_argument("--workspace-id", required=True)
|
|
107
|
-
set_capability_preflight.add_argument("--checked-target-path", required=True)
|
|
108
|
-
set_capability_preflight.add_argument("--checked-mode", choices=MODES, required=True)
|
|
109
|
-
set_preflight = set_capability_preflight.add_mutually_exclusive_group(required=True)
|
|
110
|
-
set_preflight.add_argument("--capability-preflight-json")
|
|
111
|
-
set_preflight.add_argument("--capability-preflight-json-file", type=Path)
|
|
112
|
-
|
|
113
73
|
start_scan = subparsers.add_parser("start-scan")
|
|
114
74
|
start_scan.add_argument("--workspace-id", required=True)
|
|
115
75
|
start_scan.add_argument("--scan-root")
|
|
116
76
|
start_scan.add_argument("--model")
|
|
117
77
|
start_scan.add_argument("--reasoning-effort")
|
|
118
78
|
|
|
119
|
-
disable_setup_ui = subparsers.add_parser("disable-setup-ui")
|
|
120
|
-
disable_setup_ui.add_argument("--workspace-id", required=True)
|
|
121
|
-
|
|
122
79
|
start_prompt_only_scan = subparsers.add_parser("start-prompt-only-scan")
|
|
123
80
|
start_prompt_only_scan.add_argument("--thread-id", required=True)
|
|
124
81
|
start_prompt_only_scan.add_argument("--target-path", required=True)
|
|
@@ -238,6 +195,7 @@ def parse_args(description: str) -> argparse.Namespace:
|
|
|
238
195
|
update_progress.add_argument("--reportable-findings-count", type=non_negative_int)
|
|
239
196
|
update_progress.add_argument("--deep-review-pass", type=positive_int)
|
|
240
197
|
update_progress.add_argument("--claim-token")
|
|
198
|
+
update_progress.add_argument("--coordinator-generation", type=positive_int)
|
|
241
199
|
update_progress.add_argument("--model")
|
|
242
200
|
update_progress.add_argument("--reasoning-effort")
|
|
243
201
|
|
|
@@ -355,12 +313,5 @@ def positive_int(value: str) -> int:
|
|
|
355
313
|
return parsed
|
|
356
314
|
|
|
357
315
|
|
|
358
|
-
def workspace_scan_limit(value: str) -> int:
|
|
359
|
-
parsed = positive_int(value)
|
|
360
|
-
if parsed > 100:
|
|
361
|
-
raise argparse.ArgumentTypeError("expected an integer between 1 and 100")
|
|
362
|
-
return parsed
|
|
363
|
-
|
|
364
|
-
|
|
365
316
|
if __name__ == "__main__":
|
|
366
317
|
parse_args(__doc__)
|
|
@@ -39,7 +39,6 @@ SQLITE_RETRY_ATTEMPTS = 5
|
|
|
39
39
|
CLAIM_LEASE_SECONDS = 120
|
|
40
40
|
DELIVERED_ACTION_LEASE_SECONDS = 900
|
|
41
41
|
PATCH_PREVIEW_BYTES = 16_000
|
|
42
|
-
PATCH_ARTIFACT_MAX_BYTES = 2 * 1024 * 1024
|
|
43
42
|
FINDINGS_RESULT_LIMIT = 20
|
|
44
43
|
FINDINGS_PAGE_MAX = 20
|
|
45
44
|
FINDING_DETAILS_PREVIEW_BYTES = 16_000
|
|
@@ -57,8 +56,6 @@ FINDING_LOCATION_PATH_BYTES = 2_048
|
|
|
57
56
|
FINDING_LOCATION_ROLE_BYTES = 128
|
|
58
57
|
FINDING_ABSOLUTE_PATH_BYTES = 4_096
|
|
59
58
|
FINDING_LEVEL_BYTES = 128
|
|
60
|
-
MAX_CAPABILITY_PREFLIGHT_INPUT_JSON_BYTES = 160_000
|
|
61
|
-
MAX_CAPABILITY_PREFLIGHT_PERSISTED_JSON_BYTES = 180_000
|
|
62
59
|
GIT_REPOSITORY_ENVIRONMENT = (
|
|
63
60
|
"GIT_ALTERNATE_OBJECT_DIRECTORIES",
|
|
64
61
|
"GIT_CEILING_DIRECTORIES",
|