Security model¶
A registry root is trusted code¶
maina hardens the path from a manifest to a running process — the github
backend verifies an optional per-platform sha256 digest (opt-in: an asset
with no sha256: entry installs with TLS integrity only, not a pinned
digest), enforces HTTPS with a redirect-host allowlist, caps download and
decompression size, and validates archive members; npm runs with
--ignore-scripts and an anchored package.json by default (install.allow_scripts: true opts a manifest into running install/postinstall
lifecycle scripts); the manifest schema rejects .., absolute paths, and
shell metacharacters in every value that reaches a path or an argv token.
None of that makes a registry directory safe to point at untrusted content. A directory you register can:
- ship a
parsers/*.pymodule, which maina imports and executes in-process with no sandbox (parser:in a manifest, orparsers_dirs=); - declare an
install:block that downloads and runs a binary; - declare
install: {backend: script, entry: ...}, whichchmod +x's and runs a file (or a directory-selected file) straight from the registry — no download, no checksum, weaker than even the unsignedgithub/npmpath; - set an
env:block on the tool subprocess, includingLD_PRELOAD/DYLD_INSERT_LIBRARIES.
So registering a directory is equivalent to trusting the code in it. Treat
register(rt, registry_dirs=[...]), $MAINA_REGISTRY, and
Runtime.preferred(discover=True) the way you would treat adding a directory to
PYTHONPATH or installing a package.
Practical guidance¶
- Vendor your catalog. Keep manifests (and their
parsers//scripts/) in your own repository or a package you publish, reviewed like any other code. Runtime.preferred()reads$MAINA_REGISTRYby default. Passuse_env=Falsewhen building aRuntimeinside a library or a service that should not inherit an operator's environment.discover=Trueloads every installed package that publishes amaina.registriesentry point. Only enable it in an environment whose installed packages you control.env_allow=[...]onrun()trims the environment handed to the tool and to install-phase subprocesses toESSENTIAL_ENVplus the keys you name — use it to keep credentials out of third-party binaries. The full essential set is inmaina/core/envfilter.py; it includesPATH,HOME, locale, temp dirs, the platform's shared-library and CA-bundle variables, andHTTP(S)_PROXY/NO_PROXY.- A manifest's own
env:block is always forwarded and can overridePATH; only put non-secret configuration there. MAINA_ALLOW_MISE_BOOTSTRAP=1is the single highest-risk opt-in in the installer layer: with it set, arequires:runtime pin (or anynpmtool) that mise doesn't already provide fetcheshttps://mise.runover HTTPS and pipes it intosh. The pinnedMISE_VERSIONfixes which mise release that script installs, but the script's own content is not checksummed or signed. Leave the variable unset unless you have already decided to trustmise.run— without it, provisioning fails closed withRuntimeProvisionErrorinstead.