Newsgroups: comp.lang.python
From: mario ruggier <mario.rugg...@gmail.com>
Date: Sat, 17 Jan 2009 05:09:13 -0800 (PST)
Local: Sat, Jan 17 2009 8:09 am
Subject: Re: List comprehension - NameError: name '_[1]' is not defined ?
On Jan 17, 12:04 am, ajaksu <aja...@gmail.com> wrote:
> On Jan 16, 3:45 pm, mario ruggier <mario.rugg...@gmail.com> wrote: OK, I can think of no good reson why anyone would want to do that from > > > '(x for x in ()).throw("bork")' > > What is the potential security risk with this one? > I don't see a concrete issue, just found it tempting... raising hand- within a temlate, so I'd be fine with blocking out any attribute whose name starts with "throw" to block this out. > > All the above attempts will be blocked this way. Any other disallow- The BOM stuff is interesting... from that discussion, I think it would > > sub-strings to add to the list above? > None that I know of, but I suggest testing with dir, globals, locals be also a good idea to blacklist "object" out of the restricted builtins. I played with this, and prepared a file template as well as a little script to run it... see below. To tweak any disallwoed builtins back into the restricted namespace d.set_on_globals("dir", dir) for each name you'd like to add, when setting up the domain (see To re-enable "__" lookups, you'd need to tweak the regexp above, in > This one fails in lots of interesting ways when you juggle keyword- Not sure what you mean... it just renders that source code file > args around: > exprs = [ > 'evoque("hmm", filters=[unicode.upper ] ,src="/etc/python2.5/ > site.py")', > ] uppercased (if it finds it as per the domain setup) ?!? Here's (a) a mini testing py2-py3 script, similar to previous one evoque_restricted_file_test.py # set the base for for the defualt collection # a restricted domain instance # Tweak domain.globals to add specific callables for testing: pr("domain", d.default_collection.dir, t = d.get_template(restricted_exprs.txt) restricted_exprs.txt Note: but when specified within a template here as: #[ Subversive variation: "()."+"_"*2+"class"+"_"*2+".mro() Attempt to "set" same subsersively built expr to a loop variable mario You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||