GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docs.python.org — 30. Restricted Execution — Python 2.7.18 documentation
This document is for an old version of Python that is no longer supported.
You should upgrade and read the
Python documentation for the current stable release.
30. Restricted Execution¶Warning In Python 2.3 these modules have been disabled due to various known and not
readily fixable security holes. The modules are still documented here to help
in reading old code that uses the Restricted execution is the basic framework in Python that allows for the segregation of trusted and untrusted code. The framework is based on the notion that trusted Python code (a supervisor) can create a “padded cell’ (or environment) with limited permissions, and run the untrusted code within this cell. The untrusted code cannot break out of its cell, and can only interact with sensitive system resources through interfaces defined and managed by the trusted code. The term “restricted execution” is favored over “safe-Python” since true safety is hard to define, and is determined by the way the restricted environment is created. Note that the restricted environments can be nested, with inner cells creating subcells of lesser, but never greater, privilege. An interesting aspect of Python’s restricted execution model is that the
interfaces presented to untrusted code usually have the same names as those
presented to trusted code. Therefore no special interfaces need to be learned
to write code designed to run in a restricted environment. And because the
exact nature of the padded cell is determined by the supervisor, different
restrictions can be imposed, depending on the application. For example, it
might be deemed “safe” for untrusted code to read any file within a specified
directory, but never to write a file. In this case, the supervisor may redefine
the built-in The Python run-time determines whether a particular code block is executing in
restricted execution mode based on the identity of the Python code executing in restricted mode faces a number of limitations that are
designed to prevent it from escaping from the padded cell. For instance, the
function object attribute Two modules provide the framework for setting up restricted execution environments: See also
© Copyright 1990-2020, Python Software Foundation.
The Python Software Foundation is a non-profit corporation. Please donate. Last updated on Jun 19, 2020. Found a bug? Created using Sphinx 2.3.1. |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |