Security
How we think about Elo security, what we aim for, what you must provide, and our bug bounty program
Secure by Design
Elo is built for a specific use case: letting people write small programs that run somewhere they don't control. Think of a spreadsheet formula, but more powerful. You write it, someone else's computer runs it.
That's why Elo is a pure expression language: no loops, no recursion, no eval, no I/O, no access to host globals. It's a calculator — you give it data, it gives you a result.
It depends who writes the code, and whose data it runs on
Elo is not one tool with one security posture. The posture is set by trust: whether the Elo expression comes from someone you trust, and whether the input data is something you trust. "Trustworthy code over trustworthy data" is a portable calculator; "untrustworthy code over arbitrary data" is a hostile-input compiler. Same language, very different stakes.
| Elo code | Input data | What Elo is here | What you rely on |
|---|---|---|---|
| trusted | trusted | a portable expression evaluator | correctness; a sandbox is good hygiene |
| untrusted | trusted | user formulas over your data | Elo's sandbox plus your resource limits |
| trusted | arbitrary | your logic over foreign data | the data contract (data in, not host objects) |
| untrusted | arbitrary | fully hostile input | everything below, at once |
We design, document, and triage for the hard end — untrusted code — so the easy end is covered for free. Everything below assumes someone hostile may write the expression.
What Elo aims for
Elo touches your systems at two moments: compile time, when the compiler turns an expression into target code (JavaScript, Ruby, Python, SQL), and runtime, when that code runs over your data. The properties below are what we design Elo to hold at both, and what the bug bounty pays for: we treat a violation as a bug and fix it. They are goals we work hard to meet — not a warranty. Elo is open-source software provided as is (see thelicense).
At compile time
- It always finishes. No expression — however deeply nested or malformed — makes the compiler hang or overflow its stack.
- It can't be turned against the compiler. Compiling an expression never executes attacker code inside the compiler process: no
eval, no loading of host code, no attacker-controlled method firing during compilation. - An import reads a file, and only reads it. An
importis the one capability compilation has: the compiler reads the.elofile the expression names, parses it as Elo and inlines it. Nothing in it runs at compile time. The loader is an argument, not a built-in — a host that compiles expressions it does not trust gives none, and an import is then refused. The playground and theparse()API do exactly that;elocandeloread the filesystem, as the tools of whoever runs them. - It never crashes uncontrollably. Bad input yields a typed Elo error, not an uncaught native exception.
- It emits only what you wrote. No value threaded through the compiler — a name, a key, a literal — can break out of its slot and inject code into the output. This holds whether the expression came from source text or from an AST handed to the compiler API.
At runtime, by construction
The code Elo emits is a pure function of its input. By construction it cannot:
- call
evalor build code at runtime — what you see is what runs; - read files, open sockets, read environment variables, or reach host globals (
window,process, …); - reach host-runtime internals, such as the JavaScript prototype chain or the
Functionconstructor.
What you must provide
Elo gives you a capability sandbox — but not a resource sandbox. Two things are yours to handle, and skipping them is how untrusted expressions hurt you.
→ Read Running Elo safely — a practical guide with copy-paste reference sandboxes for Node, the browser, Ruby, Python, and PostgreSQL.
Run compiled Elo under a memory limit and a timeout
An Elo expression has no loops, but it can still be expensive: it can build a large value from the data you give it, or chain enough work to take real CPU. We make a best effort to minimize this — the primitives that let a short expression allocate out of proportion are bounded (array repeat is rejected; string repeat and padding, the array a patch grows to reach an index, and the bit length of an exponentiation are capped by the ELO_MAX_STRING_LENGTH environment variable, default 10,000,000) — but bounding primitives does not bound total cost, and we will never claim it does. Run compiled Elo the way you would run any untrusted computation: in an isolated context, under a memory ceiling and a wall-clock timeout. SeeRunning Elo safely for copy-paste reference sandboxes for every target.
Compile untrusted expressions without a filesystem
An import names a file, and the file is read when the expression iscompiled. So an expression you do not trust must not be compiled by something holding a filesystem: use loadProgram with no module loader, or with one of your own that serves only the modules you mean to offer, and any other import is refused with an error. Do not shell out to eloc on an expression a stranger wrote — that is a compiler with your whole filesystem in reach.
Pass data, not host objects
Elo operates on plain data: strings, numbers, booleans, null, lists, and maps whose keys are strings — the shape you get from parsing JSON. Do not hand it an arbitrary host object (an ORM row, a Decimal, a class instance with operator overloads). Elo compiles _ + 1 orInt(_) to the target's own operators and built-ins; in Ruby and Python those dispatch to whatever methods the object defines, so a host object's own code can run — outside the sandbox. Convert host objects to plain data before evaluating.
Bug Bounty Program
Found a security issue? We want to hear from you. We offer rewards for valid security vulnerabilities:
In scope
Anything that lets an untrusted expression (or untrusted input) break one of the properties above:
- Compiler code execution — an expression or AST that runs code inside the compiler process. Critical.
- Output injection — a value that escapes its slot in the emitted code. Critical / High.
- Runtime capability escape — emitted code that reaches
eval, I/O, host globals, or host internals. High / Critical. - Compile-time denial of service — input that hangs or crashes the compiler. High.
- Disproportionate allocation — a short expression that forces allocation grossly out of proportion to its input, via a stdlib primitive we failed to bound. Medium / High.
Out of scope
By design — documented, not a vulnerability (though we welcome feedback if our guidance is unclear):
- A legal expression that is simply expensive over the data provided (large sort, deep chaining, big output). This is what your resource sandbox is for; we bound disproportionate primitives as a best effort, but general cost is not a bounty-eligible bug.
- Resource exhaustion (out-of-memory, long run) that a memory-plus-timeout sandbox would contain.
- Passing non-data host objects as input and observing their methods run — a data-contract violation.
- Behaviour of your host wrapper or the runtime libraries Elo depends on, except where Elo emits a call that misuses them.
Rules
- Demonstrate the issue with a valid
.eloprogram — or, for compiler-API injection, with the AST you build - Explain the target environment where the vulnerability occurs
- Provide identifying information for payment (no anonymous submissions)
- Keep issues private for 90 days while we work on a fix
Final severity is assessed by our team, against the categories above rather than a bare score. Valid in-scope reports are credited and, where applicable, assigned a CVE.
Contact
Send security reports to security@enspirit.dev