MCPcopy Index your code
hub / github.com/openai/plugins / artifact_path

Function artifact_path

plugins/codex-security/scripts/workbench_db.py:3509–3523  ·  view source on GitHub ↗
(scan_dir: Path, file_name: str, *, required: bool)

Source from the content-addressed store, hash-verified

3507
3508
3509def artifact_path(scan_dir: Path, file_name: str, *, required: bool) -> Path | None:
3510 scan_dir = require_canonical_scan_directory(scan_dir)
3511 candidate = scan_dir / file_name
3512 try:
3513 resolved = candidate.resolve(strict=True)
3514 resolved.relative_to(scan_dir.resolve())
3515 except (FileNotFoundError, RuntimeError, ValueError) as exc:
3516 if not required and isinstance(exc, FileNotFoundError):
3517 return None
3518 raise SystemExit(
3519 f"{file_name}: expected a regular file inside the scan directory."
3520 ) from exc
3521 if resolved != candidate or not candidate.is_file():
3522 raise SystemExit(f"{file_name}: expected a regular non-symlink file.")
3523 return resolved
3524
3525
3526def require_canonical_scan_directory(scan_dir: Path) -> Path:

Callers 3

complete_scan_lockedFunction · 0.85
export_findingsFunction · 0.85

Calls 1

Tested by

no test coverage detected