Repository navigation
Security Model
FerrisPad plugins run in a sandboxed environment with strict resource limits and permission controls.
The following Lua standard libraries are removed from the plugin environment:
-
os— no OS-level access -
io— no direct file I/O (use the Filesystem API instead) -
debug— no debug introspection -
loadfile,dofile,require,load— no dynamic code loading -
package— no module system
Available standard libraries:
-
string,table,math— data manipulation -
pairs,ipairs,next,select— iteration -
type,tonumber,tostring— type conversion -
pcall,xpcall,error,assert— error handling -
print— output (goes to stderr) -
rawget,rawset,getmetatable,setmetatable— table access
Forbidden: Any access to the global table _G is prohibited. All plugins share one Lua runtime, and modifying _G can break other plugins. The static scanner blocks rawset(_G, ...) and rawget(_G, ...) automatically. Direct _G access (e.g., _G.foo = bar) is caught during security review. See Plugin Lifecycle for details.
| Resource | Limit | On Exceed |
|---|---|---|
| Instructions per hook call | 1,000,000 | Hook aborted, error logged, plugin stays loaded |
| Memory per plugin | 16 MB | Hook aborted (Lua allocator error), plugin stays loaded |
| Command execution timeout | 30 seconds | Process killed (SIGKILL on Unix, taskkill on Windows) |
Instruction count is checked every 1,000 instructions to minimize overhead.
All filesystem operations are restricted to the project root directory:
- Relative paths are resolved against the project root
- Absolute paths must be within the project root or they are rejected
- Path traversal (
../../../etc/passwd) is blocked — paths are canonicalized and verified - Symlinks are resolved to their real path before validation
- Write operations fail if the target is outside the sandbox
- Plugin declares commands in
plugin.tomlunder[permissions] execute - First time a plugin tries to run a command, FerrisPad shows an approval dialog
- User can Allow or Deny
- Decision is remembered per-plugin in settings
All command arguments are checked for shell injection characters. These are blocked:
; & | ` $ ( ) { } < > \n \r \ * ? [ ]
This prevents plugins from constructing shell commands that escape the intended execution.
- Cryptographically signed with ed25519
- Signature covers:
init.luachecksum +plugin.tomlchecksum + version - Verified on install — any tampering invalidates the signature
- Distributed via the plugin registry
- SHA-256 checksums for
init.luaandplugin.toml - Pinned to immutable git tags (no race conditions)
- Listed in
community-plugins.jsonin the plugin registry - Source code publicly available for review
- No verification — installed by copying to the plugins directory
- User takes full responsibility
- Still subject to all sandbox and permission rules