Skip to content

Commit 467c0f7

Browse files
committed
fix(presets): stop resolving symlinks in extension manifest candidate path
_extension_manifest_declared_template() resolved ext_dir/rel_path before returning it, which follows symlinks in ext_dir's ancestors (e.g. macOS's symlinked tmp dir) and diverges from the unresolved paths convention-based lookup returns for the same directory. Resolve only for the traversal containment check; return the unresolved candidate. Fixes the 4 CI test failures across all OS/Python matrix jobs on #4012.
1 parent 0070d25 commit 467c0f7

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/specify_cli/presets/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5024,10 +5024,14 @@ def _extension_manifest_declared_template(
50245024
rel_path = Path(file_rel)
50255025
if rel_path.is_absolute():
50265026
return entry, None
5027+
candidate = ext_dir / rel_path
50275028
try:
5028-
ext_root = ext_dir.resolve()
5029-
candidate = (ext_root / rel_path).resolve()
5030-
candidate.relative_to(ext_root) # raises ValueError if outside
5029+
# Resolve only for the containment check, not for the
5030+
# returned path -- resolving the returned path would follow
5031+
# symlinks in ext_dir's ancestors (e.g. a symlinked tmp dir
5032+
# on macOS) and diverge from the unresolved paths convention
5033+
# lookup returns for the same directory.
5034+
candidate.resolve().relative_to(ext_dir.resolve()) # raises ValueError if outside
50315035
except (OSError, ValueError):
50325036
return entry, None
50335037
return entry, (candidate if candidate.is_file() else None)

0 commit comments

Comments
 (0)