Skip to main content

Binding for the OpenBSD pledge(2) system call

Project description

Prototype

def pledge(promises: Iterable[str]) -> None: pass

Throws OSError if the platform does not support pledge(2), and PermissionError if the pledge fails.

Example

The following will restrict the current process to only the stdio and tty promises, and then attempt to violate that restriction:

import pypledge
pypledge.pledge(['stdio', 'tty'])
f = open('foo.txt')

On OpenBSD 5.9, this will terminate with SIGABRT because the rpath promise was required.

On other platforms, OSError will be thrown.

Todo

pledge(2) currently always returns EINVAL if given a paths whitelist. Support for this feature will be added to pypledge once it becomes available in a stable OpenBSD release.

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

pypledge-0.1.tar.gz (1.4 kB view hashes)

Uploaded Source

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