Security and privacy¶
struktJS is a developer tool. This page explains what the IDE can do on your machine, what protects it, and what data goes where, so you can use it safely.
The short version¶
- The IDE backend runs as you, with access to your files, git and a terminal. Treat access to it like access to a shell on your machine.
- It listens only on localhost by default. Keep it that way.
- Opening a project, language or sample runs its code. Only open content you trust.
- Nothing is sent to an AI service, relay, registry or update server unless you use that feature (or, for updates, someone configured a server).
What the IDE backend can access¶
The Theia backend (the Node process started by npm start, or built into the desktop app) runs with your
user's permissions. Through it, the IDE can read and write files, run git, run your programs and tests, load
plugins, and open a terminal. There is no login: whoever can reach the backend's port can use it.
What protects it:
- Localhost binding. The
npm startscript passes--hostname 127.0.0.1, so only your own machine can connect. - Request checks. struktJS's own API (
/api/struktjs/*) only accepts requests whoseHostis a loopback name (or listed in theSTRUKTJS_ALLOWED_HOSTSenvironment variable), rejects requests from a different web origin, requires JSON bodies, and sends no permissive CORS headers. This blocks a web page you visit from driving the API (including through DNS rebinding). There is deliberately no access token, because any token a page could fetch from the same origin would also be fetchable by such an attacker. - File path limits. File requests must use absolute paths that, after resolving symlinks, are not inside
credential and system folders:
~/.ssh,~/.aws,~/.gnupg,~/.kube,~/.docker,~/.azure,~/.netrc,~/.npmrc,~/.pypirc,~/.git-credentials,~/.password-store,~/.config/gcloud,~/.config/gh,~/.config/op,~/.config/1Password,~/.config/doctl,~/.config/helm,~/Library/Keychains, and system folders such as/etc. SettingSTRUKTJS_ALLOWED_ROOTSfurther limits access to the folders you list. Language files, git arguments, test patterns and plugin folders are validated. - Git hooks. A repository can ship hook scripts (
.git/hooks/*) andcore.fsmonitorsettings that run code. Every git command the IDE runs hascore.fsmonitordisabled, and hooks are disabled for everything the Git pane does exceptcommitandpush(includingcheckout,stash,merge,revert,pull,switch,worktree,rebaseandcherry-pick). Commit and push still run yourpre-commit,commit-msgandpre-pushhooks, because people rely on them, so do not commit or push from a repository you have not inspected. Git started from the integrated terminal or from a VS Code extension's own source-control view is not covered by any of this.
What localhost binding and the request checks do not stop
These controls stop web pages and other machines. They do not stop another program running on your
own machine that can open a connection to 127.0.0.1: such a program sends the right Host header and no
web origin, so it passes. That matters wherever unrelated processes share your loopback interface: WSL2
with networkingMode=mirrored, Docker containers started with --network=host, and some
corporate VPN or security drivers that add virtual network adapters. Theia's own services (terminal,
file system) are equally open to such a process. Theia also sets a connection cookie, but it hands that
cookie to any plain HTTP request, so a script can fetch the page, take the cookie and connect. If you use
one of those setups, either turn on the launch token below, or do not run untrusted install scripts
(npm install of unreviewed packages) on the same network namespace as a running IDE, or run the IDE
inside the container or VM you trust.
Launch token (on by default)
The browser IDE (npm start) requires a launch token unless started with STRUKTJS_REQUIRE_LAUNCH_TOKEN=0
(npm run start:open does this for development). The backend creates a random secret that exists only in
memory and in a launch URL printed in the terminal (Launch token required. Open: http://127.0.0.1:PORT/?strukts_token=...).
Opening that URL sets an HttpOnly, SameSite=Strict cookie and removes the secret from the address bar;
every page, API call and WebSocket connection without that cookie is refused, and Theia's own cookie is not
issued to it. A program that cannot read the terminal output or your browser's cookies can no longer drive
the IDE. You must open the printed URL each time the IDE starts, and automated browser tests need to be given it or
start the backend with the opt-out. It does not apply to the desktop app, which uses Electron's own
token between its window and backend.
Do not expose the backend to a network
Binding the IDE to 0.0.0.0, forwarding its port, or putting it behind a reverse proxy gives everyone who
can reach it the ability to run commands as you. If you need remote access for yourself, use an authenticated tunnel
or VPN. To collaborate with others, expose only the collaboration relay (see below), never the IDE. A company that
wants to run the IDE as a server for its people should follow Deploying the server:
a container per person or trusted team, behind your own login, never on the open internet.
These protections came from a security audit on 2026-10-02. Before it, the backend allowed any origin and
bound all interfaces by default; that is fixed. Two limits remain: the backend has no notion of "the open
workspace" (the deny-list above is the confinement), and rule code is not sandboxed (next section). Findings from
a later external review led to more credential folders in the deny-list, hooks disabled for more git commands,
and a stricter js() policy (below).
Trusting projects, languages and plugins¶
A project, a language file (.lang.js), a sample or a dynamic plugin can contain JavaScript that runs when it
loads: generators, checks, evaluation rules, plugin modules. The Theia IDE asks first: it prompts per
content hash before running a project's .lang.js, an imported language or a plugin, and remembers the choice for that exact
content. The embedded editor and the headless engine have no prompt (allow all), so code there runs as soon as it loads, with the
full privileges of the page. Only open projects, import languages and load plugins you would run as source code. The command-line tool
is stricter: it refuses a project's own *.lang.js unless you pass --trust-project-code. See
Trusting project code.
The evaluator's js() escape hatch (and the JsCall/JsGet/JsNew/JsMethod/JsProp and indexing
operations) is a policy inside the page's own JavaScript realm, not an isolated realm: only an allowlist of
global roots is reachable (Math, JSON, Date, Object with a few statics, and similar), and every property
name touched is checked against a denylist (constructor, __proto__, prototype, prototype-reflection
functions such as getPrototypeOf, window, globalThis, fetch, storage, eval, Function, process). This is
meant to stop a model program from reaching the network or your backend, but it is a denylist, not a security
boundary against a determined author of trusted code; only run programs from sources you trust, and see the
trust section above for what a .lang.js can do regardless. Rendered Markdown (hover text, Inspector) and raw
HTML nodes are sanitized with DOMPurify (version 3.4.16 or newer, HTML, SVG and MathML profiles, with scripts,
frames, forms, styles and event-handler attributes removed and only http(s), mailto, tel and relative
links kept). There is no Content Security Policy yet, because rule code is compiled with new Function, so
the sanitizer is the only layer between rendered markup and the page.
Extensions¶
The Extensions view installs VS Code extensions from Open VSX. Extensions run with the backend's
privileges, so installation is default-deny: only extensions from a built-in list of publishers are allowed
(vscode, ms-python, ms-vscode, charliermarsh, babbelaar, eclipse-theia, redhat, dbaeumer, esbenp
and github). To use your own list, create ~/.struktjs/extension-allowlist.json containing a JSON array of full ids
such as ms-python.python, or of publishers (ms-python or ms-python.*). A non-empty file replaces the built-in
list entirely; it does not add to it, so include any built-in publisher you still want. An empty or malformed file
is ignored. STRUKTJS_EXTENSION_ALLOW_ALL=1 turns the check off; this is not recommended. When an install is blocked
the message names the extension and the file to edit. Do not install untrusted .vsix files.
The allowlist file is plain JSON with no signature or integrity check: any program that can write to your home folder can replace it. When a custom list is in effect, the backend logs the full list it is using, so look at the backend log if you suspect it changed. A program with write access to your home folder can usually do worse (edit shell start-up files, for instance), so treat this as defense in depth, not as protection against a compromised account.
The command-line tool and AI¶
The strukts CLI runs your models' checks, generators and tests headlessly. It only reads project files, and
it refuses a project that has its own *.lang.js (arbitrary JavaScript) unless you pass --trust-project-code, because nobody can be asked. In CI, use that flag only for code your team has reviewed.
The AI assistant is covered in AI features. Its edit, run and web-search tools ask for confirmation by default, and chat text goes only to the model server you configure.
Collaboration and the relay¶
Live collaboration connects through a relay server you choose. The default is a local
relay at http://localhost:8100/; nothing contacts the public Open Collaboration relay unless you type its
URL.
- Session content is end-to-end encrypted between peers; the relay sees who is connected and message metadata, not decrypted model content. The scheme comes from the Open Collaboration protocol library: peers have RSA-OAEP key pairs (4096-bit, SHA-256) used to exchange keys, and content is encrypted with AES-256 in CBC mode. CBC mode does not authenticate the data by itself, so confidentiality is the guarantee here, not tamper-evidence.
- Relay URLs must be
https://orwss://; plainhttp://orws://is accepted only for loopback addresses, and URLs with embedded credentials are refused. - Join links contain a relay URL. Joining connects to whatever relay the link names, so the confirmation shows it and warns if it is not your configured relay. Join only from people you trust.
- Hosts approve every join ("Allow name to join?"). There is no way to remove someone after they have joined (the protocol has no remove command), and no read-only mode: peers can edit your live model, so treat them as trusted collaborators. If a join link was shared too widely or a peer's machine is compromised, end the session and start a new one (a new session has a new link and key material).
- Data from other peers is validated before it touches your model (node-name syntax, depth and size
limits), and peer names and colours are sanitized. That check is structural: a peer can edit anything
in the shared model, including text that is later rendered as Markdown or raw HTML (sanitized as described
above) and
js()calls in a program you then run (limited by thejs()policy above, so review a shared program before running it). A session shares one model only: it does not transfer or load.lang.jsfiles, plugins or language definitions to the host. Comment authors can still be spoofed by a malicious peer, so do not rely on a name as proof of identity. - Without a secure context (HTTPS or localhost) encryption is unavailable unless you opt in to the weaker fallback described on the collaboration page.
To collaborate across machines, put the relay behind TLS and share its https:// URL; see
Running the collaboration relay locally.
Running a Core program (Python)¶
A Core program is generated as Python and run on a real interpreter, and where that interpreter lives decides what the program can reach.
- Python on this computer (the Python runtime preference Automatic uses it when it exists): the IDE backend starts
python3(orpython) as a child process with your permissions, exactly like a terminal. The program can read and write your files, start programs and use the network. Nothing is sandboxed; only run programs you would run from a terminal. The same trust model covers the debugger, Run with Coverage and the Test Language's assertions, which run the same text. - Built-in Python (Pyodide), CPython compiled to WebAssembly: in the browser, the desktop app and the embedded editor it runs in a
background Web Worker. It has no direct access to your files or the project folder, only an in-memory file system that disappears
with the run, and it cannot reach the page's DOM or
localStorage. It is not a network or origin sandbox. A program canimport jsand usefetchand IndexedDB like any script of the page's origin (a browser test pins exactly this,tests/test-ui-pyodide-sandbox.spec.js). It can request any URL the browser allows, and requests to the page's own origin carry the page's credentials: in the IDE that includes the backend's HTTP interface, so assume such a program can do what the page can (see the launch token and origin checks above). The IDE has no Content Security Policy yet, see above. Treat it as a way to run Python without installing it, not as a way to run untrusted code. In the command-line tool (strukts run --python pyodide,strukts mcp) Pyodide runs in a Node worker thread, which is a convenience and not a security boundary either: treat it like the host Python. - Limits that protect you from accidents, not attackers. A run stops after 30 seconds of computing (waiting for an
input()answer has its own, much longer limit), closing the tab ends it, and a Pyodide run that is stopped or times out has its worker terminated, so no state leaks into the next run. - Nothing is downloaded without asking. The Pyodide runtime (about 10 MB, from jsDelivr) is fetched once, after a consent
dialog that offers Cancel first; the request carries no user or project data. An organisation can point the page at its own copy
(
__STRUKTJS_PYODIDE_URL__) so that nothing leaves the network. The embedded editor never downloads unless the embedding page agrees. - A project's programs, like its languages, are content you chose to open. The deep link
runaction always asks before it runs anything (see Trusting project code).
What is sent where¶
| Feature | Data | Destination |
|---|---|---|
| Editing, running, generating | nothing | stays on your machine |
| AI chat | chat text and tool output (program text, checks, ...) | the configured model server; with local Ollama, your own machine. See AI features. |
| AI web search (asks first) | the search query | DuckDuckGo, from the backend |
| First run on the built-in Python (asks first) | a request for the Pyodide runtime files (about 10 MB); no user or project data | jsDelivr, or the copy your administrator configures. Cached afterwards; never contacted when the machine has its own Python. |
| Live collaboration | encrypted model edits, cursors, comments, names | the relay you configure, then your peers |
| Extensions view | search and download requests | Open VSX |
| Desktop update check (only if an update server is configured) | a request for one small metadata file; the installer only after you choose Download. No user or machine data. | the update server named by your administrator or customer build. With none configured, nothing. See Updating and uninstalling. |
The desktop (Electron) app¶
The desktop build uses the same extension and backend, started inside the app, so the file, git and terminal
access above applies equally. It blocks in-app navigation (links open in your browser) and denies <webview>
attachment. The window runs with Electron's renderer sandbox and context isolation on and Node integration off, so
page scripts cannot call Node directly. The page can still reach the backend (and so your files and a
terminal) through the same local API as in the browser, so script injection into the page is as serious as
the sections above describe.
Updates. The desktop app can check for a new version, but only from an update server that someone configured for your
installation (your administrator's policy file, an environment variable, or the customer build); the standard download has
none and contacts nothing. The server address must be https://. The app asks before downloading and again before
restarting, and an administrator can turn updates off for a machine. See Updating and uninstalling.
Release installers are signed (and on macOS notarized) only when the maintainers have configured signing
certificates for that release; otherwise they are unsigned and not notarized, and your OS may warn
when you install them. Every release lists a SHA-256 checksum for each installer (SHA256SUMS-*.txt) and
publishes CycloneDX software bills of materials (struktjs-webview.cdx.json,
struktjs-electron-app.cdx.json) listing the bundled dependencies. Compare the checksum of a download
before installing it, and install only builds you made yourself or got from a source you trust.
Safe-usage checklist¶
- [ ] Run the IDE on localhost only; never forward or proxy its port (a managed server deployment is the exception: see Deploying the server). On shared loopback setups (WSL2 mirrored,
Docker host networking, VPN adapters) keep the launch token on (the default; do not set
STRUKTJS_REQUIRE_LAUNCH_TOKEN=0). - [ ] Open projects,
.lang.jsfiles, plugins and samples only from sources you trust (the Theia IDE asks before running a project's.lang.js, an imported language or a plugin; decline anything you do not recognise). - [ ] On WSL2 mirrored networking, Docker host networking or a VPN with virtual adapters, do not run untrusted install scripts next to a running IDE.
- [ ] Do not commit or push from a repository you have not looked at (its
pre-commitandpre-pushhooks run). - [ ] Join collaboration links only from people you know, and read the relay URL shown.
- [ ] Use a relay on
localhostor behind TLS; do not bind it to0.0.0.0over plain HTTP. - [ ] Keep AI tool confirmations on for running programs, editing the model and web search; prefer a local Ollama model for sensitive code.
- [ ] Keep the extension allowlist default-deny; install only extensions you need from known publishers.
- [ ] Pass
--trust-project-codeto the CLI only for project languages your team has reviewed. - [ ] Do not paste secrets into models, comments or shared sessions.
Reporting a vulnerability¶
Please do not open a public issue. Contact the maintainer privately at alexander@f1re.io with the affected
component, steps to reproduce, and the impact. Reports are acknowledged within 5 business days, with an
initial assessment within 10 and a fix or documented mitigation aimed for within 90 days. Only the latest
master receives security fixes.