[MUD-Dev] Python script as stand alone MUD server...

Zach Collins {Siege} zcollins at seidata.com
Wed Jan 28 01:43:02 CET 2004

On Tue, 27 Jan 2004, Thomas Clive Richards wrote:

> I'm on the once project (http://sourceforge.net/projects/once). We
> considered using python as a scripting language (our core code is
> written in C++), but decided against it, because python cannot be
> sandboxed easily. This is especially important if you're going to
> allow third party scripts to run on the server. Even if you're
> server is going to be as secure as possible, it's still a good
> idea to restrict which system calls your scripts can call....

My own solution to this dilemma was to start designing a
mini-language in which the stack is the primary object.  The
mini-language interpreter will then build Python scripts using Stack
classes, tossing out any code it doesn't recognize (which includes
anything potentially compromising, since I'm only interested in the
MUD's own data and internal commands).

This means I'll have to deal with the internals of module importing
(since 'import foo' means 'import a module named foo.py' and not
'import the contents of variable foo') and also that preprocessing
will take noticeable time.  But once the scripts are rewritten, I
get the benefits of importing true, reloadable Python modules which
are written to be as secure as I can make them be.  This includes
flags and limiters in my Stack class which allow only a certain
number of operations to be performed as well as utilising
permissions checking available in the surrounding game engine, thus
providing for multiple levels of coders.

This may be fairly complex, but I'm sure it's no worse than many
coders of social MUDs have come up against before.  In any case,
it's just one approach, and not necessarily the best; if others have
suggestions, please let me know.

Zach Collins
MUD-Dev mailing list
MUD-Dev at kanga.nu

More information about the mud-dev-archive mailing list