[Commits] [wesnoth/wesnoth] 701b18: Expose preferences to Lua

GitHub noreply at github.com
Tue Sep 20 18:11:19 UTC 2016


  Branch: refs/heads/expose-preferences-to-lua
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 701b1896707d09971b44fca90b341179c9da6e82
      https://github.com/wesnoth/wesnoth/commit/701b1896707d09971b44fca90b341179c9da6e82
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2016-09-20 (Tue, 20 Sep 2016)

  Changed paths:
    M changelog
    M projectfiles/VC12/wesnoth.vcxproj
    M projectfiles/VC12/wesnoth.vcxproj.filters
    M src/CMakeLists.txt
    M src/SConscript
    M src/scripting/lua_kernel_base.cpp
    A src/scripting/lua_preferences.cpp
    A src/scripting/lua_preferences.hpp

  Log Message:
  -----------
  Expose preferences to Lua


  Commit: b2c427f6a691738da8e25b7b68eff879c34746d2
      https://github.com/wesnoth/wesnoth/commit/b2c427f6a691738da8e25b7b68eff879c34746d2
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2016-09-20 (Tue, 20 Sep 2016)

  Changed paths:
    M changelog
    M src/scripting/application_lua_kernel.cpp
    M src/scripting/lua_kernel_base.cpp

  Log Message:
  -----------
  Restrict preference access to plugins

@gfgtdf pointed out that preferences contain MP passwords. We can't allow
untrusted code to access them. Since we only need preference access from
plugins for now, the simplest way to avoid security issues is to block Lua
code outside of plugins from accessing preferences at all.


  Commit: 460270baaf7d587ebe13ec7ab5b9684c81eba968
      https://github.com/wesnoth/wesnoth/commit/460270baaf7d587ebe13ec7ab5b9684c81eba968
  Author: Jyrki Vesterinen <sandgtx at gmail.com>
  Date:   2016-09-20 (Tue, 20 Sep 2016)

  Changed paths:
    M src/preferences.cpp
    M src/preferences.hpp
    M src/scripting/lua_preferences.cpp

  Log Message:
  -----------
  Address feedback

* Changed the plugin preference API to use luaW_pushscalar() and
luaW_toscalar() to handle preference values.
* Set the __metatable field in the "preferences" metatable, which blocks
Lua code from changing the metatable. @celticminstrel suggested setting the
field to a string, but I set it to a boolean instead. According to Lua
reference manual, __metatable prevents the metatable from being changed as
long as it's set, i.e. not nil.


Compare: https://github.com/wesnoth/wesnoth/compare/a6bbcfb2b5e2...460270baaf7d


More information about the Commits mailing list