Skip to main content

A layer of protection for pythons eval

Project description


Cval logo

Cval

A layer of protection for eval
View Examples · Report Bug

Examples

Some examples focused purely on security rather then real world practical examples.

Disable module importing
cval(source='__import__("os")', modules=False)
Allow certain modules
cval(source='__import__("os")', modules=False, allowed_modules=["os"])
Disable function calls
cval(source=input(), calls=False)
Allow certain function calls
cval(source='print("Hello, World!")', calls=False, allowed_calls=["print"])
Block global variables
cval(source=input(), globals=globals(), gscope=False)
Block local variables
cval(source=input(), locals=locals(), lscope=False)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cval-0.0.3.tar.gz (16.7 kB view hashes)

Uploaded Source

Built Distribution

cval-0.0.3-py2.py3-none-any.whl (16.1 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page