Resolve native imports beneath nested roots

This commit is contained in:
2026-10-20 00:23:55 +00:00
parent 38fb315415
commit 75da54150f
3 changed files with 63 additions and 3 deletions

View File

@@ -177,7 +177,9 @@ func resolveNativeImportPath(access *filesystemAccess, filesystem fs.ReadLinkFS,
if candidate == "" {
candidate = "."
}
if !access.contains(candidate) {
// Ancestors of a multi-component root are resolution prefixes, not
// selected targets. Complete paths and link targets remain contained.
if !access.contains(candidate) && !strings.HasPrefix(access.rootPath, candidate+"/") {
return "", errImportPathOutsideRoot
}
info, err := filesystem.Lstat(candidate)