on the way to making the modifications necessary to create a
capabilities-based restricted execution system. The idea is to strip out
any part of RestrictedPython that's not necessary for doing capabilities
and do all security using just capabilities.
The basic idea behind capabilities is that you don't give any piece of
code you don't trust a reference to something you don't want it to have
access to. You use proxies instead (E calls them "facets").
In order to be able to allow untrusted code to create proxy objects, I
needed to be able to store a reference to the proxied object in a
private attribute.
To create private attributes, I'm using "name mangling," where names
beginning with X_ within a class definition get changed to
_<uuid>_<name>, where the UUID is the same for that class. The UUIDs
don't need to be secure because it's not actually possible to create
your own name starting with an underscore in RestrictedPython; they just
need to be unique across all compiler invocations.
The nice thing about using this name mangling is that it's only done at
compile time and doesn't affect runtime performance. An interesting side
effect is that code defined on a class can access private attributes on
all descendants of that class, but only ones that are defined by other
code on that class, so this isn't a security issue.
I was thinking I needed read-only attributes to be able to avoid
untrusted code's being able to sabotage the revoke method on a proxy
object, but I'm thinking that just keeping around a reference to the
revoke method in the original code may be enough.
Does anyone think I'm going in completely the wrong direction here? Am I
missing anything obvious?
From http Sat Jan 3 10:09:04 2004
From: http (Paul Rubin)
Date: 03 Jan 2004 01:09:04 -0800
Subject: Creating a capabilities-based restricted execution system
References: <LmmdnUn4seDeGWuiXTWc-w@speakeasy.net>
Message-ID: <7xznd58klr.fsf@ruckus.brouhaha.com>
"Sean R. Lynch" <seanl at chaosring.org> writes:
Does anyone think I'm going in completely the wrong direction here? Am
I missing anything obvious?
Well, I have a dumb question. Have you studied the security failuresI missing anything obvious?
of rexec/Bastion and convinced yourself that they don't happen to your
new scheme?
You might look at the PyPy architecture doc if you haven't yet.
Making a separate object space for restricted objects may fit PyPy's
design quite naturally.
