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

test(plugin): exercise macOS filesystem fixtures portably (#2487)

Michael D'Angelo08a9a247d1d4
diff --git a/plugins/codex-security/tests/test_deep_scan_successful_publication.py b/plugins/codex-security/tests/test_deep_scan_successful_publication.py
index 3a899ce76..843e25c24 100644
--- a/plugins/codex-security/tests/test_deep_scan_successful_publication.py
+++ b/plugins/codex-security/tests/test_deep_scan_successful_publication.py
@@ -3,6 +3,7 @@
from __future__ import annotations
import copy
+import errno
import json
import os
import shutil
@@ -320,7 +321,12 @@ def test_completion_captures_target_warnings_before_first_seal(
@pytest.mark.parametrize("mode", ["standard", "deep"])
def test_completion_preserves_non_utf8_filename_warning(publication_scan, tmp_path, mode):
scan = publication_scan(mode=mode)
- os.mkfifo(os.fsencode(tmp_path / "target") + b"/new-pipe-\xff")
+ try:
+ os.mkfifo(os.fsencode(tmp_path / "target") + b"/new-pipe-\xff")
+ except OSError as exc:
+ if exc.errno == errno.EILSEQ:
+ pytest.skip("Filesystem rejects non-UTF-8 filenames")
+ raise
completed = scan.complete()
diff --git a/plugins/codex-security/tests/test_workbench_scan_usage.py b/plugins/codex-security/tests/test_workbench_scan_usage.py
index b6bb5bf32..b20457ad4 100644
--- a/plugins/codex-security/tests/test_workbench_scan_usage.py
+++ b/plugins/codex-security/tests/test_workbench_scan_usage.py
@@ -4,6 +4,7 @@ from __future__ import annotations
import json
import sqlite3
+import subprocess
import sys
import tempfile
import uuid
@@ -1397,11 +1398,15 @@ def test_missing_usage_preserves_measured_parent_or_descendant(
@pytest.mark.native_macos
@pytest.mark.skipif(sys.platform != "darwin", reason="macOS system path aliases")
[email protected]("temporary_root", [tempfile.gettempdir(), "/tmp"], ids=["var", "tmp"])
[email protected]("temporary_root", [None, "/tmp"], ids=["var", "tmp"])
def test_completion_accepts_macos_system_rollout_alias(
tmp_path: Path,
- temporary_root: str,
+ temporary_root: str | None,
) -> None:
+ if temporary_root is None:
+ temporary_root = subprocess.check_output(
+ ["getconf", "DARWIN_USER_TEMP_DIR"], text=True
+ ).strip()
fixture = _start_scan(tmp_path)
counted = fixture.started_at + timedelta(microseconds=1)
with tempfile.TemporaryDirectory(dir=temporary_root) as directory: