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

Function path_within_scope

plugins/codex-security/scripts/workbench_db.py:1085–1092  ·  view source on GitHub ↗
(path: str, scope: str)

Source from the content-addressed store, hash-verified

1083
1084
1085def path_within_scope(path: str, scope: str) -> bool:
1086 candidate = PurePosixPath(path)
1087 requested = PurePosixPath(scope)
1088 if candidate.is_absolute() or ".." in candidate.parts:
1089 return False
1090 if requested == PurePosixPath("."):
1091 return True
1092 return candidate == requested or requested in candidate.parents
1093
1094
1095def require_scope(scope: str, mode: str, target: Path) -> str:

Callers 1

verify_manifest_bindingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected