@openai/codex-security 0.1.23 → 0.1.24
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 +24 -5
- package/_bundled_plugin/.mcp.json +1 -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/references/scan-contract.md +10 -0
- package/_bundled_plugin/scripts/deep_scan_workbench.py +6 -1
- package/_bundled_plugin/scripts/finalize_scan_contract.py +27 -78
- package/_bundled_plugin/scripts/generate_in_scope_files.py +2 -8
- package/_bundled_plugin/scripts/generate_rank_input.py +1 -5
- package/_bundled_plugin/scripts/rank_preview.py +1 -0
- package/_bundled_plugin/scripts/report_projection.py +8 -14
- package/_bundled_plugin/scripts/validate_scan_contract.py +1 -3
- package/_bundled_plugin/scripts/windows_scan_local_files.py +5 -15
- package/_bundled_plugin/scripts/workbench_cli.py +6 -0
- package/_bundled_plugin/scripts/workbench_dashboard.py +41 -18
- package/_bundled_plugin/scripts/workbench_db.py +83 -539
- package/_bundled_plugin/scripts/workbench_finding_workflows.py +31 -13
- package/_bundled_plugin/scripts/workbench_findings.py +8 -3
- package/_bundled_plugin/scripts/workbench_native_indexes.py +1 -2
- package/_bundled_plugin/scripts/workbench_publication.py +520 -0
- package/_bundled_plugin/scripts/workbench_remediation.py +37 -0
- package/_bundled_plugin/scripts/workbench_saved_results.py +298 -90
- package/_bundled_plugin/scripts/workbench_scan_history.py +1 -2
- package/_bundled_plugin/scripts/workbench_scan_usage.py +9 -33
- package/_bundled_plugin/scripts/workbench_schema.py +34 -21
- package/_bundled_plugin/scripts/workbench_target.py +10 -5
- package/_bundled_plugin/scripts/workbench_validation.py +1 -5
- package/_bundled_plugin/skills/assess-patch-risk/SKILL.md +1 -5
- package/_bundled_plugin/skills/attack-path-analysis/references/severity-policy.md +6 -1
- package/dist/api.d.ts +3 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +20 -0
- package/dist/api.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +34 -4
- package/dist/cli.js.map +1 -1
- package/dist/deep-progress.d.ts +21 -0
- package/dist/deep-progress.d.ts.map +1 -0
- package/dist/deep-progress.js +108 -0
- package/dist/deep-progress.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +6 -1
- package/dist/runtime.js.map +1 -1
- package/dist/scan-activity.d.ts.map +1 -1
- package/dist/scan-activity.js +12 -2
- package/dist/scan-activity.js.map +1 -1
- package/dist/server/index.js +2 -28
- package/dist/server/index.js.map +1 -1
- package/dist/server/serve.d.ts +2 -0
- package/dist/server/serve.d.ts.map +1 -0
- package/dist/server/serve.js +28 -0
- package/dist/server/serve.js.map +1 -0
- package/package.json +3 -3
|
@@ -842,11 +842,21 @@ def migrate_finding_workflow_review_columns(connection: sqlite3.Connection) -> N
|
|
|
842
842
|
model = ?, effort = ?, settings_digest = ?, prompt_digest = ?, contract_digest = ?
|
|
843
843
|
WHERE workflow_id = ? AND review_key = ?""",
|
|
844
844
|
(
|
|
845
|
-
binding["version"],
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
845
|
+
binding["version"],
|
|
846
|
+
binding["codexVersion"],
|
|
847
|
+
source["repository"],
|
|
848
|
+
source["revision"],
|
|
849
|
+
source["refsDigest"],
|
|
850
|
+
source["content"],
|
|
851
|
+
scope.get("repositoryId"),
|
|
852
|
+
scope.get("allRepositories"),
|
|
853
|
+
binding["model"],
|
|
854
|
+
binding["effort"],
|
|
855
|
+
binding.get("settingsDigest"),
|
|
856
|
+
binding["promptDigest"],
|
|
857
|
+
binding["contractDigest"],
|
|
858
|
+
row["workflow_id"],
|
|
859
|
+
row["review_key"],
|
|
850
860
|
),
|
|
851
861
|
)
|
|
852
862
|
|
|
@@ -867,13 +877,22 @@ def migrate_finding_workflow_columns(connection: sqlite3.Connection) -> None:
|
|
|
867
877
|
scan_status = ?, scan_error = ?, publish_status = ?, publish_error = ?,
|
|
868
878
|
dedupe_status = ?, dedupe_error = ?, results_json = ? WHERE id = ?""",
|
|
869
879
|
(
|
|
870
|
-
state.get("repositoryPath"),
|
|
871
|
-
state.get("
|
|
872
|
-
state.get("
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
880
|
+
state.get("repositoryPath"),
|
|
881
|
+
state.get("scanRequestDigest"),
|
|
882
|
+
state.get("scanId"),
|
|
883
|
+
state.get("scanDir"),
|
|
884
|
+
state.get("artifactDigest"),
|
|
885
|
+
state.get("destination"),
|
|
886
|
+
scope.get("repositoryId"),
|
|
887
|
+
scope.get("allRepositories"),
|
|
888
|
+
stages["scan"]["status"],
|
|
889
|
+
stages["scan"].get("error"),
|
|
890
|
+
stages["publish"]["status"],
|
|
891
|
+
stages["publish"].get("error"),
|
|
892
|
+
stages["dedupe"]["status"],
|
|
893
|
+
stages["dedupe"].get("error"),
|
|
894
|
+
json.dumps(results, allow_nan=False),
|
|
895
|
+
row["id"],
|
|
877
896
|
),
|
|
878
897
|
)
|
|
879
898
|
|
|
@@ -979,12 +998,8 @@ def apply_migrations(
|
|
|
979
998
|
def normalize_pre_release_execution_profile_migrations(
|
|
980
999
|
connection: sqlite3.Connection, timestamp: str
|
|
981
1000
|
) -> None:
|
|
982
|
-
scan_columns = {
|
|
983
|
-
|
|
984
|
-
}
|
|
985
|
-
workspace_columns = {
|
|
986
|
-
row["name"] for row in connection.execute("PRAGMA table_info(workspaces)")
|
|
987
|
-
}
|
|
1001
|
+
scan_columns = {row["name"] for row in connection.execute("PRAGMA table_info(scans)")}
|
|
1002
|
+
workspace_columns = {row["name"] for row in connection.execute("PRAGMA table_info(workspaces)")}
|
|
988
1003
|
legacy_columns = {"execution_model", "reasoning_effort"}
|
|
989
1004
|
renamed_columns = {
|
|
990
1005
|
"legacy_execution_model",
|
|
@@ -1332,9 +1347,7 @@ def normalize_mirror_lineage_migrations(connection: sqlite3.Connection) -> None:
|
|
|
1332
1347
|
if not any(migrations.get(version) == name for version, name in mirror_names.items()):
|
|
1333
1348
|
return
|
|
1334
1349
|
if migrations != mirror_names:
|
|
1335
|
-
raise SystemExit(
|
|
1336
|
-
"The Codex Security database has an unsupported mirror migration history."
|
|
1337
|
-
)
|
|
1350
|
+
raise SystemExit("The Codex Security database has an unsupported mirror migration history.")
|
|
1338
1351
|
for old_version, new_version in ((30, 32), (29, 31)):
|
|
1339
1352
|
connection.execute(
|
|
1340
1353
|
"UPDATE schema_migrations SET version = ? WHERE version = ? AND name = ?",
|
|
@@ -424,7 +424,10 @@ def source_directory_snapshot_paths(target: Path) -> list[Path]:
|
|
|
424
424
|
paths.append(path)
|
|
425
425
|
metadata = path.lstat()
|
|
426
426
|
# Name-surrogate reparse points include Windows directory junctions.
|
|
427
|
-
if
|
|
427
|
+
if (
|
|
428
|
+
stat.S_ISDIR(metadata.st_mode)
|
|
429
|
+
and not getattr(metadata, "st_reparse_tag", 0) & 0x20000000
|
|
430
|
+
):
|
|
428
431
|
pending.append(path)
|
|
429
432
|
return sorted(paths)
|
|
430
433
|
|
|
@@ -438,7 +441,11 @@ def directory_content_digest(
|
|
|
438
441
|
excluded_relative.append(path.relative_to(target))
|
|
439
442
|
except ValueError:
|
|
440
443
|
continue
|
|
441
|
-
paths =
|
|
444
|
+
paths = (
|
|
445
|
+
source_directory_snapshot_paths(target)
|
|
446
|
+
if include_ignored
|
|
447
|
+
else git_directory_snapshot_paths(target)
|
|
448
|
+
)
|
|
442
449
|
if paths is None:
|
|
443
450
|
paths = sorted(target.rglob("*"))
|
|
444
451
|
digest = hashlib.sha256()
|
|
@@ -560,9 +567,7 @@ def copy_git_worktree_files(source: Path, destination: Path, excluded: tuple[Pat
|
|
|
560
567
|
if nested_git_dir is None:
|
|
561
568
|
raise SystemExit(f"Could not inspect nested Git working tree: {relative}")
|
|
562
569
|
copy_git_worktree_files(source_path, destination_path, excluded)
|
|
563
|
-
(destination_path / ".git").write_text(
|
|
564
|
-
f"gitdir: {nested_git_dir}\n", encoding="utf-8"
|
|
565
|
-
)
|
|
570
|
+
(destination_path / ".git").write_text(f"gitdir: {nested_git_dir}\n", encoding="utf-8")
|
|
566
571
|
else:
|
|
567
572
|
raise SystemExit(f"Unsupported Git working-tree file type: {relative}")
|
|
568
573
|
copied_target = destination if pathspec == "." else destination / pathspec
|
|
@@ -58,11 +58,7 @@ def user_text(value: str | None) -> str | None:
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
def user_context_argument(args: argparse.Namespace) -> str | None:
|
|
61
|
-
value = (
|
|
62
|
-
sys.stdin.read()
|
|
63
|
-
if getattr(args, "user_context_stdin", False)
|
|
64
|
-
else args.user_context
|
|
65
|
-
)
|
|
61
|
+
value = sys.stdin.read() if getattr(args, "user_context_stdin", False) else args.user_context
|
|
66
62
|
return user_text(value)
|
|
67
63
|
|
|
68
64
|
|
|
@@ -60,11 +60,7 @@ Return both a concise Markdown report and a JSON object conforming to [`../../sc
|
|
|
60
60
|
7. top risk drivers, protective factors, and status-quo risk; and
|
|
61
61
|
8. unknowns plus the bounded evidence plan when held.
|
|
62
62
|
|
|
63
|
-
This skill lives at `<plugin-root>/skills/assess-patch-risk/SKILL.md`, so
|
|
64
|
-
`<plugin-root>` is two directories up. Resolve `<python_command>` to the
|
|
65
|
-
configured Python interpreter (`"$PYTHON"` in POSIX shells or
|
|
66
|
-
`& "$env:PYTHON"` in PowerShell), otherwise use `python` on Windows and
|
|
67
|
-
`python3` on Unix-like hosts.
|
|
63
|
+
This skill lives at `<plugin-root>/skills/assess-patch-risk/SKILL.md`, so `<plugin-root>` is two directories up. Resolve `<python_command>` to the configured Python interpreter (`"$PYTHON"` in POSIX shells or `& "$env:PYTHON"` in PowerShell), otherwise use `python` on Windows and `python3` on Unix-like hosts.
|
|
68
64
|
|
|
69
65
|
Before returning the result, validate the JSON from any working directory with:
|
|
70
66
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Use this guidance after attack-path facts, reachability, and counterevidence are established.
|
|
4
4
|
|
|
5
5
|
-- Considerations for severity / criticality re-rating --
|
|
6
|
+
|
|
6
7
|
- For `high` and above, the impact must be materially security-relevant (for example: account takeover, auth bypass, meaningful privilege escalation, significant sensitive data exposure/exfiltration, credible RCE, or similarly severe compromise), not simply a bug or strange behavior
|
|
7
8
|
- For a finding to remain `high` or `critical`, the exploitation path and impact should be clear enough that a professional security reviewer would not need a long speculative argument to justify it.
|
|
8
9
|
- Do **not** treat ordinary code bugs as high/critical security issues just because they are bugs or because the scanner labeled them that way.
|
|
@@ -13,6 +14,7 @@ Use this guidance after attack-path facts, reachability, and counterevidence are
|
|
|
13
14
|
- If it is actually provable that there is no bug at all (the description is entirely wrong or made up and you actually got that real proof that it is so), then label it as `ignore` for criticality to mark a false-positive.
|
|
14
15
|
|
|
15
16
|
Non-exhaustive examples of vulnerabilities that often support `critical` when evidenced in code and context:
|
|
17
|
+
|
|
16
18
|
- Credible RCE or arbitrary code execution (command injection, LFI exec, trivial memory corruption exploits, etc.). Requires actual proof that attacker input causes this from an in-scope attack surface.
|
|
17
19
|
- Real XSS with meaningful proven impact (for example session/token theft, account compromise, privileged action execution, etc)
|
|
18
20
|
- Account takeover or strong authentication bypass, especially if it is 0-click
|
|
@@ -27,6 +29,7 @@ Non-exhaustive examples of vulnerabilities that often support `critical` when ev
|
|
|
27
29
|
- etc, other bugs not listed which follow this level of critical severity and impact; with actual proof that these bugs are reachable from in-scope attack-surface.
|
|
28
30
|
|
|
29
31
|
Non-exhaustive examples of vulnerabilities that often support `high` when evidenced in code and context:
|
|
32
|
+
|
|
30
33
|
- Server Side Request Forgery where there is actual proof that (1) an attacker can control the url being requested (bypassing protections around that) from in-scope attack-surface and (2) there are likely other local/lan/cloud services which can be reached to show actual impact. Be careful with reporting webhooks unless there is clear proof that it is dangerous, but do not treat a product-intended webhook/download/callback feature or optional operator allow/deny list as suppression evidence when attacker-controlled destinations can still reach internal, metadata, file-backed, redirect, or side-effecting targets.
|
|
31
34
|
- Exploitable memory corruption with clear, major impact or ease of exploitation
|
|
32
35
|
- Arbitrary file read that exposes less-sensitive user data or source code (if you have actual proof it reveals env secrets, then it is critical)
|
|
@@ -42,6 +45,7 @@ Non-exhaustive examples of vulnerabilities that often support `high` when eviden
|
|
|
42
45
|
- Deserialization, SSTI, plugin abuse, macro / template abuse, or interpreter abuse where dangerous primitives are clearly reachable and impactful, but code execution or compromise is not fully proven to the standard needed for critical.
|
|
43
46
|
|
|
44
47
|
Strong factors that often push a plausible `high` up to `critical`:
|
|
48
|
+
|
|
45
49
|
- Unauthenticated or near-unauthenticated reachability from the internet or other broad in-scope surfaces.
|
|
46
50
|
- 0-click or extremely low-friction exploitation.
|
|
47
51
|
- Cross-tenant / cross-boundary impact rather than same-user or same-tenant impact.
|
|
@@ -50,6 +54,7 @@ Strong factors that often push a plausible `high` up to `critical`:
|
|
|
50
54
|
- Clear proof of code execution, full account takeover, or crown-jewel secret access rather than only a plausible path.
|
|
51
55
|
|
|
52
56
|
Examples that usually should not remain `high`/`critical` without very strong proof of it leading to the class of vulnerabilities above:
|
|
57
|
+
|
|
53
58
|
- Generic correctness/reliability bugs
|
|
54
59
|
- Strange edge cases with unclear attacker value
|
|
55
60
|
- Low-impact information leaks
|
|
@@ -70,6 +75,7 @@ Examples that usually should not remain `high`/`critical` without very strong pr
|
|
|
70
75
|
- Arbitrary file read limited to public files, low-sensitivity files, or source fragments with no realistic security consequence.
|
|
71
76
|
|
|
72
77
|
High/Critical acceptance checklist (all should be true, unless the threat model strongly justifies an exception):
|
|
78
|
+
|
|
73
79
|
- In-scope component
|
|
74
80
|
- Realistic attacker
|
|
75
81
|
- Reasonable in-scope attack surface
|
|
@@ -106,7 +112,6 @@ Final policy-adjustment guidance:
|
|
|
106
112
|
- `none` does not increase likelihood based on exposure
|
|
107
113
|
- Then decide reportability using the existing facts:
|
|
108
114
|
- if repository evidence does not establish a realistic lower-privileged in-scope attacker path, set `ignore`
|
|
109
|
-
- if the path is internal-only, developer-only, operator-only, localhost-only, privileged-local, or otherwise not meaningfully reportable in context, set `ignore`
|
|
110
115
|
|
|
111
116
|
Do not suppress solely because the surface is private or internal when repository evidence still shows a meaningful authorization, trust-boundary, identity, or security-control regression in a real product or production-service workflow. In those cases, internal exposure should usually reduce likelihood or confidence rather than force `ignore`.
|
|
112
117
|
|
package/dist/api.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { CodexLoginHandle, type AccountStatus } from "./auth.js";
|
|
3
3
|
import { type CodexSecurityConfig, type JsonObject } from "./config.js";
|
|
4
4
|
import { type ScanCost, type ScanSessionEvent } from "./cost.js";
|
|
5
|
+
import { type DeepScanProgress } from "./deep-progress.js";
|
|
5
6
|
import { ScanResult } from "./result.js";
|
|
6
7
|
import type { SeverityLevel } from "./models.js";
|
|
7
8
|
import { type ScanActivity } from "./scan-activity.js";
|
|
@@ -43,6 +44,7 @@ export interface ScanOptions extends DeepScanOptions {
|
|
|
43
44
|
onActivity?: (activity: ScanActivity) => void;
|
|
44
45
|
onSessionEvent?: (event: ScanSessionEvent) => void;
|
|
45
46
|
onProgress?: (progress: ScanProgress) => void;
|
|
47
|
+
onDeepProgress?: (progress: DeepScanProgress) => void;
|
|
46
48
|
onWorkerStatus?: (status: ScanWorkerStatus) => void;
|
|
47
49
|
onWarning?: (warning: string, details?: ScanWarningDetails) => void;
|
|
48
50
|
onObserverError?: (observer: ScanObserverName, error: unknown) => void;
|
|
@@ -83,7 +85,7 @@ export interface ScanReconnectDetails {
|
|
|
83
85
|
export interface ScanWarningDetails {
|
|
84
86
|
kind: "target_changed";
|
|
85
87
|
}
|
|
86
|
-
type ScanObserverName = "onAuthentication" | "onCost" | "onOutputArchived" | "onOutputDirReady" | "onScanStarted" | "onTrustedAccessStatus" | "onReconnect" | "onActivity" | "onSessionEvent" | "onProgress" | "onWorkerStatus" | "onWarning";
|
|
88
|
+
type ScanObserverName = "onAuthentication" | "onCost" | "onOutputArchived" | "onOutputDirReady" | "onScanStarted" | "onTrustedAccessStatus" | "onReconnect" | "onActivity" | "onSessionEvent" | "onProgress" | "onDeepProgress" | "onWorkerStatus" | "onWarning";
|
|
87
89
|
export interface ScanPreflight extends DeepScanOptions {
|
|
88
90
|
repository: string;
|
|
89
91
|
target: NormalizedTarget;
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AAkCA,OAAO,EAEL,gBAAgB,EAGhB,KAAK,aAAa,EACnB,MAAM,WAAW,CAAC;AAMnB,OAAO,EAOL,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAEhB,MAAM,aAAa,CAAC;AACrB,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACtB,MAAM,WAAW,CAAC;AA+
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AAkCA,OAAO,EAEL,gBAAgB,EAGhB,KAAK,aAAa,EACnB,MAAM,WAAW,CAAC;AAMnB,OAAO,EAOL,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAEhB,MAAM,aAAa,CAAC;AACrB,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AA+B5B,OAAO,EACL,UAAU,EAIX,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAA2B,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAMhF,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAWL,iBAAiB,EAiBjB,KAAK,kBAAk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GAAG,SAAS,CAcpB"}
|
package/dist/api.js
CHANGED
|
@@ -10,6 +10,7 @@ import { accountStatus, CodexLoginHandle, loginApiKey as persistApiKey, logout a
|
|
|
10
10
|
import { jsonForPrompt, pluginPythonCommand, shellEnvironmentReference, } from "./codex-prompt.js";
|
|
11
11
|
import { EXTERNAL_CODEX_PROVIDERS, isExternalModelProvider, mergedCodexConfig, scanApprovalPolicy, scanModelConfiguration, scanModelProvider, writeCodexConfig, } from "./config.js";
|
|
12
12
|
import { estimateScanCost, ScanCostTracker, sumTokenUsage, } from "./cost.js";
|
|
13
|
+
import { DeepScanProgressTracker, } from "./deep-progress.js";
|
|
13
14
|
import { loadContract, readScanFile, requireScanFile, } from "./contract.js";
|
|
14
15
|
import { runCustomValidation, writeCustomValidationStatus, } from "./custom-validation.js";
|
|
15
16
|
import { customDiscoveryPrompt, customValidationConfig, } from "./custom-validation-prompt.js";
|
|
@@ -298,6 +299,7 @@ export class CodexSecurity {
|
|
|
298
299
|
let targetPathsFile = null;
|
|
299
300
|
let knowledgeBase = null;
|
|
300
301
|
let costTracker = null;
|
|
302
|
+
let deepProgressTracker = null;
|
|
301
303
|
let releaseCredentialHome = null;
|
|
302
304
|
let scanFailure = false;
|
|
303
305
|
let customValidationComplete = false;
|
|
@@ -526,6 +528,23 @@ export class CodexSecurity {
|
|
|
526
528
|
});
|
|
527
529
|
}
|
|
528
530
|
activeScan = { id: scanId, options: workbenchOptions };
|
|
531
|
+
if (mode === "deep" && options.onDeepProgress !== undefined) {
|
|
532
|
+
let progressWarningReported = false;
|
|
533
|
+
deepProgressTracker = new DeepScanProgressTracker({
|
|
534
|
+
read: (progressSignal) => workbench({
|
|
535
|
+
...workbenchOptions,
|
|
536
|
+
signal: AbortSignal.any([signal, progressSignal]),
|
|
537
|
+
}, ["get-scan", "--scan-id", scanId]),
|
|
538
|
+
onProgress: (progress) => notifyObserver("onDeepProgress", options.onDeepProgress, options.onObserverError, progress),
|
|
539
|
+
onError: (error) => {
|
|
540
|
+
if (progressWarningReported)
|
|
541
|
+
return;
|
|
542
|
+
progressWarningReported = true;
|
|
543
|
+
notifyObserver("onWarning", options.onWarning, options.onObserverError, `Could not track Deep Scan progress: ${errorMessage(error)}`);
|
|
544
|
+
},
|
|
545
|
+
});
|
|
546
|
+
deepProgressTracker.start();
|
|
547
|
+
}
|
|
529
548
|
if (options.validationPrompt !== undefined) {
|
|
530
549
|
await writeCustomValidationStatus(scanDir, { scanId, status: "pending" }, signal);
|
|
531
550
|
}
|
|
@@ -961,6 +980,7 @@ export class CodexSecurity {
|
|
|
961
980
|
throw failure;
|
|
962
981
|
}
|
|
963
982
|
finally {
|
|
983
|
+
deepProgressTracker?.stop();
|
|
964
984
|
// Removing the temporary scan inputs is best effort. A throw here would replace the
|
|
965
985
|
// outcome the try and catch blocks already produced, so these failures are reported
|
|
966
986
|
// as warnings: a scan that failed has to say why it failed, not why its temporary
|