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

Function safe_source_path

plugins/codex-security/scripts/workbench_db.py:3483–3494  ·  view source on GitHub ↗
(target: Path, relative_path: str)

Source from the content-addressed store, hash-verified

3481
3482
3483def safe_source_path(target: Path, relative_path: str) -> Path | None:
3484 if "\\" in relative_path:
3485 return None
3486 parsed = PurePosixPath(relative_path)
3487 if parsed.is_absolute() or ".." in parsed.parts:
3488 return None
3489 try:
3490 path = (target / parsed.as_posix()).resolve()
3491 path.relative_to(target)
3492 except (OSError, RuntimeError, ValueError):
3493 return None
3494 return path
3495
3496
3497def available_artifact_path(scan_dir: Path, candidate: Path) -> Path | None:

Callers 1

finding_resultFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected