Skip to content

Security: DeSchaker/forthling

SECURITY.md

Security policy

forthling runs Forth code with the rights of the user who starts it: Forth programs can read, write and delete files. Running untrusted Forth code that way is therefore unsafe by design, and that alone is not a vulnerability.

For code you do not trust there is the sandbox (Forth::sandboxed(), --sandbox, or sandbox=True in Python): no files on the disk for Forth, which gets files in memory instead, no network (Permission::Network), no machine (Permission::System: starting programs, environment variables, the command line, directories and standard error, which the word list OPERATING-SYSTEM offers), limits on the steps, the time and the output of each evaluation, and a limit on the space a program takes outside its Forth memory. Getting around it is a vulnerability: reaching a file on the disk, running on after a limit was reached, one step that takes far longer than the time limit, or memory of the host growing past the limits. Words that a host program adds in Rust or Python run with the rights of that program; the sandbox cannot restrict them, so a host that offers them to untrusted code should check Forth::permits, or Forth::disk_files before it opens a file itself, as the SQLite words do.

The MCP server forthling-mcp always runs in the sandbox and has no option to leave it. It protects against the Forth code an AI agent sends, not against an agent that also has other tools, such as a shell: such an agent can start another program. See mcp/README.md.

A vulnerability is also, for example, a way to make forthling read or write memory outside its own Forth memory, run other programs (other than with the words of OPERATING-SYSTEM, which Permission::System guards), or touch files without a FILE or BLOCK word asking for it. forthling has no unsafe code and no dependencies, so a memory problem would most likely lie in Rust's standard library. A Rust panic is a bug: please report it as an issue.

Supported versions

Only the latest commit on main gets fixes.

Reporting a vulnerability

Please do not open a public issue. Report it privately through GitHub's private vulnerability reporting instead, with a few lines of Forth that show the problem if you can. You will get an answer as soon as possible, and the fix and the advisory are published together.

There aren't any published security advisories