Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #91438

Re: Creating a reliable sandboxed Python environment

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'string.': 0.04; 'subject:Python': 0.05; 'encode': 0.09; 'integers': 0.09; 'objects.': 0.09; 'tends': 0.09; 'cc:addr:python-list': 0.10; 'python': 0.11; 'python.': 0.11; 'bouncing': 0.16; 'decode': 0.16; 'ecosystem.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'happily': 0.16; 'integers,': 0.16; 'text?': 0.16; 'unicode?': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; 'string': 0.17; 'byte': 0.18; 'integer': 0.18; "shouldn't": 0.18; 'stefan': 0.18; 'language': 0.19; '>>>': 0.20; 'handling': 0.20; 'otherwise,': 0.20; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; 'embedding': 0.22; 'features,': 0.22; 'defined': 0.23; 'bit': 0.23; '2015': 0.23; "python's": 0.23; 'header:In-Reply-To:1': 0.24; 'somewhere': 0.24; 'chris': 0.26; '(e.g.': 0.27; 'cool': 0.27; 'message-id:@mail.gmail.com': 0.28; "doesn't": 0.28; 'rest': 0.28; 'skip:( 20': 0.28; 'noticed': 0.29; 'interface': 0.29; 'looks': 0.29; 'cases.': 0.29; 'operators': 0.29; 'strings,': 0.29; 'objects': 0.29; 'fri,': 0.31; 'code': 0.31; 'embedded': 0.32; 'point': 0.33; 'usually': 0.33; 'though.': 0.33; 'case,': 0.34; 'previous': 0.34; 'received:google.com': 0.34; 'gives': 0.35; 'could': 0.35; 'i.e.': 0.35; 'unicode': 0.35; 'something': 0.35; 'comment': 0.35; 'handle': 0.36; 'but': 0.36; '(and': 0.36; 'subject:: ': 0.37; 'support,': 0.37; 'is,': 0.38; 'supports': 0.38; 'pm,': 0.39; 'enough': 0.39; 'where': 0.40; 'why': 0.40; 'your': 0.60; 'even': 0.61; "you'll": 0.61; 'improved': 0.63; 'you.': 0.64; 'within': 0.64; 'stand': 0.64; 'here': 0.66; 'price': 0.68; 'steady': 0.72; 'lose': 0.76; '*lot*': 0.84; 'chrisa': 0.84; 'float,': 0.84; 'overloading': 0.84; 'weaker': 0.84; 'to:none': 0.90; 'ask,': 0.91; 'dare': 0.91; 'hassle': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=05M1PZfqxKaiFBwaHgBKYhcbUfUPRMHphWHtF2pKkNs=; b=c2B5pKyky1EIYhvsp9g7koLo6aw3ROxw2Iu1g+OkYV/hogWOsME0AXHJSOKyT5Cgey 6ykPLSqXhu/21QToOX3u5iTnZBoyeviXib1tf43WXPDcYmtz6YsP2XLLq7id0e/76hrB EGn7Ty8nbexOvxK+xCVpuFXd2yROjkhkqdUcGfjfs4UwwZKViFmblJKm2/wXBjScCLR4 gFjAOQuBYZrHOyHjJ/DPiAzp8O6LwB32yBxjguYYwgp9U4UUvPUfKPZRmLsudvwwjDBo q9LBztOhcASnvMANkZ/3a7xex5Gwy036q9edISIdpu618rACUWlwAguPCGT/5QTkJ5Pm 9f+Q==
MIME-Version 1.0
X-Received by 10.42.154.65 with SMTP id p1mr392566icw.26.1432892301347; Fri, 29 May 2015 02:38:21 -0700 (PDT)
In-Reply-To <mk9b65$rp6$1@ger.gmane.org>
References <60b424a2-2273-42b2-b60c-92656af0afa5@googlegroups.com> <mk7ng1$uq3$1@ger.gmane.org> <CAPTjJmpC40fLdmGvMqCGtt82O5QWzNGyHnSGgiX_mNrz3O_LdA@mail.gmail.com> <mk90bq$dn4$1@ger.gmane.org> <CAPTjJmrYQtT3TbCHL7ss8nq4JTszuDDc07uPdHOUkiAczVu_+w@mail.gmail.com> <mk9b65$rp6$1@ger.gmane.org>
Date Fri, 29 May 2015 19:38:21 +1000
Subject Re: Creating a reliable sandboxed Python environment
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.165.1432892304.5151.python-list@python.org> (permalink)
Lines 45
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1432892304 news.xs4all.nl 2933 [2001:888:2000:d::a6]:59789
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:91438

Show key headers only | View raw


On Fri, May 29, 2015 at 7:23 PM, Stefan Behnel <stefan_ml@behnel.de> wrote:
> Chris Angelico schrieb am 29.05.2015 um 09:41:
>> On Fri, May 29, 2015 at 4:18 PM, Stefan Behnel wrote:
>>>> Lua's a much weaker language than Python is, though. Can it handle
>>>> arbitrary-precision integers? Unicode? Dare I even ask,
>>>> arbitrary-precision rationals (fractions.Fraction)?
>>>
>>> All of those and way more, as long as you use it embedded in Python.
>>
>> Okay, so how would you go about using Lua-embedded-in-Python to
>> manipulate Unicode text?
>
> Lua only supports byte strings, so Lupa will encode and decode them for
> you. If that's not enough, you'll have to work with Python Unicode string
> objects through the language interface. (And I just noticed that the
> handling can be improved here by overloading Lua operators with Python
> operators - not currently implemented.)
>
>
>> Looks to me as if Lua doesn't have integers at all
>
> The standard number type in Lua is a C double float, i.e. the steady
> integer range is somewhere within +/-2^53. That tends to be enough for a
> *lot* of use cases. You could change that type in the Lua C code (e.g. to a
> 64 bit int), but that's usually a bad idea. The same comment as above
> applies: if you need Python object features, use Python objects.

Unicode strings shouldn't involve the hassle of bouncing through an
interface layer. Nobody will bother, and the result will be code
that's ASCII-only. That happens often enough even in Python 2, where
u"foo" is a Unicode string.

> Embedding Lua in Python gives you access to all of Python's objects and
> ecosystem. It may not always be as cool to use as from Python, but in that
> case, why not code it in Python in the first place? You wouldn't use
> Lua/Lupa to write whole applications, just the user defined parts of them.
> The rest can happily remain in Python. And should, for your own sanity.

The point was to sandbox something inside Python. Otherwise, yes, just
write it in Python. But if you do have to sandbox like this, you lose
language-level Unicode support, language-level arbitrary precision
integers, etcetera, etcetera, etcetera. So I stand by my previous
statement: The price of security is functionality.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Creating a reliable sandboxed Python environment davidfstr@gmail.com - 2015-05-25 19:24 -0700
  Re: Creating a reliable sandboxed Python environment Chris Angelico <rosuav@gmail.com> - 2015-05-26 12:44 +1000
  Re: Creating a reliable sandboxed Python environment Paul Rubin <no.email@nospam.invalid> - 2015-05-25 23:17 -0700
  Re: Creating a reliable sandboxed Python environment Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-26 17:10 +1000
    Re: Creating a reliable sandboxed Python environment Laura Creighton <lac@openend.se> - 2015-05-26 09:53 +0200
    Re: Creating a reliable sandboxed Python environment Laura Creighton <lac@openend.se> - 2015-05-26 10:02 +0200
  Re: Creating a reliable sandboxed Python environment Ned Batchelder <ned@nedbatchelder.com> - 2015-05-26 03:21 -0700
  Re: Creating a reliable sandboxed Python environment marco.nawijn@colosso.nl - 2015-05-26 05:01 -0700
  Re: Creating a reliable sandboxed Python environment davidfstr@gmail.com - 2015-05-28 09:34 -0700
    Re: Creating a reliable sandboxed Python environment Paul Rubin <no.email@nospam.invalid> - 2015-05-30 20:13 -0700
  Re: Creating a reliable sandboxed Python environment Stefan Behnel <stefan_ml@behnel.de> - 2015-05-28 20:41 +0200
  Re: Creating a reliable sandboxed Python environment Chris Angelico <rosuav@gmail.com> - 2015-05-29 04:51 +1000
    Re: Creating a reliable sandboxed Python environment Paul Rubin <no.email@nospam.invalid> - 2015-05-29 11:30 -0700
      Re: Creating a reliable sandboxed Python environment Marko Rauhamaa <marko@pacujo.net> - 2015-05-29 22:12 +0300
        Re: Creating a reliable sandboxed Python environment Paul Rubin <no.email@nospam.invalid> - 2015-05-29 13:15 -0700
  Re: Creating a reliable sandboxed Python environment Stefan Behnel <stefan_ml@behnel.de> - 2015-05-29 08:18 +0200
  Re: Creating a reliable sandboxed Python environment Chris Angelico <rosuav@gmail.com> - 2015-05-29 17:41 +1000
    Re: Creating a reliable sandboxed Python environment Paul Rubin <no.email@nospam.invalid> - 2015-05-29 11:33 -0700
      Re: Creating a reliable sandboxed Python environment Chris Angelico <rosuav@gmail.com> - 2015-05-30 08:49 +1000
        Re: Creating a reliable sandboxed Python environment Paul Rubin <no.email@nospam.invalid> - 2015-05-29 18:28 -0700
          Re: Creating a reliable sandboxed Python environment Chris Angelico <rosuav@gmail.com> - 2015-05-30 12:42 +1000
            Re: Creating a reliable sandboxed Python environment Paul Rubin <no.email@nospam.invalid> - 2015-05-29 21:48 -0700
              Re: Creating a reliable sandboxed Python environment Steven D'Aprano <steve@pearwood.info> - 2015-05-30 19:00 +1000
                Re: Creating a reliable sandboxed Python environment Laura Creighton <lac@openend.se> - 2015-05-30 13:24 +0200
                Re: Creating a reliable sandboxed Python environment Steven D'Aprano <steve@pearwood.info> - 2015-05-31 09:52 +1000
                Re: Creating a reliable sandboxed Python environment Modulok <modulok@gmail.com> - 2015-05-30 19:08 -0600
                Re: Creating a reliable sandboxed Python environment Laura Creighton <lac@openend.se> - 2015-05-31 08:14 +0200
                Re: Creating a reliable sandboxed Python environment Stefan Behnel <stefan_ml@behnel.de> - 2015-05-30 20:42 +0200
                Re: Creating a reliable sandboxed Python environment Paul Rubin <no.email@nospam.invalid> - 2015-05-30 13:00 -0700
                Re: Creating a reliable sandboxed Python environment Chris Angelico <rosuav@gmail.com> - 2015-05-31 08:20 +1000
                Re: Creating a reliable sandboxed Python environment Paul Rubin <no.email@nospam.invalid> - 2015-05-30 15:36 -0700
                Re: Creating a reliable sandboxed Python environment Laura Creighton <lac@openend.se> - 2015-05-30 22:54 +0200
        Re: Creating a reliable sandboxed Python environment BartC <bc@freeuk.com> - 2015-05-30 13:06 +0100
          Re: Creating a reliable sandboxed Python environment Chris Angelico <rosuav@gmail.com> - 2015-05-30 22:37 +1000
  Re: Creating a reliable sandboxed Python environment Stefan Behnel <stefan_ml@behnel.de> - 2015-05-29 11:23 +0200
  Re: Creating a reliable sandboxed Python environment Chris Angelico <rosuav@gmail.com> - 2015-05-29 19:38 +1000
  Re: Creating a reliable sandboxed Python environment Laura Creighton <lac@openend.se> - 2015-05-29 11:56 +0200

csiph-web