dispatchrun / timecraft

The WebAssembly Time Machine
https://docs.timecraft.dev
GNU Affero General Public License v3.0
329 stars 7 forks source link

sandbox: make DirFS a root file system #207

Closed achille-roussel closed 1 year ago

achille-roussel commented 1 year ago

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.