Blacklist shell syscalls in Lua for now (security)

pull/1224/head
Zef Hemel 2025-01-19 13:02:01 +01:00
parent 11a2adbea6
commit 72b4ecdc36
2 changed files with 2 additions and 14 deletions

View File

@ -26,10 +26,10 @@ export function buildLuaEnv(system: System<any>, scriptEnv: ScriptEnvironment) {
function exposeSyscalls(env: LuaEnv, system: System<any>) {
// Expose all syscalls to Lua
// Except...
const exclude = ["template"];
const blacklist = ["template", "shell"];
const nativeFs = new LuaStackFrame(env, null);
for (const syscallName of system.registeredSyscalls.keys()) {
if (exclude.includes(syscallName)) {
if (blacklist.includes(syscallName)) {
continue;
}
const [ns, fn] = syscallName.split(".");

View File

@ -1,12 +0,0 @@
The Shell API provides functions for running shell commands.
### shell.run(cmd, args)
Runs a shell command with the specified arguments.
Example:
```lua
local result = shell.run("ls", {"-la"})
print("Output: " .. result.stdout)
print("Errors: " .. result.stderr)
print("Exit code: " .. result.code)
```