nodus-container
Container execution for Nodus workflows — launch a container, capture its result, without dropping back to bash.
from nodus_container import ContainerSpec, Mount, build_argv, run
spec = ContainerSpec(
image="alpine:3",
command=("echo", "hello"),
mounts=(Mount(source="/data", target="/data"),), # read-only by default
)
build_argv(spec)
# ['docker', 'run', '--rm', '-v', '/data:/data:ro', 'alpine:3', 'echo', 'hello']
run(spec, runner=...) executes it through a runner you supply — from Nodus,
that is std:subprocess.run. This package never imports a subprocess module.
Security: read this before granting it
This is an adapter over subprocess, and it declares no capability of its
own. A container capability would be unenforceable: anything holding
subprocess can already run docker directly, so a control beside it would be
bypassed by the permission the caller already has.
The enforceable boundary is allowed_commands:
NodusRuntime(allow_subprocess=True, allowed_commands=["docker"])
Withhold docker from that list and container execution is refused. Setting any
allowlist also refuses subprocess.shell, so sh -c "docker …" cannot step
around it.
What is still not bounded: -v /:/host escapes allowed_paths, and
--privileged exists. That is not a gap this package opens —
SECURITY_POSTURE.md §5
already records that a permitted subprocess's binary and arguments are
unrestricted — but this package makes it a one-liner, which is worth knowing
before you grant it. Mounts are read-only by default for that reason.
To restrict arguments, use a CapabilityPolicy: it receives the call's
arguments, and build_argv is pure so the argv a call would make can be
inspected before it runs.
Under nodus serve, check which nodus-lang you are on
The server's treatment of submitted code changed in #754, and the two behaviours are opposites:
-
Through nodus-lang 5.9.0, code sent to
POST /executeran with subprocess, network and environment access permitted, and no flag could restrict it. If you are on one of those releases, anything that can reach the port can rundocker— put the server behind something that authenticates, and treat this package's presence as incidental to that. -
After #754 ships, submitted code is denied those by default and the operator grants them:
nodus serve --auth-token "$TOKEN" --allow-subprocess --allowed-commands docker
The allowlist is the part worth typing. --allow-subprocess alone permits every
executable on the host.
Status
Published from the nodus-lang repository, where it is developed alongside the runtime rather than in a repository of its own.
Design and the capability argument in full: NODUS_CONTAINER.md. Issue: #85.
Metadata
Release files for nodus-container 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nodus_container-0.1.0.tar.gz | 8.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nodus_container-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.1 kB
Release files / nodus_container-0.1.0.tar.gz
| Download URL | nodus_container-0.1.0.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b51b4c78b6cda5abfbd5559c4db297fd7c58440652a794a026a8249959e2524d
|
|
BLAKE2b-256 checksum How to use checksums |
d0dd456a7ce2b2bee92a598438b57608529074c5df14713d994c5eb14710388f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Release files / nodus_container-0.1.0-py3-none-any.whl
| Download URL | nodus_container-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa5bb761fa10a17e51779ae44a1c261d97c24a4ecba45c94ce6a858747f98ec9
|
|
BLAKE2b-256 checksum How to use checksums |
0dfb0d501e9fba670818ca2b29873d892d9ae6f50a4f5ff8101bb0f317b0a074
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|