Crates.io | rink-sandbox |
lib.rs | rink-sandbox |
version | 0.6.1 |
source | src |
created_at | 2021-06-06 01:38:18.632598 |
updated_at | 2021-06-06 01:38:18.632598 |
description | Library for limiting memory usage and time spent of code, and allowing interrupts (ctrl+C). |
homepage | https://rinkcalc.app |
repository | https://github.com/tiffany352/rink-rs |
max_upload_size | |
id | 406704 |
size | 51,516 |
Rink-sandbox was designed to sandbox Rink queries (which can take arbitrarily large memory/time). Rink's syntax does not expose any type of IO, so a full security sandbox is not required.
This crate supports Windows, macOS, and Linux.
This crate was designed with some effort to making it general purpose for other types of applications, but it may not perfectly match some usecases.
Rink-sandbox is a crate for running app code in a contained environment, specifically:
This is achieved by running tasks in a child process. Memory is limited
using #[global_allocator]
. Execution time is limited using a simple
timeout, rather than relying on OS scheduler-level timing.
There's no platform specific code in this crate, this is handled by other dependencies. Unsafe code is limited to only the allocator, where it's required.
Messages are serialized using bincode and sent through the child process's stdin/stdout channels for best portability.
log
instead of println
.