3 deleted 4 characters in body
source | link

TL;DR Use a chroot/jail and run as a custom user without any privileges.

The best practice for executing untrusted code is to segregate it via a system sandbox. For the most security:

  • create a container with only has Python and it's dependencies and the container's dependencies
  • create a container without all devices that aren't absolutely necessary (ie. network and storage)
  • create a container with restrictions on memory and process usage
  • recreate the container with every run (or at the very least with each unique user and max time period)
  • run as a user with the least privilege needed
  • run as a user that doesn't have the permissions to write files

You also follow standard practices for running things securely in a chroot. You can rebuild the chroot's filesystem with each call as well is particularly paranoid. Typically you just make user unable to make modifications to the filesystem the chroot runs in.

TL;DR Use a chroot/jail and run as a custom user without any privileges.

The best practice for executing untrusted code is to segregate it via a system sandbox. For the most security:

  • create a container with only has Python and it's dependencies and the container's dependencies
  • create a container without all devices that aren't absolutely necessary (ie. network and storage)
  • create a container with restrictions on memory and process usage
  • recreate the container with every run (or at the very least with each unique user and max time period)
  • run as a user with the least privilege needed
  • run as a user that doesn't have the permissions to write files

You also follow standard practices for running things securely in a chroot. You can rebuild the chroot's filesystem with each call as well is particularly paranoid. Typically you just make user unable to make modifications to the filesystem the chroot runs in.

TL;DR Use a chroot/jail and run as a custom user without any privileges.

The best practice for executing untrusted code is to segregate it via a system sandbox. For the most security:

  • create a container with only Python and it's dependencies and the container's dependencies
  • create a container without all devices that aren't absolutely necessary (ie. network and storage)
  • create a container with restrictions on memory and process usage
  • recreate the container with every run (or at the very least with each unique user and max time period)
  • run as a user with the least privilege needed
  • run as a user that doesn't have the permissions to write files

You also follow standard practices for running things securely in a chroot. You can rebuild the chroot's filesystem with each call as well is particularly paranoid. Typically you just make user unable to make modifications to the filesystem the chroot runs in.

2 deleted 24 characters in body
source | link

TL;DR Use a chroot/jail and run as a custom user without any privileges.

The best practice for executing untrusted code is to segregate it via a system sandbox. For the most security:

  • create a container with only has Python and it's dependencies and the container's dependencies
  • create a container without all devices that aren't absolutely necessary (ie. network and storage)
  • create a container with restrictions on memory and process usage
  • recreate the container with every run (or at the very least with each unique user and max time period)
  • run as a user with the least privilege needed
  • run as a user that doesn't have the permissions to write files

This isn't actually all that difficult to do especially if you use a template container and a memory filesystem. YouYou also follow standard practices for running things securely in a chroot. You can rebuild the chroot's filesystem with each call as well is particularly paranoid. Typically you just make user unable to make modifications to the filesystem the chroot runs in.

TL;DR Use a chroot/jail and run as a custom user without any privileges.

The best practice for executing untrusted code is to segregate it via a system sandbox. For the most security:

  • create a container with only has Python and it's dependencies and the container's dependencies
  • create a container without all devices that aren't absolutely necessary (ie. network and storage)
  • create a container with restrictions on memory and process usage
  • recreate the container with every run (or at the very least with each unique user and max time period)
  • run as a user with the least privilege needed
  • run as a user that doesn't have the permissions to write files

This isn't actually all that difficult to do especially if you use a template container and a memory filesystem. You also follow standard practices for running things securely in a chroot.

TL;DR Use a chroot/jail and run as a custom user without any privileges.

The best practice for executing untrusted code is to segregate it via a system sandbox. For the most security:

  • create a container with only has Python and it's dependencies and the container's dependencies
  • create a container without all devices that aren't absolutely necessary (ie. network and storage)
  • create a container with restrictions on memory and process usage
  • recreate the container with every run (or at the very least with each unique user and max time period)
  • run as a user with the least privilege needed
  • run as a user that doesn't have the permissions to write files

You also follow standard practices for running things securely in a chroot. You can rebuild the chroot's filesystem with each call as well is particularly paranoid. Typically you just make user unable to make modifications to the filesystem the chroot runs in.

1
source | link

TL;DR Use a chroot/jail and run as a custom user without any privileges.

The best practice for executing untrusted code is to segregate it via a system sandbox. For the most security:

  • create a container with only has Python and it's dependencies and the container's dependencies
  • create a container without all devices that aren't absolutely necessary (ie. network and storage)
  • create a container with restrictions on memory and process usage
  • recreate the container with every run (or at the very least with each unique user and max time period)
  • run as a user with the least privilege needed
  • run as a user that doesn't have the permissions to write files

This isn't actually all that difficult to do especially if you use a template container and a memory filesystem. You also follow standard practices for running things securely in a chroot.