All Projects → zopefoundation → Restrictedpython

zopefoundation / Restrictedpython

Licence: other
A restricted execution environment for Python to run untrusted code.

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Restrictedpython

Guide To Staying Productive
If you're looking for ways to stay motivated and focused, while still having fun, this guide is for you! Contributions and any kind of improvements are very welcome!
Stars: ✭ 116 (-28.83%)
Mutual labels:  code
Easy slam tutorial
首个中文的简单从零开始实现视觉SLAM理论与实践教程,使用Python实现。包括:ORB特征点提取,对极几何,视觉里程计后端优化,实时三维重建地图。A easy SLAM practical tutorial (Python).图像处理、otsu二值化。更多其他教程我的CSDN博客
Stars: ✭ 137 (-15.95%)
Mutual labels:  code
Ssti Payloads
🎯 Server Side Template Injection Payloads
Stars: ✭ 150 (-7.98%)
Mutual labels:  code
White
The Black code formatter, but brighter (PEP8–inspired).
Stars: ✭ 120 (-26.38%)
Mutual labels:  code
Beginners C Program Examples
Simple, Short and Sweet beginners friendly C language programs
Stars: ✭ 138 (-15.34%)
Mutual labels:  code
Go Ethereum Code Analysis
No description or website provided.
Stars: ✭ 2,032 (+1146.63%)
Mutual labels:  code
Syntaxmeets
Syntaxmeets. Create rooms 🏠 Call your friends 👬🏼 Sip Chai, ☕ Chat, Create, and Code👨‍💻. A coding platform to code simultaneously 🚀 with your friends and design your algorithms on SyntaxPad.💫✨
Stars: ✭ 110 (-32.52%)
Mutual labels:  code
Aura Theme
💅 A beautiful dark theme for your favorite apps.
Stars: ✭ 159 (-2.45%)
Mutual labels:  code
Curso Refatoracao Para Js Funcional
📈 Refatorar eh vida!
Stars: ✭ 137 (-15.95%)
Mutual labels:  code
Designpatternsincsharp
Samples associated with Pluralsight design patterns in c# courses.
Stars: ✭ 149 (-8.59%)
Mutual labels:  code
Cc
代码库 & Blog
Stars: ✭ 1,581 (+869.94%)
Mutual labels:  code
Tendermint code analysis
通用区块链平台tendermint源码分析
Stars: ✭ 134 (-17.79%)
Mutual labels:  code
Zxinglite
🔥 ZXing的精简版,优化扫码和生成二维码/条形码,内置闪光灯等功能。扫描风格支持:微信的线条样式,支付宝的网格样式。几句代码轻松拥有扫码功能 ,ZXingLite让集成更简单。(扫码识别速度快如微信)
Stars: ✭ 2,117 (+1198.77%)
Mutual labels:  code
Quick uicode
generate unity ui code quickly by editor(通过编辑器快速生成ui代码)
Stars: ✭ 119 (-26.99%)
Mutual labels:  code
Swiftcolorgen
A tool that generate code for Swift projects, designed to improve the maintainability of UIColors
Stars: ✭ 152 (-6.75%)
Mutual labels:  code
Bertqa Attention On Steroids
BertQA - Attention on Steroids
Stars: ✭ 112 (-31.29%)
Mutual labels:  code
Illacceptanything
The project where literally anything* goes.
Stars: ✭ 1,756 (+977.3%)
Mutual labels:  code
Pervane
Plain text file based note taking and knowledge base building tool, markdown editor, simple browser IDE.
Stars: ✭ 159 (-2.45%)
Mutual labels:  code
Book Open Source Tips
Open Source book on Open Source Tips
Stars: ✭ 152 (-6.75%)
Mutual labels:  code
Awesome Denoise
All latest image/burst/video Denoising papers with code & citation published in top conference and journal.
Stars: ✭ 145 (-11.04%)
Mutual labels:  code

.. image:: https://api.travis-ci.com/zopefoundation/RestrictedPython.svg?branch=master :target: https://travis-ci.com/zopefoundation/RestrictedPython

.. image:: https://coveralls.io/repos/github/zopefoundation/RestrictedPython/badge.svg?branch=master :target: https://coveralls.io/github/zopefoundation/RestrictedPython?branch=master

.. image:: https://readthedocs.org/projects/restrictedpython/badge/ :target: https://restrictedpython.readthedocs.org/ :alt: Documentation Status

.. image:: https://img.shields.io/pypi/v/RestrictedPython.svg :target: https://pypi.org/project/RestrictedPython/ :alt: Current version on PyPI

.. image:: https://img.shields.io/pypi/pyversions/RestrictedPython.svg :target: https://pypi.org/project/RestrictedPython/ :alt: Supported Python versions

.. image:: https://github.com/zopefoundation/RestrictedPython/raw/master/docs/logo.jpg

================ RestrictedPython

RestrictedPython is a tool that helps to define a subset of the Python language which allows to provide a program input into a trusted environment. RestrictedPython is not a sandbox system or a secured environment, but it helps to define a trusted environment and execute untrusted code inside of it.

.. warning::

RestrictedPython only supports CPython. It does not support PyPy and other Python implementations as it cannot provide its restrictions there.

For full documentation please see http://restrictedpython.readthedocs.io/.

Example

To give a basic understanding what RestrictedPython does here two examples:

An unproblematic code example

Python allows you to execute a large set of commands. This would not harm any system.

.. code-block:: pycon

>>> from RestrictedPython import compile_restricted
>>> from RestrictedPython import safe_globals
>>>
>>> source_code = """
... def example():
...     return 'Hello World!'
... """
>>>
>>> loc = {}
>>> byte_code = compile_restricted(source_code, '<inline>', 'exec')
>>> exec(byte_code, safe_globals, loc)
>>>
>>> loc['example']()
'Hello World!'

Problematic code example

This example directly executed in Python could harm your system.

.. code-block:: pycon

>>> from RestrictedPython import compile_restricted
>>> from RestrictedPython import safe_globals
>>>
>>> source_code = """
... import os
...
... os.listdir('/')
... """
>>> byte_code = compile_restricted(source_code, '<inline>', 'exec')
>>> exec(byte_code, safe_globals, {})
Traceback (most recent call last):
ImportError: __import__ not found
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].