Nox
Download

Reference

Security model

Nox gives you memory safety and static typing inside the language. It is not a sandbox. This page states exactly where the guarantees stop, so you can decide what to trust.

What Nox guarantees (pure Nox code)#

Mandatory static types, automatic memory management (no use-after-free or double-free from Nox code), bounds-checked list and string indexing, trapping fixed-width integer overflow, checked division by zero, and no unwind tables or ownership syntax to get wrong.

Where the guarantees stop — the trust boundary#

Mechanism Authority What Nox checks
extern def … from "<lib>" raw native code with full OS authority type marshalling and error translation only; the native function itself is not constrained
lowlevel blocks change the allocation strategy; extern def calls inside run with full native authority types are still fully checked
NNI plugins (nox.native) and Plugin API plugins (nox.plugin) a shared library with full native authority handles are opaque and generation-checked, so a plugin never sees a pointer into Nox's heap — but it is not sandboxed; Plugin API capabilities are consent, not enforcement
HPy/CPython extensions and WASM modules native code / WASM linear memory opaque handles only; no raw PyObject* crosses; WASM is isolated to its linear memory
nox_allocator_install (freestanding) supplies all heap memory not validated — a wrong allocator corrupts the whole program

Dependencies. A nox.json dependency may declare its own extern defs (and so may its transitive dependencies), and its code runs as part of your program. Adding a package means trusting its code. nox.lock pins the exact commit of every dependency and require_signed_commit can demand a signed commit — these protect against a moved tag or branch, not against what the code does. There is no signing of packages, no audit and no capability system in 2.0 (the same trust model as npm, PyPI and crates.io).

The registry. noxpkg approves metadata; approval does not mean the code was reviewed (noxpkg).

The standard library#

  • nox.fs and nox.os perform no path validation. If a path can come from an untrusted source, confine it with nox.path.safe_join before calling them (it rejects .., symbolic-link escapes and sibling directories such as /srv/dataevil for the root /srv/data).
  • nox.process runs the program and arguments you give it with your authority; there is no shell, but never take the program name from untrusted input.
  • SQL: always pass values through Statement.bind_*; table and column names cannot be bound and must come from your code.
  • nox.template escapes for HTML text and quoted attributes only.
  • nox.random is not cryptographically secure; use nox.crypto.secure_random_hex. SHA-1 is available for interoperability only.
  • nox.jwt.verify checks the signature but not exp/nbf/aud; enforce claims yourself.
  • HTTP servers cut off clients that stall while reading or writing; put a reverse proxy in front for public services and use TLS (serve_tls, or terminate TLS at the proxy).

Practical guidance#

  1. Treat extern def and every dependency that contains one like a C dependency: review, pin and prefer small, audited ones.
  2. Keep native calls behind a narrow Nox wrapper that validates arguments (lengths, ranges, UTF-8) before crossing the boundary.
  3. Run untrusted Nox source with noxc run --sandbox (no network, writes only to $TMPDIR, no access to your home directory; ADR-010). Plain noxc run executes it with your authority.
  4. Load plugins only from sources you trust; declare and grant the minimum capabilities.
  5. Keep secrets out of source control; read them from the environment.

Registry gates and incident response#

What the registry does today: a submission is moderated before it appears in the index; approval covers the metadata (name, repository, description), not the code; the index carries no version, so what you install is decided by your nox.json and pinned by nox.lock (git commit and SHA-256 of the tree). The lock file is the provenance record of a build: it names exactly which commit of which repository was used.

If a package is found to be malicious or compromised: (1) the maintainers remove or hide the entry from the index, which stops new installs through noxc add and noxc search; (2) existing projects keep working from their lock file, so the advisory names the affected repository and commits and tells users to update the lock; (3) the fix and the advisory are published in the CHANGELOG and the repository's security advisories. A package that declares extern def or a bin entry runs native code with your authority (see the trust boundary above); read it before adding it.

noxc sbom (since v2.1.153) writes a CycloneDX 1.5 SBOM listing every locked dependency with its commit and whether it contains native code (extern def, lowlevel, bin). Publisher keys and attestations (since v2.1.154). noxc sign keygen + noxc sign register bind an Ed25519 key to your registry account (a GitHub-authenticated publisher); noxc publish then signs a statement {name, repo, ref, commit, SBOM SHA-256} and the registry stores it only if the signing key is registered, active, and the name is yours. Consumers run noxc sign check to re-verify each locked commit's attestation locally (the server is not trusted for the verdict) and can pin keys with noxc sign trust; revoked keys show as KEY REVOKED. noxc fetch/add do not require attestations yet. Still not built: automatic scanning at publish time (design: project/registry-guvenlik-tasarimi-2026-11.md).

Reporting vulnerabilities#

Please report security problems privately to the maintainers (see the repository's security policy and contact on GitHub) rather than in a public issue.

Not in 2.0#

extern def has no in-process sandbox: the boundary is the operating system (noxc run --sandbox). Plugin capabilities are consent metadata, not enforcement. nox.lock can be signed and verified offline (noxc sign, ADR-011); noxc fetch does not yet require a signature, and the registry does not yet bind publisher keys to accounts.