Repository navigation
Added
- A Go client for the optional zn Cloud API,
github.com/usezn/zn/go.zn.NewClient(key).Analyze(ctx, text)checks a tool result, a web page or an email before a model reads it, with timeouts, retries that honourRetry-After, typed errors (IsRateLimited,IsQuotaExceeded,IsUnauthorized), a check of the 20,000 UTF-16 unit limit before sending, andSplitForAnalyzefor callers that want to send long text in pieces. Standard library only. See go/README.md.
Changed
- The Claude Code plugin README now says how to install zn-gate from the usezn marketplace (at the plugin tag) and how to remove it.
zn-gate checkandzn-gate initlist Copilot as "GitHub Copilot (CLI experimental, VS Code not tested)": the same hooks
serve Copilot CLI, which is experimental, and VS Code, where they are documented but were not run in the app. The agent
list, the editors page and the Gemini CLI page no longer count Copilot as a seventh supported agent: six agents are
supported, and Gemini CLI and Copilot CLI are experimental.- The package description and the READMEs now name six supported agents and list Gemini CLI and Copilot CLI as experimental, matching the website.
- These stay refused when they name a project
.env:source .envand. .env(they run the file as shell code, which can
rewrite the file itself; use--env-fileordotenv -e), andpython3 -m venv .env(give the virtual environment another
name).
Fixed
zn-gate init,zn-gate check, the plugin messages and the docs now add the plugin marketplace at a plugin tag:claude plugin marketplace add usezn/zn#plugin-v<version>for Claude Code andcodex plugin marketplace add usezn/zn --ref plugin-v<version>for Codex. The tag is created on the commit that pins that zn-gate release and never moves, so the plugin you install pins the release you expect. The release tag (usezn/zn#v<version>) held the plugin pin of the previous release, which left the plugin one release behind.zn-gate evidence --exportof a large log (over about 512 MB) no longer writes an empty file and reports it as valid. The export
now reads the log in parts, so every record is exported in bounded memory, and the dashboard export does the same. In the npm
package, if the log cannot be read to the end the export says so and exits 1, and an export whose chain does not verify
also exits 1. The Python package reports a non-verifying export and still exits 0.evidence --export --output(Node and Python) refuses an output path that is the evidence log itself, or a link or hard
link to it, and exits 2. Before, the log was emptied and the command could report zero records as valid. Nothing is touched
when it refuses.zn team managed-confignow writes the same Claude Code hook command for a given system whichever system runs it: the Windows file keeps the scrub that reads variable names in any case (Git Bash), and the Linux and macOS files the short one.zn-gate checkon Windows reports a project hook guard with the short Linux and macOS scrub as modified instead of guarded, because that scrub leaves a loader variable written in another case set.- With the opt-in public IPv4 masking on, addresses in 192.0.x.x, 198.51.x.x and 203.0.x.x outside the reserved blocks (192.0.0.0/24, 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24), and 192.0.0.9 and 192.0.0.10, are now masked as public addresses.
- The scrubber no longer breaks JSON when an email address follows an escape sequence such as
éor\n: the address is masked without leaving a stray backslash, so scrubbed JSON stays valid. Secrets that start right after a JSON escape (an AWS access key id after\nor\t, and card, SSN, phone, GitHub and Stripe candidates) are now masked too, instead of being skipped because the escape's letter touched them. An address written with JSON unicode escapes (\u0061user@example.com, which decodes toauser@example.com) is now masked whole, escape included, instead of leaving its first characters outside the mask, and the Node scrubber follows the same rules so its masked output no longer keeps a stray backslash before an escape. In the Node scrubber the 64-character limit of a local part counts the characters of the address once escapes are decoded, not the hex digits of its escapes: an address with escapes and a long raw part is no longer left unmasked, and a local part over 64 decoded characters is not taken for an address. zn startnow answers on its management port on a machine with one CPU (a 1-vCPU VM or container). The policy watcher read its events with a blocking call inside the async runtime, which held the only worker thread, so the management API accepted connections but never answered a request. The watcher now waits on an async channel.- The Go client's
Allowed()is now false when only part of a long input was checked (a partial, capped or truncated result), so such an allow no longer passes as a full check.WholeInputChecked()reports it directly. - Commands that load a project
.envwithout running it pass again: the--env-fileoption of node, bun, deno, docker and
podman, and-e/-fof the dotenv, dotenv-cli and dotenvx runners. A command that zn cannot prove read-only is still
refused, and the message now says that zn cannot tell whether it writes the file and how to load it instead.
Security
- The gateway is built with
url2.5.9, which fixes a stack overflow inUrl::origin()on nestedblob:URLs (RUSTSEC-2026-0592). - The gateway is built with
wasmtime48.0.9, which fixes eight advisories published on 20 November (RUSTSEC-2026-0566 to RUSTSEC-2026-0573), among them a panic, a process abort and unbounded memory growth throughAsyncWriteStream. - The plugin hook scripts now remove the variables that load code into Node.js before they start it. The Claude Code and
Codex plugin script (scripts/zn-node.sh) and the ZCode plugin scripts (zn-hook.sh, andzn-hook.ps1on Windows)
passed the agent's environment, which a project can set, to Node.js unchanged, so aNODE_OPTIONS=--requirepreload ran
before the plugin launcher could check anything. They now drop the same list as thezn hooks installlaunchers
(NODE_OPTIONS,NODE_PATH, everyLD_*andDYLD_*and the others; on WindowsNODE_OPTIONS,NODE_PATHand
OPENSSL_CONF).NODE_EXTRA_CA_CERTSand the proxy settings are kept. Update the plugin to get the new scripts. - The hook launchers no longer pass variables that load code into Node.js. The agent's environment, which a project can
set, reached the hook unchanged, soNODE_OPTIONS=--require(or--import, orLD_PRELOAD) could run code inside the
hook and turn a blocked call into an allowed one. The sh launcher and the OpenCode plugin now remove the loader and
interpreter start-up variables thatzn runalready removed (NODE_OPTIONS,NODE_PATH,BASH_ENVand the others)
plusOPENSSL_CONF,NODE_V8_COVERAGE, and the named library variables (LD_PRELOAD,LD_LIBRARY_PATH,
DYLD_INSERT_LIBRARIESand the otherLD_andDYLD_names listed in the source) before they start Node.js. On Linux
and macOS only the named variables are removed; on Windows with Git Bash everyLD_*andDYLD_*variable is removed,
in any letter case. The Windows PowerShell launcher removesNODE_OPTIONS,NODE_PATHandOPENSSL_CONF.NODE_EXTRA_CA_CERTSand the proxy settings are kept.
zn-gate checkwarns when one of these variables is set.npm update -g zn-gaterewrites the sh launchers; for
OpenCode, and for the agents that use the PowerShell launcher on Windows, runzn hooks install <agent>again. - The sh hook launchers and the project hook guard now refuse to run the hook when a loader variable that loads code or changes
what the shell does before its first line is set in the agent's environment:LD_PRELOAD,LD_AUDIT,LD_PROFILE,
LD_TRACE_LOADED_OBJECTS,LD_DEBUG,LD_PRELOAD_FDSand the other names listed in the source, and
DYLD_INSERT_LIBRARIESwith the otherDYLD_preload settings. The dynamic loader loads such a library into the shell
before the first line of the launcher, so removing the variable there came too late: the call is now blocked with a
message that asks to unset it and restart the agent. Library search paths (LD_LIBRARY_PATHand theDYLD_*_PATH
variables) do not block the hook; they are removed for the hook only. Two limits remain and are written in the threat
model: a library that is already loaded runs before the check, and with the trace or debug variables the shell can exit
before the script runs. - The Windows PowerShell project hook guard now resolves every PATH folder and every
zn.cmd,node.exeandnode.cmd
with junctions and symbolic links followed, and does not run one whose real place is inside the folder the agent runs
in or inside anode_modulesfolder. Before, it dropped PATH entries by the textnode_modulesonly, so an absolute
project folder or a junction intonode_modules\.binon the PATH could supplyzn.cmdornode.exe. Run
zn hooks install <agent> --projectagain to update an existing project hook. - The project hook guard (the command
zn hooks install <agent> --projectwrites, for sh and for Windows PowerShell) now
removes the variables that load code into Node.js before it startszn, like the user hook launchers do, so a project
that setsNODE_OPTIONS=--requirein the agent's environment cannot run code inside the hook. It also no longer runs a
znornodefrom anode_modulesfolder written in another case (Node_Modules), which is the same folder on macOS
and Windows. Runzn hooks install <agent> --projectagain to update an existing project hook. - The project hook guard (sh, and the OpenCode project plugin) now checks where
znandnodereally are, with links
followed: a PATH folder that is a link into anode_modules/.binfolder, or aznthat is a link into one or into the
project, is no longer run. A global npm install, which linkszninto<prefix>/lib/node_modules/zn-gate, still runs.
Where a link cannot be followed (noreadlink -forrealpath), the guard blocks. - The hook guard that project installs write (the
sh -ccommand, its PowerShell twin and the OpenCode project plugin) no
longer runs aznornodethat sits in anode_modulesfolder. A package can plant azninnode_modules/.bin, and
npm runor direnv put that folder on the PATH, so the planted program could answer for the hook and allow a blocked
call. The guard now blocks with its usual message instead. Runzn hooks install <agent> --projectagain to update an
existing project hook. - The zn hooks now refuse a file write or shell command from the agent that would set
LD_TRACE_LOADED_OBJECTS, or
LD_DEBUGwithhelp, for the agent in a project.envor.gemini/.env(Write, Edit, patches and shell commands).
On Linux these variables stop every hook before it runs, so the edit is refused while the
hooks still work.zn auditand the hooks share one test for which settings count. - The same writes are also refused when they set
LD_PRELOAD,LD_AUDIT,DYLD_INSERT_LIBRARIESor another preload
variable to a value. - Shell commands can no longer write a project
.envor.gemini/.env: any shell write to these files is refused, including
redirections (also<>),tee,sed -i,cp,Set-Content, and any program that names the file (an interpreter,awk,
curl -o) unless it only reads or touches it. zn cannot know what the shell really runs. Use the editor tool instead; zn checks
what it writes. - Edits to a watched
.envfile by the agent's own file tools are judged on the file they would leave: zn applies the edit or
patch to the file on disk, and refuses the write when it cannot work out the result. - Any MCP tool call that names a project
.envor.gemini/.envis refused, whatever the server or the tool is called and even
with a body (a custom server can call an append or a copywrite_fileorread_file): use the agent's own file tools, which
zn can check. Copies, moves, renames and links through a tool zn does not know are refused too, as zn cannot see the file
they would leave. git checkout,git restore,git resetandgit stashin a shell command that names a project.envare refused: they
write stored content into the file.git add,git commitandgit rm --cachedstill pass. A tool zn does not know is read
under any key down to 6 levels of nesting for these files in Claude Code, Gemini CLI, Antigravity, ZCode and Copilot CLI, and a
call nested deeper, or with more than 500 objects, is refused (all of these agents except OpenCode);
OpenCode treats such a tool as an MCP call, and Codex CLI and Cursor never send one to the hook.- A write to a project
.envor.gemini/.envthrough a tool zn does not know is refused even when the call carries the
text: such a tool may append or insert it instead of writing the whole file. Only the agents' own whole-file write tools
and the edits and patches of their own editors, applied by zn to the file on disk, give zn the file a call leaves; no tool
name from an MCP server is trusted for that. - The Go client no longer sends the API key over plain http:
WithBaseURLaccepts an https URL, or http only forlocalhost,127.0.0.1and[::1], andAnalyzereturns an error wrappingErrInsecureBaseURLfor any other URL. A 200 answer whose verdict is missing or is notalloworblocknow returns an error wrappingErrUnexpectedResponseinstead of a result, so a check onres.Blocked()can no longer pass on a malformed answer. The Go client also refuses a redirect to plain http (except to localhost, 127.0.0.1 and [::1]) and returns an error wrappingErrInsecureBaseURLwithout sending the request, so the API key cannot travel in clear text after an https answer redirects. The check applies to a client you pass withWithHTTPClienttoo; your client is copied, not changed, and its ownCheckRedirectstill runs. The scheme rule is now enforced at the transport for every request the client sends, including after your ownCheckRedirectrewrites a redirect, and theAuthorizationheader is dropped for any host other than the base URL host. TheAuthorizationheader is also dropped on a cross-host request whatever its capitalization, so aCheckRedirectthat sets a lower-caseauthorizationkey cannot send the API key to another host. zn auditreports a project that setsLD_TRACE_LOADED_OBJECTS, orLD_DEBUG=help, for the agent as critical. On Linux
these variables make the system stop every program the agent starts before it runs, the shell of each zn hook included, so
the hooks cannot check or block anything. No hook can refuse them from inside; the threat model now says which agents
let such calls go ahead.zn runand the hook launchers on Linux and macOS also dropPYTHONUSERBASE, which can point Python at a user site directory whose start-up files run before the approved program.- On Linux, a user install for Claude Code and ZCode now starts the hook through a small
statically linked launcher.LD_TRACE_LOADED_OBJECTSorLD_DEBUG=helpin the agent's environment made the dynamic loader
exit before the hook ran, so the call went ahead unchecked. The launcher runs before any loader, denies the call in the
agent's own format whenLD_TRACE_LOADED_OBJECTSis set, orLD_DEBUG(any value),LD_DEBUG_OUTPUTor a preload
variable is set to a value that is not empty, and removes every loader variable before it starts
the hook. Without a matching launcher for the machine, the install keeps the earlier hook and says so. Codex CLI, Gemini CLI
and GitHub Copilot CLI are detection only, and so is Antigravity until its launch form is run with the real agent (the Claude Code form was verified with a real Claude Code 2.1.331 on x86_64 Linux):zn auditreports the variables as critical, the hook cannot refuse them, the call goes ahead. Cursor (not verified) and project installs are not covered either
(see the threat model). - A shell command that names a project
.envand is not a read-only or metadata-only command is now refused even while that
.envis a folder (for example a Python virtual environment). A program could remove the folder and write a.envfile
there after the check. Listing, reading, removing the folder and running the environment (source .env/bin/activate) still
pass; creating or recreating the environment under that name (python3 -m venv .env) is refused, so use another name for it. - A file name longer than 4096 characters, or a percent-encoded
file:address, that names a project.envis now refused in
an MCP call and in a tool zn does not know, in every agent, and in the file tools of Gemini CLI. Before, such a name was left
out of the check, so the call went ahead (for example a path padded with./before.env). A long name of another
protected file in a Gemini CLI file tool is refused the same way.
How to verify these files: docs/verify-release.md