diff options
author | meir <meir@redis.com> | 2022-02-15 20:18:49 +0200 |
---|---|---|
committer | meir <meir@redis.com> | 2022-04-27 00:37:40 +0300 |
commit | efa162bcd7ab1477c07d8ee85537e27c0cb1524b (patch) | |
tree | 900e0b068a2f9c4dd351206caf2a368b12bb94bb /src/script_lua.h | |
parent | 3731580b6b80c586322cadc6bc4be2b8b2bbb206 (diff) | |
download | redis-efa162bcd7ab1477c07d8ee85537e27c0cb1524b.tar.gz |
Protect any table which is reachable from globals and added globals white list.
The white list is done by setting a metatable on the global table before initializing
any library. The metatable set the `__newindex` field to a function that check
the white list before adding the field to the table. Fields which is not on the
white list are simply ignored.
After initialization phase is done we protect the global table and each table
that might be reachable from the global table. For each table we also protect
the table metatable if exists.
Diffstat (limited to 'src/script_lua.h')
-rw-r--r-- | src/script_lua.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/script_lua.h b/src/script_lua.h index e6ca4f730..4c2b34804 100644 --- a/src/script_lua.h +++ b/src/script_lua.h @@ -68,7 +68,9 @@ typedef struct errorInfo { void luaRegisterRedisAPI(lua_State* lua); sds luaGetStringSds(lua_State *lua, int index); void luaRegisterGlobalProtectionFunction(lua_State *lua); -void luaSetGlobalProtection(lua_State *lua); +void luaSetErrorMetatable(lua_State *lua); +void luaSetAllowListProtection(lua_State *lua); +void luaSetTableProtectionRecursively(lua_State *lua); void luaRegisterLogFunction(lua_State* lua); void luaRegisterVersion(lua_State* lua); void luaPushErrorBuff(lua_State *lua, sds err_buff); |