@openai/codex-security 0.8.0 → 0.8.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 +8 -8
- package/_bundled_plugin/.codex-plugin/plugin.json +1 -0
- package/_bundled_plugin/mcp/helpers.mjs.br.part-000 +0 -0
- package/_bundled_plugin/mcp/helpers.mjs.br.part-001 +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.part-000 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-001 +0 -0
- package/_bundled_plugin/mcp/server.mjs.br.part-002 +0 -0
- package/_bundled_plugin/references/scan-artifacts.md +1 -1
- package/_bundled_plugin/scripts/finalize_scan_contract.py +37 -1
- package/_bundled_plugin/scripts/servicenow_avit.py +107 -0
- package/_bundled_plugin/scripts/workbench_scan_start.py +4 -1
- package/_bundled_plugin/skills/publish-findings/SKILL.md +5 -3
- package/_bundled_plugin/skills/security-scan/SKILL.md +1 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +33 -12
- package/dist/api.js.map +1 -1
- package/dist/artifact-export.d.ts +12 -3
- package/dist/artifact-export.d.ts.map +1 -1
- package/dist/artifact-export.js +30 -10
- package/dist/artifact-export.js.map +1 -1
- package/dist/cli-help.d.ts.map +1 -1
- package/dist/cli-help.js +1 -0
- package/dist/cli-help.js.map +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +45 -42
- package/dist/cli.js.map +1 -1
- package/dist/contract.d.ts +1 -0
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +12 -8
- package/dist/contract.js.map +1 -1
- package/dist/custom-validation-prompt.d.ts.map +1 -1
- package/dist/custom-validation-prompt.js +12 -4
- package/dist/custom-validation-prompt.js.map +1 -1
- package/dist/external-findings-local.d.ts.map +1 -1
- package/dist/external-findings-local.js +19 -0
- package/dist/external-findings-local.js.map +1 -1
- package/dist/external-findings-publish.d.ts.map +1 -1
- package/dist/external-findings-publish.js +5 -4
- package/dist/external-findings-publish.js.map +1 -1
- package/dist/github-advisories.d.ts.map +1 -1
- package/dist/github-advisories.js +5 -5
- package/dist/github-advisories.js.map +1 -1
- package/dist/github-dependabot-findings.d.ts +6 -0
- package/dist/github-dependabot-findings.d.ts.map +1 -0
- package/dist/github-dependabot-findings.js +247 -0
- package/dist/github-dependabot-findings.js.map +1 -0
- package/dist/github-findings.d.ts.map +1 -1
- package/dist/github-findings.js +11 -4
- package/dist/github-findings.js.map +1 -1
- package/dist/github-identifiers.d.ts +4 -0
- package/dist/github-identifiers.d.ts.map +1 -0
- package/dist/github-identifiers.js +9 -0
- package/dist/github-identifiers.js.map +1 -0
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +4 -6
- package/dist/github.js.map +1 -1
- package/dist/hosted-scan.d.ts.map +1 -1
- package/dist/hosted-scan.js +13 -5
- package/dist/hosted-scan.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/scanner-import.d.ts +0 -1
- package/dist/scanner-import.d.ts.map +1 -1
- package/dist/scanner-import.js +9 -9
- package/dist/scanner-import.js.map +1 -1
- package/docs/cli.md +39 -7
- package/docs/hosted-scans.md +14 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -679,13 +679,13 @@ repository package vulnerabilities (SCA) only; it does not add SAST, CSPM or
|
|
|
679
679
|
complete code-to-cloud coverage. Both formats support gzip. The acquisition path
|
|
680
680
|
still needs validation with an authorized Wiz tenant.
|
|
681
681
|
|
|
682
|
-
For GitHub, save complete JSON from
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
to GitHub.
|
|
682
|
+
For GitHub code scanning and GHSA advisories, save complete JSON from
|
|
683
|
+
`import github` or `import github-advisories`, respectively. **GHSA import
|
|
684
|
+
does not establish an installed dependency or applicability to the repository.**
|
|
685
|
+
For Dependabot, save the native REST alert records from one repository using the
|
|
686
|
+
[Dependabot export guide](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/github-dependabot.md).
|
|
687
|
+
The GitHub file reader accepts all three families. Secret-scanning alerts and
|
|
688
|
+
writeback to GitHub are outside its scope.
|
|
689
689
|
|
|
690
690
|
Use `publish findings FILE --to local --repository PATH --provider wiz
|
|
691
691
|
--source-key KEY` to store the same vendor evidence in the local workbench SQLite
|
|
@@ -701,7 +701,7 @@ Use `--provider endor` with native Endor Finding JSON; existing endorctl SARIF i
|
|
|
701
701
|
accepted as a lossy compatibility format. See
|
|
702
702
|
[Endor imports](docs/cli.md#import-endor-labs-findings).
|
|
703
703
|
|
|
704
|
-
For saved GitHub code-scanning alerts
|
|
704
|
+
For saved GitHub code-scanning alerts, GHSA advisories, or Dependabot alerts, use
|
|
705
705
|
`--provider github` with a separate stable source key for each finding family.
|
|
706
706
|
See [local imports](docs/cli.md#import-vendor-findings-locally).
|
|
707
707
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -11,7 +11,7 @@ Follow `artifact-storage.md` for storage selection, file authoring and shared th
|
|
|
11
11
|
- `scan_id=<scanId returned by the MCP scan context, or CODEX_SECURITY_SCAN_ID when provided>`
|
|
12
12
|
- `scan_dir=<scanDir returned by the MCP scan context>`; when `CODEX_SECURITY_SCAN_DIR` is provided, use that existing SDK-owned directory. Never derive a scan directory from a repository name, revision, timestamp or temporary-directory formula.
|
|
13
13
|
- For a standalone phase, use the `directory` returned by `save_codex_security_artifact` for the selected `targetPath` and `storage`, as described in `artifact-storage.md`.
|
|
14
|
-
- `target_paths_file=<CODEX_SECURITY_TARGET_PATHS_FILE>` for SDK scoped-path scans; reference it as `"$CODEX_SECURITY_TARGET_PATHS_FILE"` in POSIX shells or `"$env:CODEX_SECURITY_TARGET_PATHS_FILE"` in PowerShell. This read-only scope
|
|
14
|
+
- `target_paths_file=<CODEX_SECURITY_TARGET_PATHS_FILE>` for SDK scoped-path scans; reference it as `"$CODEX_SECURITY_TARGET_PATHS_FILE"` in POSIX shells or `"$env:CODEX_SECURITY_TARGET_PATHS_FILE"` in PowerShell. This read-only scope file lives outside the scan directory. Pass it unchanged as `--scopes-file` to the SDK's primary inventory command and to `bind-repo-scopes` before finalization. For `make-hosted-repo-scope-input`, review the inventory at the path it reports. Use the supplied scan-directory recovery command only if a later shell cannot read that file. Do not print, evaluate, modify, or treat the scope file as shell syntax.
|
|
15
15
|
- `artifacts_dir=<scan_dir>/artifacts`
|
|
16
16
|
- `context_dir=<artifacts_dir>/01_context`
|
|
17
17
|
- `discovery_dir=<artifacts_dir>/02_discovery`
|
|
@@ -26,6 +26,7 @@ from urllib.parse import quote, urlsplit
|
|
|
26
26
|
# Keep sibling helpers importable when Python starts in isolated mode.
|
|
27
27
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
28
28
|
import report_projection
|
|
29
|
+
import servicenow_avit
|
|
29
30
|
import threat_model_projection
|
|
30
31
|
from review_state import checkpoint_review_state, review_state, review_summary
|
|
31
32
|
|
|
@@ -78,6 +79,7 @@ SOURCE_READ_CHUNK_SIZE = 64 * 1024
|
|
|
78
79
|
MAX_JSON_INTEGER = (1 << 53) - 1
|
|
79
80
|
EXPORT_PATHS = {
|
|
80
81
|
"csv": "exports/findings.csv",
|
|
82
|
+
"servicenow-avit": "exports/servicenow-avit.csv",
|
|
81
83
|
"json": "exports/findings.json",
|
|
82
84
|
"sarif": "exports/results.sarif",
|
|
83
85
|
}
|
|
@@ -2977,11 +2979,21 @@ def build_csv_projection(findings: dict[str, Any], coverage: dict[str, Any]) ->
|
|
|
2977
2979
|
return output.getvalue().encode("utf-8")
|
|
2978
2980
|
|
|
2979
2981
|
|
|
2982
|
+
def _avit_fields(finding: dict[str, Any]) -> dict[str, str]:
|
|
2983
|
+
attack_path = dict(finding.get("attackPath") or {})
|
|
2984
|
+
_normalize_legacy_string_list_fields(attack_path, ("steps",))
|
|
2985
|
+
steps = "\n".join(attack_path.get("steps", []))
|
|
2986
|
+
return servicenow_avit.finding_fields(
|
|
2987
|
+
finding, _sarif_primary_location(finding), csv_cell(steps)
|
|
2988
|
+
)
|
|
2989
|
+
|
|
2990
|
+
|
|
2980
2991
|
def build_findings_export(
|
|
2981
2992
|
scan_dir: Path,
|
|
2982
2993
|
export_format: str,
|
|
2983
2994
|
source_root: Path | None = None,
|
|
2984
2995
|
schema_dir: Path | None = None,
|
|
2996
|
+
avit_template: Path | None = None,
|
|
2985
2997
|
) -> bytes:
|
|
2986
2998
|
if export_format not in EXPORT_PATHS:
|
|
2987
2999
|
raise ContractError(f"unsupported export format: {export_format}")
|
|
@@ -2994,6 +3006,13 @@ def build_findings_export(
|
|
|
2994
3006
|
)
|
|
2995
3007
|
if export_format == "json":
|
|
2996
3008
|
return findings_bytes
|
|
3009
|
+
if export_format == "servicenow-avit":
|
|
3010
|
+
if avit_template is None:
|
|
3011
|
+
raise ContractError("--export-format servicenow-avit requires --avit-template")
|
|
3012
|
+
try:
|
|
3013
|
+
return servicenow_avit.render(avit_template, map(_avit_fields, findings["findings"]))
|
|
3014
|
+
except ValueError as exc:
|
|
3015
|
+
raise ContractError(str(exc)) from exc
|
|
2997
3016
|
return build_csv_projection(findings, coverage)
|
|
2998
3017
|
|
|
2999
3018
|
|
|
@@ -3407,6 +3426,7 @@ def main() -> int:
|
|
|
3407
3426
|
"--export-artifact", choices=("findings", "threat-model"), default="findings"
|
|
3408
3427
|
)
|
|
3409
3428
|
parser.add_argument("--export-format", choices=[*sorted(EXPORT_PATHS), "md"])
|
|
3429
|
+
parser.add_argument("--avit-template", type=Path)
|
|
3410
3430
|
parser.add_argument("--export-output", type=Path)
|
|
3411
3431
|
parser.add_argument("--export-metadata", action="store_true")
|
|
3412
3432
|
parser.add_argument("--describe-threat-model", action="store_true")
|
|
@@ -3414,6 +3434,18 @@ def main() -> int:
|
|
|
3414
3434
|
args = parser.parse_args()
|
|
3415
3435
|
try:
|
|
3416
3436
|
args.scan_dir = args.scan_dir.resolve()
|
|
3437
|
+
if args.avit_template is not None:
|
|
3438
|
+
if args.export_format != "servicenow-avit":
|
|
3439
|
+
parser.error(
|
|
3440
|
+
"--avit-template is only supported with --export-format servicenow-avit"
|
|
3441
|
+
)
|
|
3442
|
+
if (
|
|
3443
|
+
args.export_output
|
|
3444
|
+
and args.export_output.exists()
|
|
3445
|
+
and args.avit_template.exists()
|
|
3446
|
+
and args.export_output.samefile(args.avit_template)
|
|
3447
|
+
):
|
|
3448
|
+
parser.error("AVIT export output cannot overwrite the reusable template")
|
|
3417
3449
|
if args.describe_threat_model:
|
|
3418
3450
|
sys.stdout.buffer.write(
|
|
3419
3451
|
_json_bytes(describe_threat_model(args.scan_dir, args.schema_dir))
|
|
@@ -3448,7 +3480,11 @@ def main() -> int:
|
|
|
3448
3480
|
description, contents = saved
|
|
3449
3481
|
else:
|
|
3450
3482
|
contents = build_findings_export(
|
|
3451
|
-
args.scan_dir,
|
|
3483
|
+
args.scan_dir,
|
|
3484
|
+
args.export_format,
|
|
3485
|
+
args.source_root,
|
|
3486
|
+
args.schema_dir,
|
|
3487
|
+
avit_template=args.avit_template,
|
|
3452
3488
|
)
|
|
3453
3489
|
if args.export_output is None:
|
|
3454
3490
|
sys.stdout.buffer.write(contents)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"""ServiceNow Manual AVIT Ingestion CSV template and finding fields."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import csv
|
|
6
|
+
import io
|
|
7
|
+
import re
|
|
8
|
+
import sys
|
|
9
|
+
from collections.abc import Iterable
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
from typing import Any
|
|
12
|
+
|
|
13
|
+
AVIT_APP_FIELDS = {
|
|
14
|
+
"Application": 255,
|
|
15
|
+
"Requested by": 151,
|
|
16
|
+
"Purpose of application": 4000,
|
|
17
|
+
"Types of sensitive data": 40,
|
|
18
|
+
"List of compliance programs": 4000,
|
|
19
|
+
"Technology stack details": 4000,
|
|
20
|
+
"Application team": 100,
|
|
21
|
+
"URLs to test": 4000,
|
|
22
|
+
"Assigned to": 151,
|
|
23
|
+
"Assignment group": 151,
|
|
24
|
+
}
|
|
25
|
+
AVIT_FINDING_FIELDS = (
|
|
26
|
+
"Risk rating",
|
|
27
|
+
"CWE category",
|
|
28
|
+
"Vulnerability ID",
|
|
29
|
+
"Steps to reproduce",
|
|
30
|
+
"Technical details",
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def read_template(path: Path) -> tuple[list[str], dict[str, str]]:
|
|
35
|
+
try:
|
|
36
|
+
with path.open(encoding="utf-8-sig", newline="") as source:
|
|
37
|
+
rows = (row for row in csv.reader(source, strict=True) if row)
|
|
38
|
+
headers = next(rows, [])
|
|
39
|
+
values = next(rows, [])
|
|
40
|
+
if len(headers) != len(values) or next(rows, None) is not None:
|
|
41
|
+
raise ValueError("AVIT template must have a header and one application row")
|
|
42
|
+
except (OSError, UnicodeError, csv.Error) as exc:
|
|
43
|
+
raise ValueError(f"Could not read AVIT template {path}: {exc}") from exc
|
|
44
|
+
|
|
45
|
+
row = {header.strip().casefold(): value for header, value in zip(headers, values, strict=True)}
|
|
46
|
+
if len(row) != len(headers):
|
|
47
|
+
raise ValueError("AVIT template has duplicate column names")
|
|
48
|
+
for field in (*AVIT_APP_FIELDS, *AVIT_FINDING_FIELDS):
|
|
49
|
+
if field.casefold() not in row:
|
|
50
|
+
raise ValueError(f"AVIT template is missing column {field!r}")
|
|
51
|
+
for field, limit in AVIT_APP_FIELDS.items():
|
|
52
|
+
value = row[field.casefold()]
|
|
53
|
+
if not value.strip() or len(value) > limit:
|
|
54
|
+
raise ValueError(
|
|
55
|
+
f"AVIT template {field!r} requires a value of at most {limit} characters"
|
|
56
|
+
)
|
|
57
|
+
return headers, row
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _narrative(text: str) -> str:
|
|
61
|
+
return text if len(text) <= 1000 else text[:997] + "..."
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def finding_fields(finding: dict[str, Any], location: dict[str, Any], steps: str) -> dict[str, str]:
|
|
65
|
+
details = (
|
|
66
|
+
f"{finding['findingId']} | {location['path']}:{location['startLine']}\n"
|
|
67
|
+
f"{finding['title']}\n{finding['summary']}\n{finding['remediation']}"
|
|
68
|
+
)
|
|
69
|
+
cwe = next(
|
|
70
|
+
(
|
|
71
|
+
value.upper()
|
|
72
|
+
for value in finding["taxonomy"]["cwe"]
|
|
73
|
+
if len(value) <= 255 and re.fullmatch(r"CWE-[0-9]+", value, re.I)
|
|
74
|
+
),
|
|
75
|
+
"",
|
|
76
|
+
)
|
|
77
|
+
level = finding["severity"]["level"]
|
|
78
|
+
return {
|
|
79
|
+
"Risk rating": "None" if level == "informational" else level.title(),
|
|
80
|
+
"CWE category": cwe,
|
|
81
|
+
"Vulnerability ID": "" if cwe else finding["findingId"],
|
|
82
|
+
"Steps to reproduce": _narrative(steps),
|
|
83
|
+
"Technical details": _narrative(details),
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def render(template: Path, rows: Iterable[dict[str, str]]) -> bytes:
|
|
88
|
+
headers, row = read_template(template)
|
|
89
|
+
output = io.StringIO(newline="")
|
|
90
|
+
writer = csv.writer(output)
|
|
91
|
+
writer.writerow(headers)
|
|
92
|
+
missing_steps = 0
|
|
93
|
+
has_findings = False
|
|
94
|
+
for fields in rows:
|
|
95
|
+
has_findings = True
|
|
96
|
+
if not fields["Steps to reproduce"]:
|
|
97
|
+
missing_steps += 1
|
|
98
|
+
for field, value in fields.items():
|
|
99
|
+
row[field.casefold()] = value
|
|
100
|
+
writer.writerow(row.values())
|
|
101
|
+
if has_findings:
|
|
102
|
+
print(
|
|
103
|
+
"Review Steps to reproduce before uploading. Populated steps describe the recorded "
|
|
104
|
+
f"attack path. Rows with no recorded steps: {missing_steps}.",
|
|
105
|
+
file=sys.stderr,
|
|
106
|
+
)
|
|
107
|
+
return output.getvalue().encode("utf-8")
|
|
@@ -30,7 +30,10 @@ from workbench_validation import optional_text
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
def safe_segment(value: str) -> str:
|
|
33
|
-
|
|
33
|
+
segment = re.sub(r"[^\w.-]", "-", value)
|
|
34
|
+
if segment != value:
|
|
35
|
+
segment = segment.strip("-")
|
|
36
|
+
return segment or "scan"
|
|
34
37
|
|
|
35
38
|
|
|
36
39
|
def compact_timestamp() -> str:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: publish-findings
|
|
3
|
-
description: Requires explicit opt-in with CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1. Preview and import
|
|
3
|
+
description: Requires explicit opt-in with CODEX_SECURITY_ENABLE_EXTERNAL_IMPORTS=1. Preview and import scanner findings into the local workbench or Codex Security Cloud. Use the selected provider's documented export format.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Publish external findings
|
|
@@ -86,10 +86,12 @@ Import native OpenGrep JSON with `--provider opengrep`, `--source-repository-url
|
|
|
86
86
|
|
|
87
87
|
## GitHub alerts and advisories
|
|
88
88
|
|
|
89
|
-
Acquire code-scanning findings with `codex-security import github OWNER/REPO --format json` and save its complete JSON output for local import or Cloud publication. This existing collector completes pagination, fetches alert details, and retains the selected ref's instance. In Codex, use the official [GitHub Codex plugin](https://github.com/openai/plugins/tree/main/plugins/github) for discovery and selecting alerts, then pass that selection to the collector. Its GitHub MCP server paginates each list call separately. Do not ask the user to download JSON from a website or reconstruct
|
|
89
|
+
Acquire code-scanning findings with `codex-security import github OWNER/REPO --format json` and save its complete JSON output for local import or Cloud publication. This existing collector completes pagination, fetches alert details, and retains the selected ref's instance. In Codex, use the official [GitHub Codex plugin](https://github.com/openai/plugins/tree/main/plugins/github) for discovery and selecting alerts, then pass that selection to the collector. Its GitHub MCP server paginates each list call separately. Do not ask the user to download JSON from a website or reconstruct a code-scanning import envelope from MCP summaries. Use the saved collector output for code-scanning alerts.
|
|
90
90
|
|
|
91
91
|
The importer uses the user's GitHub CLI authentication and `GH_HOST`; plugin authentication is separate. It defaults to open alerts on the default branch. Use repeated `--github-alert NUMBER` for exact alerts or `--github-ref REF` for another ref. Save complete output without field/token filters or `--full-output`. Reading code-scanning alerts requires a token with Code scanning alerts read permission (classic: `security_events`, or `public_repo` for public repositories), along with repository access.
|
|
92
92
|
|
|
93
|
+
For Dependabot, follow the [repository alert export guide](https://github.com/openai/codex-security/blob/main/docs/scanner-imports/github-dependabot.md) to save the native REST alert records from one repository. The read-only export requires Dependabot alerts read permission. Preview the file with `publish findings FILE --provider github`, the intended destination and a separate source key such as `github.com/example/project/dependabot`.
|
|
94
|
+
|
|
93
95
|
**GHSA import stages advisory evidence for investigation; it does not establish an installed dependency or applicability to the destination repository.** Keep advisories separate from code scanning. `codex-security import github-advisories OWNER/REPO --format json` reads published repository disclosures by default. Repeated `--github-advisory GHSA-xxxx-xxxx-xxxx` selects exact IDs; `--github-state draft|triage|closed` explicitly selects an unpublished list and cannot be combined with exact IDs. Add `--github-advisory-source global` for exact public database IDs. This does not enumerate the global database. Private advisory access needs Repository security advisories read permission and access to those records. Stop on a read failure instead of publishing an incomplete selection.
|
|
94
96
|
|
|
95
97
|
```sh
|
|
@@ -111,7 +113,7 @@ codex-security publish findings /path/to/advisories.json \
|
|
|
111
113
|
|
|
112
114
|
Choose the local or Cloud preview for the intended destination. GHSA input supports the same choice: use `--to local --repository /path/to/project` with the advisory file and source key. Follow [local imports](#import-locally) for confirmation and readback or [Cloud publication](#publish-to-cloud) for upload review.
|
|
113
115
|
|
|
114
|
-
Use separate stable source
|
|
116
|
+
Use a separate stable source key for each GitHub finding family. Code-scanning identities include the ref; repository alerts and advisories must match the selected Cloud repository or, when available, a configured local Git remote. Global advisories omit source-repository provenance and are bound to the explicit local or Cloud destination for investigation. Preserve original evidence, package ranges and patches; do not infer installed packages or source locations from an advisory. Missing security severity stays `unknown`. Dismissal, resolution and withdrawal are source state, not Codex assessment. Secret-scanning alerts and writeback to GitHub are outside this workflow.
|
|
115
117
|
|
|
116
118
|
## Publish to Cloud
|
|
117
119
|
|
|
@@ -19,7 +19,7 @@ SDK hosts supply their own progress instructions. Use actual deduplicated review
|
|
|
19
19
|
|
|
20
20
|
## Workflow
|
|
21
21
|
|
|
22
|
-
1. Resolve the authorized target, scope, scan directory, and source context. Preserve the supplied threat model, applicable inherited `SECURITY.md` guidance, and optional `CODEX_SECURITY_KNOWLEDGE_BASE`. When `CODEX_SECURITY_TARGET_PATHS_FILE` is supplied,
|
|
22
|
+
1. Resolve the authorized target, scope, scan directory, and source context. Preserve the supplied threat model, applicable inherited `SECURITY.md` guidance, and optional `CODEX_SECURITY_KNOWLEDGE_BASE`. When `CODEX_SECURITY_TARGET_PATHS_FILE` is supplied, run the SDK's primary inventory command exactly as supplied to resolve every requested file and non-ignored directory descendant before review. For `make-hosted-repo-scope-input`, use the path it reports. Run the supplied recovery command only if that inventory is missing or unreadable in a later shell. If the host does not supply an inventory command, run `<plugin_dir>/scripts/launch_codex_security_mcp --helper make-repo-scope-input --repo <repo_root> --scopes-file "$CODEX_SECURITY_TARGET_PATHS_FILE" --out <scan_dir>/scoped-source-input.jsonl` or use the [PowerShell command](#windows-scoped-input) on Windows. Pass the resulting inventory to the core audit without widening scope; do not print, modify, or evaluate the scope file.
|
|
23
23
|
2. Read `../../references/core-scan.md` and perform the audit within the resolved scope and configured limits. Retain its semantic `scope`, `threatModel`, `findings`, and `reviewState`, including source evidence, validation, attack paths, calibrated severity/confidence, and unresolved work.
|
|
24
24
|
3. Save semantic checkpoints throughout the audit as described below. For an SDK-owned scan with a bound semantic draft tool, save the first `complete: false` checkpoint as soon as the threat model is available, then checkpoint new findings and decisions and submit `complete: true` when review finishes. Without that tool, retain the model in an early unsealed canonical draft and update `scan-manifest.json` and `findings.json` using `../../references/scan-contract.md` and the SDK's exact identity and directory. Omit `scan.sealedAt` and `scan.artifacts`. Put review bookkeeping in `scan.reviewState` and set `scan.mode` to `scoped_path` for requested scopes or `repository` otherwise. On SDK file-authored paths, run the supplied scope-binding command when a target-paths file is present.
|
|
25
25
|
4. Verify both canonical JSON files exist. Return control for an SDK-owned scan; the SDK owns finalization and report generation. For other host-backed scans, call `complete_codex_security_scan({ scanId, handoffClaimToken? })` once and return after it succeeds and `report.md` exists. If completion fails, surface its exact error and preserve the scan for continuation. Do not hand-author reports or reread complete canonical findings unless requested. Report complete measured token usage only; leave pending usage to the host and identify unavailable counts.
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AA6CA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAEL,sBAAsB,EACvB,MAAM,kBAAkB,CAAC;AAQ1B,OAAO,EAKL,gBAAgB,EAIhB,KAAK,aAAa,EACnB,MAAM,WAAW,CAAC;AAMnB,OAAO,EAcL,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,sBAAsB,EAE5B,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACrB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGhF,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,YAAY,EAElB,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAA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AAW,GACX,eAAe,GACf,SAAS,GACT,SAAS,CAgDZ;AA4BD,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,UAAU,EAClB,uBAAuB,CAAC,EAAE,MAAM,GAC/B,UAAU,CA2CZ;AA+FD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAsKvE;AAmKD,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,kBAAkB,EAC/B,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,SAAS,CAcpB"}
|
package/dist/api.js
CHANGED
|
@@ -1600,7 +1600,7 @@ export class CodexSecurity {
|
|
|
1600
1600
|
await writeCustomValidationStatus(scanDir, { scanId, status: "pending" }, signal);
|
|
1601
1601
|
}
|
|
1602
1602
|
checkOpen();
|
|
1603
|
-
const basePrompt = scanPrompt(await targetInstruction(normalized, shellPluginRoot), mode, skillName, scanId, knowledgeBase !== null, options.resumeScanId !== undefined &&
|
|
1603
|
+
const basePrompt = scanPrompt(await targetInstruction(normalized, shellPluginRoot, this.#dependencies.hostedScan !== undefined), mode, skillName, scanId, knowledgeBase !== null, options.resumeScanId !== undefined &&
|
|
1604
1604
|
typeof registration["userContext"] === "string"
|
|
1605
1605
|
? registration["userContext"]
|
|
1606
1606
|
: options.scanPrompt, options.maxCostUsd !== undefined, discoveryPrompt, modelProvider, options.ownerSuggestions);
|
|
@@ -3421,7 +3421,7 @@ function skillNameFor(target, mode) {
|
|
|
3421
3421
|
return "security-diff-scan";
|
|
3422
3422
|
return mode === "deep" ? "deep-security-scan" : "security-scan";
|
|
3423
3423
|
}
|
|
3424
|
-
async function targetInstruction(target, pluginRoot) {
|
|
3424
|
+
async function targetInstruction(target, pluginRoot, hosted) {
|
|
3425
3425
|
if (target.kind === "repository")
|
|
3426
3426
|
return "Scan target: the entire repository.";
|
|
3427
3427
|
if (target.kind === "paths") {
|
|
@@ -3436,16 +3436,33 @@ async function targetInstruction(target, pluginRoot) {
|
|
|
3436
3436
|
if (code !== "ENOENT" && code !== "ENOTDIR")
|
|
3437
3437
|
throw error;
|
|
3438
3438
|
}
|
|
3439
|
-
const
|
|
3440
|
-
|
|
3441
|
-
: process.platform === "win32"
|
|
3442
|
-
? String.raw `cmd.exe /d /v:off /s /c '""%CODEX_SECURITY_PLUGIN_ROOT%\scripts\launch_codex_security_mcp.cmd" --helper make-repo-scope-input --repo "%CODEX_SECURITY_REPOSITORY%\." --scopes-file "%CODEX_SECURITY_TARGET_PATHS_FILE%" --out "%CODEX_SECURITY_SCAN_DIR%\scoped-source-input.jsonl""'`
|
|
3443
|
-
: `${helper} --helper make-repo-scope-input --repo ${shellEnvironmentReference("CODEX_SECURITY_REPOSITORY")} --scopes-file ${scopes} --out ${shellEnvironmentReference("CODEX_SECURITY_SCAN_DIR", "/scoped-source-input.jsonl")}`;
|
|
3439
|
+
const inventory = shellEnvironmentReference("CODEX_SECURITY_SCAN_DIR", "/scoped-source-input.jsonl");
|
|
3440
|
+
const scopeArgs = `--repo ${shellEnvironmentReference("CODEX_SECURITY_REPOSITORY")} --scopes-file ${scopes} --out ${inventory}`;
|
|
3444
3441
|
// CMD expands the environment references once, preserving percent signs in path values.
|
|
3445
3442
|
const bindScopes = process.platform === "win32"
|
|
3446
3443
|
? String.raw `cmd.exe /d /v:off /s /c '""%CODEX_SECURITY_PLUGIN_ROOT%\scripts\launch_codex_security_mcp.cmd" --helper bind-repo-scopes --scopes-file "%CODEX_SECURITY_TARGET_PATHS_FILE%" --manifest "%CODEX_SECURITY_SCAN_DIR%\scan-manifest.json""'`
|
|
3447
|
-
: `${
|
|
3448
|
-
|
|
3444
|
+
: `${helper} --helper bind-repo-scopes --scopes-file ${scopes} --manifest ${shellEnvironmentReference("CODEX_SECURITY_SCAN_DIR", "/scan-manifest.json")}`;
|
|
3445
|
+
const scanTarget = "Scan target paths: resolve every requested file and all non-ignored descendants of requested directories";
|
|
3446
|
+
const finalize = `Before finalization, preserve every requested scope with:\n${bindScopes}\nDo not print, evaluate, or modify the target-paths file.`;
|
|
3447
|
+
if (hosted && process.platform === "linux" && !legacyGenerator) {
|
|
3448
|
+
const capabilities = await pluginCapabilities(pluginRoot).catch(() => undefined);
|
|
3449
|
+
if (capabilities?.["hostedScopeInventory"] === 1) {
|
|
3450
|
+
const hostedHelper = `${helper} --helper make-hosted-repo-scope-input ${scopeArgs}`;
|
|
3451
|
+
return [
|
|
3452
|
+
`${scanTarget} using the hosted scope helper:`,
|
|
3453
|
+
`${hostedHelper} --state-dir ${shellEnvironmentReference("CODEX_SECURITY_STATE_DIR")}`,
|
|
3454
|
+
"Use the reported path. If a later shell cannot read it, use the path reported by this recovery command:",
|
|
3455
|
+
hostedHelper,
|
|
3456
|
+
finalize,
|
|
3457
|
+
].join("\n");
|
|
3458
|
+
}
|
|
3459
|
+
}
|
|
3460
|
+
const makeScope = legacyGenerator
|
|
3461
|
+
? `${pluginPythonCommand()} ${shellEnvironmentReference("CODEX_SECURITY_PLUGIN_ROOT", "/scripts/generate_rank_input.py")} make-repo-scope-input ${scopeArgs}`
|
|
3462
|
+
: process.platform === "win32"
|
|
3463
|
+
? String.raw `cmd.exe /d /v:off /s /c '""%CODEX_SECURITY_PLUGIN_ROOT%\scripts\launch_codex_security_mcp.cmd" --helper make-repo-scope-input --repo "%CODEX_SECURITY_REPOSITORY%\." --scopes-file "%CODEX_SECURITY_TARGET_PATHS_FILE%" --out "%CODEX_SECURITY_SCAN_DIR%\scoped-source-input.jsonl""'`
|
|
3464
|
+
: `${helper} --helper make-repo-scope-input ${scopeArgs}`;
|
|
3465
|
+
return `${scanTarget} using ${makeScope}. ${finalize}`;
|
|
3449
3466
|
}
|
|
3450
3467
|
if (target.kind === "refs") {
|
|
3451
3468
|
return `Scan target: Git diff from ${target.base} to ${target.head}.`;
|
|
@@ -4075,13 +4092,17 @@ export function scanPreflightCodexConfig(config) {
|
|
|
4075
4092
|
}
|
|
4076
4093
|
return result;
|
|
4077
4094
|
}
|
|
4078
|
-
async function
|
|
4079
|
-
const manifest = JSON.parse(await readFile(join(
|
|
4095
|
+
async function pluginCapabilities(pluginRoot) {
|
|
4096
|
+
const manifest = JSON.parse(await readFile(join(pluginRoot, ".codex-plugin", "plugin.json"), "utf8"));
|
|
4080
4097
|
const capabilities = isRecord(manifest)
|
|
4081
4098
|
? manifest["codexSecurity"]
|
|
4082
4099
|
: undefined;
|
|
4100
|
+
return isRecord(capabilities) ? capabilities : undefined;
|
|
4101
|
+
}
|
|
4102
|
+
async function requireCurrentDeepScanPlugin(runtime) {
|
|
4103
|
+
const capabilities = await pluginCapabilities(runtime.plugin.pluginRoot);
|
|
4083
4104
|
if (runtime.deepScanConfigPath === undefined ||
|
|
4084
|
-
|
|
4105
|
+
capabilities === undefined ||
|
|
4085
4106
|
capabilities["directDeepScanEngine"] !== 1 ||
|
|
4086
4107
|
capabilities["workerProviderSnapshot"] !== 4) {
|
|
4087
4108
|
throw new CodexSecurityError("Deep Scan requires the current plugin's direct engine and isolated worker runtime support. Update the custom plugin or use the bundled plugin.");
|