Molt is built on the principle of Secure by Default. We treat Python as a high-level specification that is lowered into a hardened, capability-gated native runtime.
The Molt runtime and compiler are written in Rust with minimal, audited unsafe blocks (e.g., arena allocation and NaN-boxing internals), verified via tooling.
- No CPython C-extension ABI (yet): Molt does not ship a
Python.h-compatible ABI today; the primary path is alibmoltC-API subset with recompiled extensions, and any CPython bridge is planned to be capability-gated and opt-in (TODO(c-api, owner:runtime, milestone:SL3, priority:P2, status:missing): definelibmoltC-extension ABI surface + bridge policy). - NaN-Boxing Invariants: Our 64-bit object model uses strict NaN-boxing. We maintain pointer invariants (48-bit addresses) and sign-extension checks to prevent pointer manipulation attacks.
- Runtime Guards: Molt inserts bounds checks on dynamic collection accesses; specialized paths use guards and fall back to runtime checks when safety cannot be proven.
Molt employs a Capability-based Security model. A Molt binary has zero authority to interact with the OS unless explicitly granted.
- Explicit Manifests: Capabilities like
net,fs.read,env.read, andtimemust be declared in build flags or capability profiles. - Granular Access: Filesystem access is path-restricted.
- WASM Isolation: When targeting WASM, the sandbox enforces these boundaries via the host interface.
- Lockfile Enforcement:
molt buildstrictly enforcesuv.lock. If dependencies change without a lockfile update, the build fails. - Verified Packages: Molt Packages (
.moltpkg) use checksum verification to ensure that the code you run is the code you built. - Deterministic Binaries: Molt guarantees bit-identical output for the same source and toolchain. This allows for "Reproducible Builds," where third parties can verify that a binary matches its public source code.
- Arbitrary Code Execution (ACE): Via memory safety and WASM isolation.
- Data Exfiltration: Via strict network/filesystem capability gating.
- Dependency Confusion/Substitution: Via lockfile and checksum enforcement.
- Logic Errors in Python Source: If your Python code has a vulnerability (e.g., SQL injection), Molt will faithfully compile that vulnerability into native code.
- Resource Exhaustion (DoS): While we have recursion limits, we do not yet have strict memory/CPU quotas for native binaries (though WASM targets can be restricted by the host) (TODO(security, owner:runtime, milestone:RT2, priority:P1, status:missing): memory/CPU quota enforcement for native binaries).
Molt uses Differential Testing as a security tool. By running test cases against both CPython and Molt, we ensure that our "Performance Optimizations" do not introduce "Semantic Divergence" (which is often where security bugs hide).
We use tools/runtime_safety.py to run:
- Sanitizers (ASan/TSan/UBSan): For memory, threading, and undefined behavior detection.
- Miri: To verify the soundness of our (minimal) Rust
unsafeblocks. - Fuzzing: Targeted
cargo fuzzruns for high-risk components (string parsers, codec decoders).
- Rust:
cargo audit,cargo deny check - Python:
uv run pip-audit
If you find a security issue in Molt, please do not open a public issue. Contact the project owner (@adpena on GitHub) privately. We aim to acknowledge all reports within 24 hours and provide a fix within 7 days.