Saltar al contenido
Sırdaş

Air-gapped demo: the Gateway against a local model, with zero egress

El Gateway contra un modelo local, con la red cortada y una captura que no depende del producto.

Para tu agente de IA

Pega esto en Claude, ChatGPT o Cursor y el agente se instala y se configura solo, leyendo la versión en Markdown de esta página.

Ver Markdown (para agentes)

La documentación técnica está en inglés, que es lo que leen las herramientas y los agentes.

SIRDAS_GATEWAY_LOCAL_ONLY and the /v1 handling are in @sirdaspdf/gateway since 0.6.0. The demo script lives in the repository, which is private for now; with the published package you can reproduce every check by hand: see Reproduce it with your own capture.

The Gateway redacts a request before it reaches a model. When the model is also on your machine (Ollama, vLLM, LM Studio, llama.cpp), the whole chain runs without a network. This page shows a demo that proves it with checks that do not take the product's word for it, and says what each check does not prove.

One run does four things:

  1. Sends a synthetic intake form (a made-up patient: name, date of birth, SSN, MRN, email, phone, address) through the Gateway to a local model.
  2. Compares what the client sent, what the model received (recorded by a server the demo controls, not by the Gateway) and what the client got back. It fails if any original value reached the model.
  3. Runs sirdas comprobar (the local self-check) and keeps its fingerprint.
  4. Measures egress with up to four methods, and writes a JSON report with no value from the document in it.

Run it

From a checkout of the repository, on Linux:

npm ci && npm run build:packages
node scripts/airgap-demo.mjs                 # report in $TMPDIR/sirdas-airgap-<time>.json
node scripts/airgap-demo.mjs --out report.json

By default the model is a stand-in written in the script: an OpenAI-compatible server on 127.0.0.1 that records every byte it receives and answers with the placeholders it saw (the record is for [PERSON_1], reachable at [EMAIL_1]…). The Gateway turns them back into the real values, so the client's answer shows the round trip. The stand-in is not a language model; it exists so the demo is fast, deterministic and runs in CI.

Abbreviated output:

2. Local stand-in model received:
   | Patient name: [PERSON_1]
   | SSN: [SSN_1]
   | Email: [EMAIL_1]
   PASS  original values found in what the model received: 0
3. Client got back (restored by the gateway):
   | … the record is for Maria Elena Whitfield, reachable at maria.whitfield@example.com …
4. sirdas comprobar: PASS  fingerprint ace83995…
5. Egress (non-loopback traffic):
   PASS  network namespace: interfaces [lo], probe 192.0.2.1 -> ENETUNREACH
   PASS  kernel socket table: 158 samples, 6 loopback connections seen, 0 non-loopback
   PASS  in-process Node hook (not independent): 0 non-loopback attempts
   ----  tcpdump: not run (tcpdump is not installed)

The exit code is 0 only if every check passed.

FlagEffect
--out <file>Where to write the JSON report (default: the OS temp directory)
--ollamaUse a real Ollama instead of the stand-in
--ollama-url <url>Default http://127.0.0.1:11434; must be this machine
--model <name>Ollama model; default the first one Ollama lists
--no-netnsDo not re-run inside a network namespace
--fastSkip tcpdump even if it is available
--inject-leakSelf-test: puts a value where the Gateway does not redact and opens a non-loopback connection. The demo must fail

With Ollama

ollama pull llama3.2                       # needs the network once
node scripts/airgap-demo.mjs --ollama      # or --model qwen2.5:7b

A recording relay on 127.0.0.1 sits between the Gateway and Ollama and forwards bytes unchanged, so "what the model received" is still measured, not reported. A real model chooses what to repeat, so with Ollama the demo checks that no placeholder is left in the answer instead of requiring every value back.

Ollama listens on the host's loopback, which a new network namespace cannot reach, so --ollama runs without one and the report says so. To keep the namespace, start Ollama inside it; the demo detects that it is already isolated:

unshare -rn sh -c 'ip link set lo up; ollama serve & sleep 3; node scripts/airgap-demo.mjs --ollama'

Point the Gateway at a local model yourself

OPENAI_UPSTREAM=http://127.0.0.1:11434 \
ANTHROPIC_UPSTREAM=http://127.0.0.1:11434 \
SIRDAS_GATEWAY_LOCAL_ONLY=1 \
npx -y @sirdaspdf/gateway@0.6.0
  • OPENAI_UPSTREAM accepts the base with or without a trailing /v1 (the form Ollama, vLLM and LM Studio document) since 0.6.0; 0.5.1 needed it without.
  • Since 0.6.0, SIRDAS_GATEWAY_LOCAL_ONLY=1 refuses to start unless both upstreams are given and are 127.0.0.0/8, ::1 or localhost. Without it, an unset upstream falls back to the official API. Set ANTHROPIC_UPSTREAM as well even if you only use one route. Version 0.5.1 and earlier ignore the variable.
  • A base URL with credentials, a query string or a scheme other than http/https stops the Gateway at startup (since 0.6.0).

What each egress check proves

CheckHowProvesDoes not prove
Network namespaceThe script re-runs itself under unshare -rn (unprivileged; no sudo). Inside, it checks /proc/net/dev lists only lo and that a connection to 192.0.2.1 and 2001:db8::1 (documentation addresses) failsEvery process of the demo had no interface other than loopback. A packet to another host had nowhere to go, whatever the code doesAnything about a run outside the namespace, or about a model running elsewhere
Kernel socket tableReads /proc/net/{tcp,tcp6,udp,udp6} every 5 ms and keeps the sockets owned by the demo's processes (matched by inode through /proc/<pid>/fd)The OS, not the product, never listed a peer outside loopback for those processes. loopback_connections_seen shows the method does see connectionsIt samples: a connection that opens and closes between two reads is missed
Node hookA module loaded with --import into every Node process records net, dgram and dns.lookup calls to non-loopback hostsNo such call was made from JavaScriptIt is not independent: it runs inside the processes it watches, and native code or c-ares DNS would bypass it
tcpdumpIf installed and allowed to capture, tcpdump -i any with a filter that drops loopback-to-loopback packetsNo non-loopback packet was seen while the demo ranOn a shared host other processes' traffic also counts; it needs capture privileges

--inject-leak validates the checks the other way round: in the namespace the Node hook catches the attempt (it cannot leave); outside, the connection goes to this machine's own non-loopback address, which the kernel delivers without a packet leaving the host, and both the socket table and the hook report it.

unshare -rn needs unprivileged user namespaces. Some distributions disable them (for example, Ubuntu 24.04 with kernel.apparmor_restrict_unprivileged_userns=1). The demo then runs the other checks and the report says why the namespace was not used; it never reports a check that did not run as passed.

Reproduce it with your own capture

You do not need to trust the script. On a dedicated VM or host, start your own capture first, then the demo (or your own client against the Gateway):

sudo tcpdump -i any -nn -w airgap.pcap \
  'not (src net 127.0.0.0/8 and dst net 127.0.0.0/8) and not (src host ::1 and dst host ::1)' &
node scripts/airgap-demo.mjs --no-netns --out report.json
sudo kill -INT %1
tcpdump -nn -r airgap.pcap | wc -l          # packets that were not loopback-to-loopback

In Wireshark, open airgap.pcap or capture live with the display filter !(ip.src == 127.0.0.0/8 && ip.dst == 127.0.0.0/8) && !(ipv6.src == ::1 && ipv6.dst == ::1). A shared host will show other processes' traffic; to attribute it, capture inside a namespace that only the demo uses:

unshare -rn sh -c 'ip link set lo up
  tcpdump -i any -nn -w /tmp/ns.pcap & sleep 1
  node scripts/airgap-demo.mjs --out report.json; kill -INT $!'

With the published packages only, the same chain is: start Ollama, start npx -y @sirdaspdf/gateway@0.6.0 with the variables above, send a request to http://127.0.0.1:8787/openai/v1/chat/completions, and run npx -y sirdas@0.6.0 comprobar while the capture runs. A container with --network none gives the same isolation as unshare -rn.

The report

--out gets a JSON file meant to be attached to a security review. It carries counts, placeholder names, the body the model received (placeholders only; it is left out if any original value got through), the fingerprint and failed checks of sirdas comprobar, and each egress method with what it proves. The script refuses to write it if any value from the synthetic document appears in it.

Limits

  • The document is synthetic and short. Redaction is rule-based and is not perfect: see the limits in the Gateway guide. The demo shows where the data goes, not that every identifier in every document is found.
  • The default model is a stand-in, not a language model.
  • This is a demo you run yourself. It is not a certification or an audit, and Sırdaş holds no SOC 2 or ISO 27001 certification.