Restricted Access

I

iapain

Do you have an IBM s/370 running VM/CMS? VM was sort of an OS for
running multiple OSs, so it would be the "restricted environment" <G>

I'm having currently working on OS/2 and Linux platform, I've designed
a web based ide for python and i wish to restrict some commands and
user can only access i.e rwx in his folder.

Best!
 
M

Maric Michaud

Le mercredi 12 juillet 2006 08:17, iapain a écrit :
I'm having currently working on OS/2 and Linux platform, I've designed
a web based ide for python and i wish to restrict some commands

There is a restricted environment in Zope for TTW python scripts and
ZPT/DTML .

These scripts are run in the Zope process in a very restricted environment
which forbid the use of most builtins and allow the import of a limited list
of modules.

Why don't use the RestrictedPython module from Zope (2.8 and up) and adapt it
a bit. It seems loose coupled to the Zope internals (except for the
multimapping class which is an extension class, but I doubt it's really a
problem). It shouldn't be a too hard.

You'll need to make your own AccessControl/ZopeGuards.py-like module, and
probably subclass the RestrictionMutator to enable/disable certain
functionnality (interdiction of names beginning by '_' for example is hard
coded).
At last, you will get a simple example of the usage of the whole beast from
your own interpreter in Products/PythonScripts.

and
user can only access i.e rwx in his folder.

This should be possible by providing a wrapper function for file and open (see
the Guards.py module).

IMO, it worth to be tried, and I don't see any other short-term, less hacky,
solution.

regards,

--
_____________

Maric Michaud
_____________

Aristote - www.aristote.info
3 place des tapis
69004 Lyon
Tel: +33 426 880 097
 
I

iapain

You'll need to make your own AccessControl/ZopeGuards.py-like module, and
probably subclass the RestrictionMutator to enable/disable certain
functionnality (interdiction of names beginning by '_' for example is hard
coded).

Your reply is pretty hopeful, I saw that one, its the only fractional
part. I'm agree with others that I need to setup a safe runtime
enviornment rather than detecting harmful code.
This should be possible by providing a wrapper function for file and open (see
the Guards.py module).

Thats a nice idea, I guess it should work. I should try it really
quick! Thanks!

Best!
iapain
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top