Skip to content

Commit 2219031

Browse files
NathanWalkerclaude
andauthored
fix(runtime): tolerate sandbox-denied parents in exact-case path checks (#66)
PathExistsWithExactCase verifies each component by enumerating its parent directory, starting from the filesystem root. On a physical device the sandbox forbids listing everything above the app container (/private/var/containers, /var/mobile/Containers), so the directory iterator errors and every module resolution failed with "the specified module does not exist" - the runtime could not boot any app on hardware while the simulator (whose containers live under the listable macOS home) passed. When a parent cannot be enumerated, trust the exists() check that already vouched for the full path and keep walking: case verification still applies to every listable level, which covers the app's own content - the case mistakes the check exists to catch. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent cb2cf10 commit 2219031

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

NativeScript/runtime/modules/module/ModuleInternal.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#include <unordered_map>
1616
#include <unordered_set>
1717

18-
#include "runtime/NativeScriptException.h"
1918
#include "native_api_util.h"
19+
#include "runtime/NativeScriptException.h"
2020
#include "runtime/RuntimeConfig.h"
2121
#include "runtime/Util.h"
2222
#include "runtime/modules/node/Node.h"
@@ -173,7 +173,14 @@ bool PathExistsWithExactCase(const std::filesystem::path& path) {
173173
}
174174
}
175175

176-
if (iterEc || !matched) {
176+
if (iterEc) {
177+
// On device the sandbox forbids enumerating everything above the app
178+
// container (/private/var/...), so case verification is only possible
179+
// for listable levels; exists() already vouched for the full path.
180+
current /= component;
181+
continue;
182+
}
183+
if (!matched) {
177184
return false;
178185
}
179186

0 commit comments

Comments
 (0)