Skip to main content
Version: Next

Sandbox and Safety

FScript security is capability-based.

Scripts can only perform actions that your host exposes and permits. See Host Permissions for the default-deny Interactive, Threading, IO, Native and Network policy.

Practical safety model​

  • Do not expose risky externs by default.
  • Restrict filesystem scope with root/deny policies.
  • Treat symlinks and reparse points as sandbox boundary risks. The Fs module rejects those paths.
  • Use host cancellation/time limits for cooperative execution and propagate cancellation into async I/O. Enforce memory limits and use process isolation when termination must be guaranteed.
  • Treat script execution as untrusted input handling.
  1. Expose read-only externs first.
  2. Add write/network capability only when required.
  3. Log extern calls for observability.

Assembly providers and opaque host state​

Loading a configured provider in an embedding host requires Native. A configured provider is executable .NET code. Registration may have side effects or access native code; HostContext and fscript.toml do not sandbox it. The CLI trusts configured providers, including providers in an automatically discovered manifest beside the entry script (or in the working directory for stdin/REPL). Use --no-config to skip manifest loading. VS Code gates configured execution on workspace trust while retaining default analysis in Restricted Mode. Hosts can parse and inspect effective configuration without loading providers; see Environment Configuration.

Host-managed values prevent scripts from constructing or updating opaque host resources and expose only registered visible fields. They preserve private payloads through calls and containers, but do not supply a disposal protocol or resource isolation. The host owns lifetime, synchronization, cloning, and the capabilities available through registered functions.

Process.exec is supplied by Runtime default externs, requires Native, and exposes asynchronous I/O. Script Task.await separately requires Threading. Child programs run with host OS access. Filesystem root and deny rules do not contain these children; use OS isolation if containment is needed.