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.7 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.1.0a1.tar.gz (26.6 kB view hashes)

Uploaded Source

Built Distributions

pyextrasafe-0.1.0a1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (307.5 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pyextrasafe-0.1.0a1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (307.8 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pyextrasafe-0.1.0a1-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (309.2 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

pyextrasafe-0.1.0a1-cp37-abi3-musllinux_1_1_x86_64.whl (338.7 kB view hashes)

Uploaded CPython 3.7+ musllinux: musl 1.1+ x86-64

pyextrasafe-0.1.0a1-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (307.5 kB view hashes)

Uploaded CPython 3.7+ 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