GNU/Linux xterm-256color zsh 6 views

Middleware in action: stripping dangerous commands from LLM responses

Demonstrates greyproxy’s per-request HTTP middleware feature. A Python WebSocket middleware inspects LLM API responses in real-time and strips dangerous shell commands (like init 0) before they reach the client.

First run: without middleware, opencode receives the raw LLM response and executes all commands, including init 0 (but blocked in the demo here by our greywall sandbox)

Second run: with the command-stripping middleware enabled (–middleware ws://localhost:9000/middleware), the proxy intercepts the response, the middleware detects init 0 as a halt system command, and replaces it with [STRIPPED: command removed by middleware] before it ever reaches opencode.

Works transparently with HTTP/2, SOCKS5, and compressed responses (gzip/zstd). The middleware sees decompressed plaintext regardless of what the client negotiated.