Based on #206, this PR modifies the sandbox.DirFS implementation to become a root file system (one that the guest cannot escape by referencing the root's parent directory).
The change is done by reusing sandbox.ResolvePath for all path resolutions instead of letting the kernel handle it.
Consequently, existing wasm modules spawned by timecraft will now be sandboxed to the preopen directories, incapable of navigating the rest of the host file system. It will keep everything the same for use cases where we mount the host root file system.
Based on #206, this PR modifies the
sandbox.DirFS
implementation to become a root file system (one that the guest cannot escape by referencing the root's parent directory).The change is done by reusing
sandbox.ResolvePath
for all path resolutions instead of letting the kernel handle it.Consequently, existing wasm modules spawned by timecraft will now be sandboxed to the preopen directories, incapable of navigating the rest of the host file system. It will keep everything the same for use cases where we mount the host root file system.