aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_security.cpp
AgeCommit message (Collapse)Author
2021-12-18Refactor trusted mod checking codesfan5
2021-12-18Remove setlocal and setupvalue from `debug` table whitelistsfan5
It's likely that these could be used trick mods into revealing the insecure environment even if they do everything right (which is already hard enough).
2021-11-26Add Lua bitop library (#9847)Lejo
2021-08-28Async-related script cleanupssfan5
2021-04-18Isolate library tables between sandbox and insecure envsfan5
2020-12-24Fix some minor code issues all over the placesfan5
2020-10-25Fix CSMs on arm64 (#10553)luk3yx
2020-04-08Work around LuaJIT issues on aarch64 (#9614)sfan5
- Move the text segment below the 47-bit limit, needed for script_exception_wrapper which must be lightuserdata - Replace CUSTOM_RIDX_SCRIPTAPI with full userdata
2019-11-09Load client mods into memory before execution.sfan5
Preperation for server-sent CSM which will eventually need this.
2019-11-09Refactor loading of Lua code with mod securitysfan5
2019-09-14CSM: Fix itemstack:get_meta() 'metadata' indexing errorSmallJoker
2019-09-14Load CSM environment after the restrictions are knownSmallJoker
Safety-guards for CSM callbacks to abort on a bad implementation Only run callbacks when the mods are loaded (and with it: builtin) Duplication checks inside constructors
2019-07-24Removed debug.upvaluejoin to prevent leak of insecure environmenty
2018-11-28Move client-specific files to 'src/client' (#7902)Quentin Bazin
Update Android.mk Remove 'src/client' from include_directories
2018-06-30Modernize lua read (part 2 & 3): C++ templating assurance (#7410)Loïc Blot
* Modernize lua read (part 2 & 3): C++ templating assurance Implement the boolean reader Implement the string reader Also remove unused & unimplemented script_error_handler Add a reader with default value
2018-02-08Move `setlocale` from Lua to C++.red-001
2017-08-20Modernize source code: last part (#6285)Loïc Blot
* Modernize source code: last par * Use empty when needed * Use emplace_back instead of push_back when needed * For range-based loops * Initializers fixes * constructors, destructors default * c++ C stl includes
2017-06-30Create a filesystem abstraction layer for CSM and only allow accessing files ↵red-001
that are scanned into it. (#5965) * Load client-side mods into memory before executing them. This removes the remaining filesystem access that client-sided mods had and it will hopefully make then more secure. * Lua Virtual filesystem: don't load the files into memory just scan the filenames into memory. * Fix the issues with backtrace * fix most of the issues * fix code style. * add a comment
2017-04-17Plug two minor Leaks (#5603)Auke Kok
* Resource leak: CHECK_FILE_ERR returns, without freeing chunk_name. Found with static analysis. * Resource leak: leaks `page` on error path. Found with static analysis.
2017-03-19Block access to the `io` libraryred-001
2017-03-13[CSM] Improve security for client-sided mods (#5100)red-001
2017-03-13[CSM] Client side moddingLoic Blot
* rename GameScripting to ServerScripting * Make getBuiltinLuaPath static serverside * Add on_shutdown callback * Add on_receiving_chat_message & on_sending_chat_message callbacks * ScriptApiBase: use IGameDef instead of Server This permits to share common attribute between client & server * Enable mod security in client side modding without conditions
2017-01-21Remove os.exit from the Lua secure sandbox (#5090)Loïc Blot
os.exit will exit not using proper resource liberation paths. Mods should call the proper exit mod using our API
2016-12-20Security: Fix resolving of some relative pathsShadowNinja
Trying to resolve a path with RemoveRelativePathComponents that can't be resolved without leaving leading parent components (e.g. "../worlds/foo" or "bar/../../worlds/foo") will fail. To work around this, we leave the relative components and simply remove the trailing components one at a time, and bail out when we find a parent component. This will still fail for paths like "worlds/foo/noexist/../auth.txt" (the path before the last parent component must not exist), but this is fine since you won't be able to open a file with a path like that anyways (the O.S. will determine that the path doesn't exist. Try `cat /a/../etc/passwd`).
2016-12-20Mod security: Allow read-only access to all mod pathsShadowNinja
2016-11-24Fix secure io.linesShadowNinja
It used to drop all of the return values from the insecure version of the function.
2016-11-24Fix secure io.open without modeShadowNinja
2016-11-05Fix memory leak in ::safeLoadFile (#4730)Zeno-
2016-08-10couple of memory leaks fixes.David Carlier
2016-05-30Remove unused code in s_security.cpp (#4172)Zeno-
Note that the macro CHECK_FILE_ERR implements the code removed
2016-03-03Remove debug.getupvalue from the Lua sandbox whitelistShadowNinja
This function could be used to steal insecure environments from trusted mods.
2015-08-27Use numeric indices and raw table access with LUA_REGISTRYINDEXKahrl
2015-06-12dofile error reporting for syntax errorsest31
According to doc, dofile() raises an error when parsing failed due to syntax errors. Fixes #2775
2015-05-22Fix Windows build, clean up included headersSmallJoker
Also fix a startup error caused by s_security.cpp
2015-05-16Add mod securityShadowNinja
Due to compatibility concerns, this is temporarily disabled.