Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

stof

Latest version: v0.12.0

Overview

Last scanned
28 Nov 2026
Published
28 Nov 2026
PyPI package Publisher: cj_formata
67 Stars
5 Forks
14 Versions
1.7K Downloads
Rust Repo language

Scan summary

stof was last scanned on 28 Nov 2026 at version 0.12.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 14 versions; the latest was published on 28 Nov 2026.
  • Findings: No rules fired in version 0.12.0.
  • Downloads: 1,656 downloads.

Versions

14 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.12.0 LATEST 28 Nov 2026 No rules fired
0.11.6 17 Nov 2026 No rules fired
0.11.5 16 Nov 2026 No rules fired
0.11.4 16 Nov 2026 Not shown
0.11.3 8 Nov 2026 Not shown

No rules fired in 0.12.0

Findings

Findings for v0.12.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.12.0; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

JSON, plus a function

// acme.stof: one customer's pricing
{
    "customer": "acme",
    "plan": { "rate": 0.02, "included": 1000 },

    fn price(units: int) -> float {
        const billable = units - self.plan.included;
        if (billable <= 0) return 0;
        billable * self.plan.rate
    }
}
import { StofDoc } from '@formata/stof';

const doc = await StofDoc.new(source);   // acme.stof
await doc.call('price', 5000);           // 80
from pystof import Doc

doc = Doc()
doc.parse(source)                         # acme.stof
doc.call('price', 5000)                   # 80.0

Any JSON is already a Stof document. Add a function where the logic belongs, and your app calls it the way it reads a field. The document runs inside your process: no server, no container, and it can't reach anything you didn't give it.

What else a document can hold

// server.stof
ms timeout: 5min + 30s        // 330000
MiB memory: 2GB               // about 1907.35

#[type]
Server: {
    #[schema((v: int): bool => v > 0 && v < 65536)]
    int port: 8080
}

config: { port: 70000 }

fn valid() -> bool { <Server>.schemafy(self.config) }

#[test]
fn config_is_valid() { assert(self.valid()); }
  • Units are part of the number, and math between them converts. No more "timeout": "5m" for someone to parse later.
  • Types carry rules for their fields. Point one at any object to check it: this config fails, because 70000 isn't a port.
  • Tests live next to what they check. stof test server.stof fails here until the port is fixed.

There's more: destructuring, async, attributes, and imports and exports for JSON, YAML, TOML, and compact binary.

It can only touch what you hand it

const doc = await StofDoc.new(`
    fn greet(name: str) -> str { Host::greet(name) }
    fn leak() -> str { fs::read('/etc/passwd') }
`);

doc.lib('Host', 'greet', (name) => `hello, ${name}`);

await doc.call('greet', 'world');   // 'hello, world'
await doc.call('leak');
// throws: 'fs::read' isn't available: this host hasn't given documents file system access

The same in Python:

doc.lib('Host', 'greet', lambda name: f'hello, {name}')

doc.call('greet', 'world')   # 'hello, world'
doc.call('leak')             # raises ValueError: 'fs::read' isn't available: ...

A document sees itself and the functions your app registers. There's no file system, network, or environment unless you turn them on, and network access can be limited to the hosts you list (doc.allowHttp(['api.example.com']) in JavaScript, doc.allow_http_hosts(['api.example.com']) in Python). Every call has a time and memory limit. You can also seal the parts you trust, so nothing can change them, and confine code from somewhere else so it sees only what you list. See Security and the Sandbox.

What it's for

  • Logic someone else writes. A model, a user, or a customer gives you rules, filters, transforms, scoring, or agent tools. Check them, test them, and run them in-process on every request.
  • Behavior per customer. One document per customer holds their rules, limits, and state. An agent can edit it, a person reviews a one-line diff, and your app behaves differently for that customer with no deploy.
  • Config that checks itself. Validate and compute values in the config, and still export plain JSON, YAML, or TOML.
  • The rules engine or DSL you were about to build. Describe your domain in Stof instead.
  • Logic that has to run everywhere. Send a document, functions included, as text or compact binary, and get the same answer in the browser, on a server, or in a worker.

Each one has a runnable example in the playground. Use something else for your own application code, heavy compute, or long-running services: write those in your main language and give them to documents as functions.

Stof is the engine behind Limitr, where every customer's pricing is a Stof document, evaluated in-process on every call.

Install

npm i @formata/stof     # JavaScript / TypeScript
cargo add stof          # Rust
pip install stof        # Python (import pystof)

The stof command line (stof run, stof test, and the language server) is prebuilt for macOS, Linux, and Windows. See stof-cli, or on macOS and Linux:

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/dev-formata-io/stof-cli/releases/latest/download/stof-cli-installer.sh | sh

TypeScript

import { stofAsync } from '@formata/stof';

const doc = await stofAsync`
    "name": "Stof"
    fn hello() -> str { \`Hello, \${self.name}!\` }
`;
console.log(await doc.call('hello')); // Hello, Stof!

Python

from pystof import Doc

doc = Doc()
doc.parse('rate: 2\nfn total(units: int) -> float { units * self.rate }')
print(doc.call('total', 21))  # 42.0

Rust

use stof::model::Graph;
use stof::runtime::{Runtime, Val};

let mut graph = Graph::default();
graph.parse_stof_src("rate: 2\nfn total(units: int) -> float { units * self.rate }", None, Default::default())?;
let total = Runtime::call(&mut graph, "total", vec![Val::from(21i64)])?; // 42

Teaching a model Stof: give it content/SKILL.md, a short guide to the language, with the library references in content/stof.zip. The npm package ships the same skill in node_modules/@formata/stof/skill/stof.

FAQ

Is it safe to run a document a model wrote? That's what it's built for. A document can only see itself and the functions your app gives it. File system, environment, file imports, and network are off by default in every language, and network access never reaches localhost or your private network unless you list those hosts. Each call has a time limit (2 minutes by default) and a memory limit (256 MB by default), so a runaway document fails its call instead of your app. For code from somewhere else, parse it as untrusted (nothing runs while it's parsed) and seal it confined to what you list. The stof CLI turns access on, since it runs your own files.

Can models write Stof? Yes. It reads like JSON and JavaScript, which every model already knows, and errors give the exact line and a plain explanation, so a model can fix its own mistakes. The skill helps.

Why not have the model write Python and run it in a container? You can, but that's infrastructure, startup time, and a lot of access to lock down, and what a person reviews is a program. Stof runs inside your process, starts instantly, has no access by default, and a change is a diff to a document.

Why not Lua? Lua is a great language for scripting your own app. Stof is for documents that carry logic. With Lua, the data lives somewhere else, each host language needs its own Lua binding, and schemas, units, tests, and the sandbox are yours to build. A Stof document holds the data and its logic together, runs the same in Rust, JavaScript, and Python, and starts with no access. Any JSON is already a Stof document, so there's nothing to migrate.

Why not CEL or JSONLogic? Expression languages are safe because they're small: one expression, no functions of your own, no state. That's enough for a single condition, and it runs out quickly for pricing, scoring, or an agent's tools. Stof has functions, types, and tests, inside the same kind of sandbox.

Why not WebAssembly? WebAssembly needs a compiler toolchain, and its binaries are large to send. Stof is readable, small, and travels with the data it works on. (The Stof runtime itself is compiled to WebAssembly for browsers.)

How fast is it? A small document parses and runs in under a millisecond, and calls after that take microseconds.

Can a document depend on other documents, or on remote data? Yes, with one pinned line that works the same in every host, the browser included. The host calls load() after parsing, and the document fetches what it depends on through the host's own network rules, checks it against its sha256, and parses it in: Stof, a package, JSON, CSV, an image, any file. Packages have versions (the highest one required wins), and the stof CLI pins, installs, and updates them:

#[load] fn intent() { await import('https://github.com/formata/intent/releases/download/v1.4.0/intent.pkg', '9f2c...', '@formata/intent@1.4.0'); }

Do I have to replace JSON, YAML, or TOML? No. Stof imports and exports them, so you can add logic to the data you already have.

Learn more

License

Apache 2.0. See LICENSE.

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases stof

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Copy of Template Design OX Blog (1)
Research

Thousands Of GitHub Accounts Hijacked With wfx-loot CI Secret Stealing Malware Via GitHub Actions & npm

Copy of Template Design OX Blog (2)
Research

NGINX2Root: Five Critical NGINX Flaws Expose Web Servers to Remote Code Execution

CVE

Java4Shell (CVE-2026-114938): Easy to Crash, Hard to Exploit — Less Than 0.12% of JVMs Estimated at Risk of RCE

Frame 2085668439 (1)
Group 1261154229