Skip to content
Talk to our solutions team

Restrict what a script can reach

A script that can reach exactly the host capabilities it needs, and nothing else.

By default a script can read files, make HTTP calls, query databases, reach secrets and run shell commands. That is right for a script you wrote and wrong for one you did not.

Without thisWith this
Every script can reach every capabilityA script gets what its job needs
A generated script has the same reach as a reviewed oneGenerated code runs constrained
A bug in a transform can make a network callIt cannot
”What can this script do?” needs a code reviewIt is on the command line

With the default --namespaces all:

log http file db vault json time shell llm

That is a lot of reach — file, shell, db, vault and http are each enough to matter.

Terminal window
kis script run transform.js --namespaces none
log json time

Or name what you need:

Terminal window
kis script run fetch.js --namespaces log,http,json
The scriptNamespaces
Pure transformationnone
Calls an APIlog,http,json
Reads or writes fileslog,file,json
Queries datalog,db,json
Needs a secretlog,vault — and think hard about why
Generated or untrustedStart at none and add only what it fails without

That last row is the method: run it with none, see what it fails on, and grant that. What you end up with is the actual requirement rather than a guess.

A grant typed at a terminal protects one invocation. The grant that matters is the one in the definition, because that is the one that runs tomorrow.

- name: transform
script:
language: javascript
file: ./transform.js
namespaces: json,string
setvar: cleaned

namespaces: is the same grant as --namespaces, written where it is reviewed in a diff and applied on every run. This is the form to reach for: a constraint in the definition is a constraint someone has to consciously remove.

Ask the script what it can see:

function main() {
const seen = [];
for (const n of ["log","http","file","db","vault","json","time","shell","llm"]) {
if (typeof globalThis[n] !== "undefined") seen.push(n);
}
return seen;
}
Terminal window
kis script run probe.js --namespaces log,json --debug

Run that with the flags you intend to use in production. It answers “what can this reach” directly rather than by inference.