← Files Codex SecurityARCHIVED FILE

scripts/workbench/storage.py

608 Bytes · Oct 2, 2026 · 00:04 UTC

↓ Download file

"""Storage paths shared by workbench persistence and MCP artifact selection."""

from __future__ import annotations

import os
from pathlib import Path


def state_dir() -> Path:
    state_dir = os.environ.get("CODEX_SECURITY_STATE_DIR")
    if state_dir:
        return Path(state_dir).expanduser().resolve()
    codex_home = Path(os.environ.get("CODEX_HOME", "~/.codex")).expanduser()
    return (codex_home / "state" / "plugins" / "codex-security").resolve()


def resolve_scan_root(scan_root: str | None) -> Path:
    return Path(scan_root).expanduser().resolve() if scan_root else state_dir() / "scans"

SHA-256: 973275d28c851b1b8408f7ac59e89a2a68057f2aecb4831e6aa2396c83a39e6d