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)
| 354 | |
| 355 | |
| 356 | def 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 | |
| 377 | def _path_in_allowed_roots(file_path: str, context: Any) -> bool: |