@openai/codex-security 0.1.16 → 0.1.18

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.
Files changed (125) hide show
  1. package/README.md +228 -18
  2. package/_bundled_plugin/.app.json +1 -1
  3. package/_bundled_plugin/.mcp.json +10 -3
  4. package/_bundled_plugin/mcp/server.mjs.br.part-000 +0 -0
  5. package/_bundled_plugin/mcp/server.mjs.br.part-001 +0 -0
  6. package/_bundled_plugin/references/config-preflight.md +1 -1
  7. package/_bundled_plugin/references/core-scan.md +1 -1
  8. package/_bundled_plugin/references/final-report.md +4 -2
  9. package/_bundled_plugin/references/sarif-adapter.md +2 -0
  10. package/_bundled_plugin/references/scan-artifacts.md +1 -1
  11. package/_bundled_plugin/references/scan-contract.md +18 -7
  12. package/_bundled_plugin/schemas/scan-manifest.schema.json +2 -2
  13. package/_bundled_plugin/schemas/tools/scan-draft.schema.json +23 -0
  14. package/_bundled_plugin/scripts/deep_scan_workbench.py +122 -7
  15. package/_bundled_plugin/scripts/finalize_scan_contract.py +106 -38
  16. package/_bundled_plugin/scripts/generate_in_scope_files.py +20 -0
  17. package/_bundled_plugin/scripts/generate_rank_input.py +23 -7
  18. package/_bundled_plugin/scripts/launch_codex_security_mcp +32 -0
  19. package/_bundled_plugin/scripts/launch_codex_security_mcp.cmd +27 -0
  20. package/_bundled_plugin/scripts/report_projection.py +19 -8
  21. package/_bundled_plugin/scripts/workbench_cli.py +35 -15
  22. package/_bundled_plugin/scripts/workbench_db.py +184 -202
  23. package/_bundled_plugin/scripts/workbench_finding_index.py +101 -0
  24. package/_bundled_plugin/scripts/workbench_progress.py +6 -3
  25. package/_bundled_plugin/scripts/workbench_remediation.py +19 -0
  26. package/_bundled_plugin/scripts/workbench_saved_results.py +1289 -0
  27. package/_bundled_plugin/scripts/workbench_scan_history.py +17 -2
  28. package/_bundled_plugin/scripts/workbench_schema.py +28 -0
  29. package/_bundled_plugin/scripts/workbench_target.py +36 -5
  30. package/_bundled_plugin/scripts/workbench_validation.py +9 -0
  31. package/_bundled_plugin/skills/deep-security-scan/SKILL.md +4 -4
  32. package/_bundled_plugin/skills/fix-finding/SKILL.md +17 -1
  33. package/_bundled_plugin/skills/security-diff-scan/SKILL.md +1 -1
  34. package/_bundled_plugin/skills/security-scan/SKILL.md +1 -1
  35. package/_bundled_plugin/skills/security-scan/references/desktop-scan.md +1 -1
  36. package/dist/api.d.ts +18 -1
  37. package/dist/api.d.ts.map +1 -1
  38. package/dist/api.js +234 -18
  39. package/dist/api.js.map +1 -1
  40. package/dist/cli.d.ts +5 -3
  41. package/dist/cli.d.ts.map +1 -1
  42. package/dist/cli.js +348 -43
  43. package/dist/cli.js.map +1 -1
  44. package/dist/component-plan.d.ts +15 -0
  45. package/dist/component-plan.d.ts.map +1 -0
  46. package/dist/component-plan.js +145 -0
  47. package/dist/component-plan.js.map +1 -0
  48. package/dist/component-scan.d.ts +83 -0
  49. package/dist/component-scan.d.ts.map +1 -0
  50. package/dist/component-scan.js +279 -0
  51. package/dist/component-scan.js.map +1 -0
  52. package/dist/contract.d.ts +8 -2
  53. package/dist/contract.d.ts.map +1 -1
  54. package/dist/contract.js +27 -8
  55. package/dist/contract.js.map +1 -1
  56. package/dist/cost-model.d.ts +20 -0
  57. package/dist/cost-model.d.ts.map +1 -0
  58. package/dist/cost-model.js +86 -0
  59. package/dist/cost-model.js.map +1 -0
  60. package/dist/cost.d.ts +2 -11
  61. package/dist/cost.d.ts.map +1 -1
  62. package/dist/cost.js +15 -98
  63. package/dist/cost.js.map +1 -1
  64. package/dist/custom-validation-prompt.d.ts +4 -0
  65. package/dist/custom-validation-prompt.d.ts.map +1 -0
  66. package/dist/custom-validation-prompt.js +94 -0
  67. package/dist/custom-validation-prompt.js.map +1 -0
  68. package/dist/custom-validation.d.ts +45 -0
  69. package/dist/custom-validation.d.ts.map +1 -0
  70. package/dist/custom-validation.js +292 -0
  71. package/dist/custom-validation.js.map +1 -0
  72. package/dist/errors.d.ts +1 -1
  73. package/dist/errors.d.ts.map +1 -1
  74. package/dist/errors.js +1 -1
  75. package/dist/errors.js.map +1 -1
  76. package/dist/index.d.ts +6 -1
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +2 -0
  79. package/dist/index.js.map +1 -1
  80. package/dist/models.d.ts +1 -1
  81. package/dist/models.d.ts.map +1 -1
  82. package/dist/models.js.map +1 -1
  83. package/dist/multiscan.d.ts +1 -0
  84. package/dist/multiscan.d.ts.map +1 -1
  85. package/dist/multiscan.js +53 -5
  86. package/dist/multiscan.js.map +1 -1
  87. package/dist/patch-tui.js +1 -1
  88. package/dist/patch-tui.js.map +1 -1
  89. package/dist/publication.d.ts.map +1 -1
  90. package/dist/publication.js +3 -4
  91. package/dist/publication.js.map +1 -1
  92. package/dist/runtime.d.ts +4 -2
  93. package/dist/runtime.d.ts.map +1 -1
  94. package/dist/runtime.js +109 -38
  95. package/dist/runtime.js.map +1 -1
  96. package/dist/scan-comparison.d.ts +12 -5
  97. package/dist/scan-comparison.d.ts.map +1 -1
  98. package/dist/scan-comparison.js +72 -28
  99. package/dist/scan-comparison.js.map +1 -1
  100. package/dist/scan-dashboard.d.ts +9 -2
  101. package/dist/scan-dashboard.d.ts.map +1 -1
  102. package/dist/scan-dashboard.js +198 -3
  103. package/dist/scan-dashboard.js.map +1 -1
  104. package/dist/scan-logs.d.ts.map +1 -1
  105. package/dist/scan-logs.js +5 -21
  106. package/dist/scan-logs.js.map +1 -1
  107. package/dist/scan-sessions.d.ts +4 -0
  108. package/dist/scan-sessions.d.ts.map +1 -0
  109. package/dist/scan-sessions.js +35 -0
  110. package/dist/scan-sessions.js.map +1 -0
  111. package/dist/targets.d.ts.map +1 -1
  112. package/dist/targets.js +16 -1
  113. package/dist/targets.js.map +1 -1
  114. package/dist/version.d.ts.map +1 -1
  115. package/dist/version.js +2 -20
  116. package/dist/version.js.map +1 -1
  117. package/dist/windows-path.d.ts +3 -0
  118. package/dist/windows-path.d.ts.map +1 -0
  119. package/dist/windows-path.js +16 -0
  120. package/dist/windows-path.js.map +1 -0
  121. package/dist/worker-progress.d.ts +1 -0
  122. package/dist/worker-progress.d.ts.map +1 -1
  123. package/dist/worker-progress.js +12 -0
  124. package/dist/worker-progress.js.map +1 -1
  125. package/package.json +8 -2
@@ -0,0 +1,101 @@
1
+ """Persist normalized scan findings and their occurrences."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import json
7
+ import sqlite3
8
+ from typing import Any
9
+
10
+
11
+ def index_findings(
12
+ connection: sqlite3.Connection,
13
+ scan_id: str,
14
+ document: dict[str, Any],
15
+ timestamp: str,
16
+ ) -> None:
17
+ findings = document.get("findings")
18
+ if not isinstance(findings, list):
19
+ raise SystemExit("findings.json must contain a findings array.")
20
+ for finding in findings:
21
+ if not isinstance(finding, dict):
22
+ raise SystemExit("findings.json entries must be objects.")
23
+ identity = finding["identity"]
24
+ fingerprints = finding["fingerprints"]
25
+ severity = finding["severity"]
26
+ confidence = finding["confidence"]
27
+ connection.execute(
28
+ """
29
+ INSERT INTO findings (
30
+ id, fingerprint, rule_id, identity_anchor, identity_instance, created_at, updated_at
31
+ ) VALUES (?, ?, ?, ?, ?, ?, ?)
32
+ ON CONFLICT(id) DO UPDATE SET
33
+ fingerprint = excluded.fingerprint,
34
+ rule_id = excluded.rule_id,
35
+ identity_anchor = excluded.identity_anchor,
36
+ identity_instance = excluded.identity_instance,
37
+ updated_at = excluded.updated_at
38
+ """,
39
+ (
40
+ finding["findingId"],
41
+ fingerprints["primary"],
42
+ finding["ruleId"],
43
+ identity["anchor"],
44
+ identity.get("instance"),
45
+ timestamp,
46
+ timestamp,
47
+ ),
48
+ )
49
+ connection.execute(
50
+ """
51
+ INSERT INTO finding_occurrences (
52
+ id, finding_id, scan_id, title, summary, severity, confidence, remediation,
53
+ details_json, created_at
54
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
55
+ ON CONFLICT(id) DO UPDATE SET
56
+ finding_id = excluded.finding_id,
57
+ scan_id = excluded.scan_id,
58
+ title = excluded.title,
59
+ summary = excluded.summary,
60
+ severity = excluded.severity,
61
+ confidence = excluded.confidence,
62
+ remediation = excluded.remediation,
63
+ details_json = excluded.details_json
64
+ """,
65
+ (
66
+ finding["occurrenceId"],
67
+ finding["findingId"],
68
+ scan_id,
69
+ finding["title"],
70
+ finding["summary"],
71
+ severity["level"],
72
+ confidence["level"],
73
+ finding["remediation"],
74
+ json.dumps(finding, allow_nan=False, sort_keys=True),
75
+ timestamp,
76
+ ),
77
+ )
78
+ connection.execute(
79
+ "DELETE FROM finding_locations WHERE occurrence_id = ?",
80
+ (finding["occurrenceId"],),
81
+ )
82
+ for index, location in enumerate(finding["locations"]):
83
+ connection.execute(
84
+ """
85
+ INSERT INTO finding_locations (
86
+ occurrence_id, relative_path, start_line, end_line, role, sort_order
87
+ ) VALUES (?, ?, ?, ?, ?, ?)
88
+ """,
89
+ (
90
+ finding["occurrenceId"],
91
+ location["path"],
92
+ location["startLine"],
93
+ location.get("endLine", location["startLine"]),
94
+ location.get("role"),
95
+ index,
96
+ ),
97
+ )
98
+
99
+
100
+ if __name__ == "__main__":
101
+ argparse.ArgumentParser(description=__doc__).parse_args()
@@ -11,7 +11,7 @@ sys.path.insert(0, str(Path(__file__).resolve().parent))
11
11
  from deep_scan_workbench import require_current_coordinator
12
12
  from workbench.handoff import require_current_continuation
13
13
  from workbench_constants import PHASES
14
- from workbench_validation import optional_text, require_uuid, user_text
14
+ from workbench_validation import optional_text, require_uuid, user_context_argument
15
15
 
16
16
  MAX_PREFLIGHT_ISSUES = 32
17
17
 
@@ -83,7 +83,7 @@ def update_context(
83
83
  scan_context: Callable[[sqlite3.Connection, str], dict[str, Any]],
84
84
  ) -> dict[str, Any]:
85
85
  scan_id = require_uuid(args.scan_id, "scan-id")
86
- context = user_text(args.user_context)
86
+ context = user_context_argument(args)
87
87
  connection.execute("BEGIN IMMEDIATE")
88
88
  try:
89
89
  scan = require_scan(connection, scan_id)
@@ -164,7 +164,10 @@ def update_progress(
164
164
  scan_id = require_uuid(args.scan_id, "scan-id")
165
165
  model = optional_text(args.model, maximum=200)
166
166
  reasoning_effort = optional_text(args.reasoning_effort, maximum=32)
167
- serialized_preflight_issues = preflight_issues_json(args.preflight_issues_json)
167
+ preflight_issues = (
168
+ sys.stdin.read() if args.preflight_issues_json_stdin else args.preflight_issues_json
169
+ )
170
+ serialized_preflight_issues = preflight_issues_json(preflight_issues)
168
171
  connection.execute("BEGIN IMMEDIATE")
169
172
  try:
170
173
  timestamp = now()
@@ -14,6 +14,25 @@ sys.path.insert(0, str(Path(__file__).resolve().parent))
14
14
  from workbench_constants import CLAIM_LEASE_SECONDS, DELIVERED_ACTION_LEASE_SECONDS
15
15
  from workbench_validation import require_occurrence, require_uuid
16
16
 
17
+ COMMANDS = {
18
+ "request-finding-remediation",
19
+ "request-finding-remediation-action",
20
+ "claim-finding-remediation-resend",
21
+ "mark-finding-remediation-delivered",
22
+ "release-finding-remediation-claim",
23
+ "cancel-finding-remediation-request",
24
+ "set-finding-remediation",
25
+ }
26
+ SCAN_STATUS_ERROR = "Remediation is available only for successfully completed scans."
27
+
28
+
29
+ def require_available(connection: sqlite3.Connection, args: Any, require_scan: Any) -> None:
30
+ if args.command not in COMMANDS:
31
+ return
32
+ occurrence = require_occurrence(connection, args.occurrence_id)
33
+ if require_scan(connection, occurrence["scan_id"])["status"] != "complete":
34
+ raise SystemExit(SCAN_STATUS_ERROR)
35
+
17
36
 
18
37
  def remediation_claim_is_active(remediation: sqlite3.Row) -> bool:
19
38
  if remediation["pending_action_claim_token"] is None: