Running code
Roles can write a Python script and run it, for work on files: renaming, sorting, converting, editing in bulk, counting and checking. The Lead in chat can too.
Always sandboxed
Section titled “Always sandboxed”Ombro doesn’t try to judge code by reading it, because a list of “dangerous commands” is easy to get round. Instead, every script runs in the operating system’s own sandbox, which limits what any code can reach:
- macOS: the built-in system sandbox, with a profile that denies everything it doesn’t name.
- Linux: bubblewrap. The script starts in an empty file system with no network.
- Anywhere the sandbox can’t be set up, code isn’t offered to the job, and the report says why. Code never runs unconfined.
What a script can and can’t reach
Section titled “What a script can and can’t reach”| Can | Can’t |
|---|---|
Read and write the job’s workspace/ and scratch/ |
Reach the network |
| Use shared folders, as shared (read or write) | Read your keys, settings, roles, memory or other jobs |
| Use Python’s standard library | Read the rest of your files |
| Start other programs, or delete the folders it works in |
Its environment holds no keys.
Limits
Section titled “Limits”| Limit | Default |
|---|---|
| Time per script | 60 seconds (never more than the job has left) |
| Memory | 1 GB |
| Any one file | 5 MB |
| Output shown to the role | 8,000 characters |
| Everything in the job’s folders | 2 GB |
| Scripts per job | 10 |
The role is told the exit status, the output and which files were created, changed or removed, worked out by Ombro.
Setting it up
Section titled “Setting it up”On macOS, nothing to do. On Linux, install bubblewrap:
sudo apt install bubblewrapCheck it works:
ombro sandboxOn some Ubuntu versions (24.04, for one) there’s a one-time step; ombro sandbox says so and gives the command. See Install on a server.
Where to look
Section titled “Where to look”Each script and its output are kept in the job’s code/ folder, which scripts can’t write to. The report has a Code section, and the journal a code_run event for each.