MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / check_readable_internal_path

Function check_readable_internal_path

src/permissions/filesystem.py:356–374  ·  view source on GitHub ↗

True when ``file_path`` resolves inside a harness-internal readable dir. Compares fully resolved paths on both sides so the macOS ``/tmp`` → ``/private/tmp`` symlink (and any other symlinked prefix) matches.

(file_path: str, context: Any)

Source from the content-addressed store, hash-verified

354
355
356def check_readable_internal_path(file_path: str, context: Any) -> bool:
357 """True when ``file_path`` resolves inside a harness-internal readable dir.
358
359 Compares fully resolved paths on both sides so the macOS ``/tmp`` →
360 ``/private/tmp`` symlink (and any other symlinked prefix) matches.
361 """
362 if not file_path:
363 return False
364 try:
365 target = Path(resolve_path(file_path))
366 except Exception:
367 return False
368 for d in _readable_internal_dirs(context):
369 try:
370 if _is_within(target, Path(resolve_path(str(d)))):
371 return True
372 except Exception:
373 continue
374 return False
375
376
377def _path_in_allowed_roots(file_path: str, context: Any) -> bool:

Calls 3

resolve_pathFunction · 0.85
_readable_internal_dirsFunction · 0.85
_is_withinFunction · 0.70