Skip to main content

Make your code extrasafe by preventing it from calling unneeded syscalls

Project description

PyExtraSafe

GitHub Workflow Status Documentation Status PyPI Python >= 3.8 OS: Linux License

PyExtraSafe is a library that makes it easy to improve your program’s security by selectively allowing the syscalls it can perform via the Linux kernel’s seccomp facilities.

The python library is a shallow wrapper around extrasafe.

Quick Example

from threading import Thread
import pyextrasafe

try:
    thread = Thread(target=print, args=["Hello, world!"])
    thread.start()
    thread.join()
except Exception:
    print("Could not run Thread (should have been able!)")

pyextrasafe.SafetyContext().enable(
    pyextrasafe.BasicCapabilities(),
    pyextrasafe.SystemIO().allow_stdout().allow_stderr(),
).apply_to_all_threads()

try:
    thread = Thread(target=print, args=["Hello, world!"])
    thread.start()
    thread.join()
except Exception:
    print("Could not run Thread (that's good!)")
else:
    raise Exception("Should not have been able to run thread")

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

pyextrasafe-0.0.0a1.tar.gz (18.9 kB view hashes)

Uploaded Source

Built Distributions

pyextrasafe-0.0.0a1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (324.7 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pyextrasafe-0.0.0a1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (325.1 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pyextrasafe-0.0.0a1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (324.5 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

pyextrasafe-0.0.0a1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (324.5 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

pyextrasafe-0.0.0a1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (324.4 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pyextrasafe-0.0.0a1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (324.3 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

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