473,387 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Need help with restricting number of new objects a user script can create

vj
I'm building a large infrastructure with about 30 servers (all running
linux). I allow my end users to write scripts which then get broken
down in smaller parts and run across the 30 servers. The results from
each individual run are combined and presented back to the user.

I'm currently using pylint to restrict access to many things and make
the code a little more 'safe'. (I understand that it is very
difficult, if not impossible, to make the code completely secure).
The problem I'm facing now is:

how do I restrict the user from (inadvertently or maliciously) creating
a large number of objects which will bring down the entire 100 nodes.

Some of the things which I have ruled out (due to application
architecture):
1. Running each process in its own unix process.

Current Options:
1. expose my own version of range and xrange
2. Have a sandbox where the user script is run on random data before
being pushed out to the all the servers.

Questions:
1. How can I restrict recursion for the user scripts?
2. How can I restrict list comprehension in the user script? How do I
disable user from doing [1]*10000000000000
4. Can I move the user scripting to some other language which can be
interfaced with python yet allow the "restricted" execution env.
4. Can I convert the user functions using some 'modified' variant of
pyrex which will give me more control?

Have other people faced similar problems? I would imagine this is a
common problem for anyone building distributed systems?

Python 3000:
Going forward this would be a really useful thing to see in python 3000
where a restricted exec env should be built in to the language from the
ground up.

Mar 22 '06 #1
3 1260
vj enlightened us with:
how do I restrict the user from (inadvertently or maliciously)
creating a large number of objects which will bring down the entire
100 nodes.


Use ulimit to give them a limited amount of CPU time, memory etc. The
kernel will then kill runaway processes.

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
Mar 22 '06 #2
vj
I think the only option is to come up with my own mini language.
Searching on google, I found several examples where people replaced
python with lua for scripting. Am reading up on lua and looks very
promissing. I also tried doing the following:

for i=1,100000000 do print(i) end

on:
http://doris.sourceforge.net/lua/weblua.php

and got the following error:

Lua script:

for i=1,100000000 do print(i) end

Run using lua generates:

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
allocate 35 bytes) in /home/groups/d/do/doris/htdocs/lua/weblua.php on
line 109

Very cool. I need to now find out if this error is being caught by the
lua script or the underlying os. There also seems to be a 2-way
lua-python bridge converted which will allow me to embed lua in my
applciation.

Mar 22 '06 #3
vj enlightened us with:
Run using lua generates:

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried
to allocate 35 bytes) in
/home/groups/d/do/doris/htdocs/lua/weblua.php on line 109


Ehm... this can also be done with Python & ulimit.

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
Mar 22 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bobby | last post by:
Hello everyone I have a question. The school I am working for is in the beginning process of having a webpage that will direct students to download there homework and be able to view there info...
2
by: Mike Button | last post by:
Hello all, I am really really desperate on what I should do, and I am asking for help from anyone in this newsgroup, here's the situation: I am creating a form that is being run on a server...
4
by: Brie_Manakul | last post by:
I need to set up an if else to show different weather scripts based on the city selection they choose. Any help on this would be great. Thanks! <%@ page language="java" import="java.util.*,...
3
by: sunbeam | last post by:
Short Description of the Project: we developed a e-learning system for our students. each student has a unique username/password to view the modules he/she should view and nothing more. since we...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.