Skip to content

Commit 3f1e931

Browse files
committed
lua: make ffi, load* available
The ffi package has been disabled for over a year and the load* functions have been disabled for over a year and a half. There's not really any point trying to fully sandbox the user configuration since it requires some more invasive changes (require will still happily load bytecode so it would be necessary to completely overwrite package.loaders) and it will just get in the way of people trying to do more interesting things with their configuration.
1 parent c2f4588 commit 3f1e931

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

doc/03_lua_changes.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ waywall makes use of [LuaJIT], an alternative implementation of Lua 5.1 which
44
provides better performance and additional functionality. A list of LuaJIT's
55
additions is available [here](https://luajit.org/extensions.html).
66

7-
> Note: The `ffi` and `jit` packages from LuaJIT are not available in waywall.
7+
> Note: The `jit` package from LuaJIT is not available in waywall.
88
99
## Instruction count limit
1010

@@ -36,11 +36,6 @@ waywall makes a few changes and additions to the Lua standard library:
3636
- Calling `os.setenv` with a string and nil will unset the given environment
3737
variable.
3838

39-
There are also a few breaking changes, which are mostly intended to prevent user
40-
code from causing problems within waywall's address space:
41-
42-
- `load`, `loadfile`, and `loadstring` are not available
43-
4439
You can refer to the [startup code] to see all of the changes waywall makes in
4540
more detail.
4641

waywall/lua/init.lua

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,7 @@ local priv = _G.priv_waywall
4444
-- User code should not have access to private Lua API functions.
4545
_G.priv_waywall = nil
4646

47-
-- The load* functions can be used to circumvent security measures in LuaJIT.
48-
_G.load = nil
49-
_G.loadfile = nil
50-
_G.loadstring = nil
51-
52-
-- Do not load the ffi and jit extensions.
53-
package.preload["ffi"] = nil
47+
-- Do not load the jit extension.
5448
package.loaded["jit"] = nil
5549

5650
-- pcall and xpcall must be overridden to prevent user code from accidentally

0 commit comments

Comments
 (0)