Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

fix(ci): make Python SDK checks portable on Windows

Copyberrybf0ac3453693
diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml
index 6da4b4acb..0ceae4633 100644
--- a/.github/workflows/python-ci.yml
+++ b/.github/workflows/python-ci.yml
@@ -87,7 +87,7 @@ jobs:
- name: Verify wheel
run: |
python -m venv /tmp/codex-security-wheel
- /tmp/codex-security-wheel/bin/pip install dist/*.whl
+ /tmp/codex-security-wheel/bin/pip install --no-compile dist/*.whl
/tmp/codex-security-wheel/bin/codex-security --version
/tmp/codex-security-wheel/bin/codex-security --help >/dev/null
/tmp/codex-security-wheel/bin/python - <<'PY'
diff --git a/sdk/python/tests/test_cli.py b/sdk/python/tests/test_cli.py
index a4c9a6e5a..863ae42d9 100644
--- a/sdk/python/tests/test_cli.py
+++ b/sdk/python/tests/test_cli.py
@@ -234,7 +234,7 @@ def test_cli_reports_progress_without_corrupting_json(
assert main(["scan", ".", "--json"]) == 0
captured = capsys.readouterr()
- assert json.loads(captured.out)["scanDir"] == "/tmp/scan"
+ assert json.loads(captured.out)["scanDir"] == str(result.scan_dir)
assert events == ["turn", "run"]
progress_lines = captured.err.splitlines()
assert all(line.startswith("[") and "] " in line for line in progress_lines)
diff --git a/sdk/python/tests/test_runtime.py b/sdk/python/tests/test_runtime.py
index 4ec79ec8e..f5eeca4a9 100644
--- a/sdk/python/tests/test_runtime.py
+++ b/sdk/python/tests/test_runtime.py
@@ -1,6 +1,7 @@
from __future__ import annotations
import json
+import os
import zipfile
from pathlib import Path
@@ -84,7 +85,8 @@ def test_file_auth_is_imported_with_private_permissions(tmp_path: Path) -> None:
assert import_ambient_auth(ambient, isolated) is True
auth = isolated / "auth.json"
assert auth.read_text(encoding="utf-8") == '{"token":"test"}\n'
- assert auth.stat().st_mode & 0o777 == 0o600
+ if os.name != "nt":
+ assert auth.stat().st_mode & 0o777 == 0o600
def test_bootstrap_uses_supported_plugin_commands(
@@ -104,7 +106,7 @@ def test_bootstrap_uses_supported_plugin_commands(
with (home / "config.toml").open("a", encoding="utf-8") as config:
config.write(
'\n[marketplaces.codex-security-sdk]\nsource_type = "local"\n'
- f'source = "{home / "sdk-marketplace"}"\n'
+ f"source = {json.dumps(str(home / 'sdk-marketplace'), ensure_ascii=False)}\n"
)
elif args[:2] == ["plugin", "add"]:
with (home / "config.toml").open("a", encoding="utf-8") as config: