Files
hyperframes/packages/studio-server
Vance IngallsandClaude Sonnet 5 acdec1310c fix(vst-host): require a shared-secret token on the sidecar WebSocket
Finding 2 of the final whole-branch review: the sidecar's loopback
WebSocket accepted any connection with no origin/auth check, so any
local process (or webpage that guessed/scanned the ephemeral port)
could drive load-chain to load arbitrary native plugin bundles or read
arbitrary files via wavPath.

server.py's VstServer now generates a per-process secrets.token_urlsafe
token, prints it alongside the ready line, and rejects the WebSocket
handshake via websockets' process_request hook unless the connecting
client presents it as a `?token=` query param. Threaded through:
studio-server's vstSidecar.ts (extended ready-line regex) and
routes/vst.ts (/vst/start response), the CLI adapter, and the studio
client's useVstHost.ts (connects with the token in the WS URL).
vstBounce.ts (the offline render path) is unaffected — it invokes the
sidecar's `bounce` CLI subcommand directly and never opens a WebSocket.

Also folds in two smaller final-review findings that touch the same
files:

- vstSidecar.test.ts's mid-spawn-kill test used a fixed 300ms sleep to
  wait for the child's PID file; replaced with a short-interval poll
  (waitForFile) to remove a CI-contention flake risk.
- useVstHost.ts's handleDisconnect doc-comment claimed trackIndexRef was
  kept "purely for the FX property panel's own direct loadChain calls"
  — false (the FX panel never calls loadChain; only useVstPreview
  does). Corrected to describe it as forward-defensive infrastructure
  with no current FX-panel caller.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-16 18:53:17 -07:00
..