Is there anyway to avoid this security issue in Lua?

前端 未结 6 1586
挽巷
挽巷 2020-12-20 21:14

I was just working on a localizable Lua string solution, when I came up with this hack, problem is I don\'t know how to avoid getting hacked by it :) So I was wondering if a

6条回答
  •  醉梦人生
    2020-12-20 21:39

    If your hacker has the ability to add code, and you need to allow that code to call things like os.exit, then you're pretty much out of luck anyway.

    You can restrict the functions that their code can call, though. It depends on what you still want user code to be able to do. See the doc for setfenv and google for "lua sandbox"

提交回复
热议问题