Skip to content

Security: MatthewNorton/terminal-fm

SECURITY.md

Security policy

Reporting a vulnerability

Please do not open a public issue for a security problem. Open a private security advisory on the repository instead: on GitHub, go to the repository's Security tab, choose Report a vulnerability, and describe the issue, how to reproduce it, and the version or commit you tested. You will get a reply through the advisory thread. If private reporting is not available to you, open a plain issue that says only "security report, please contact me" without details, and the maintainer will open the advisory.

Supported versions

Only the latest release is supported. Fixes land on the main branch and ship in the next release; older tags receive no patches.

Security model

Terminal FM is a local, single-user command-line tool run from Claude Code (as the terminal-fm plugin, or a manual install) or from a shell. What follows describes the design as it stands.

  • No network listener. The radio opens no ports. A detached background daemon plays audio from a local folder and coordinates with the CLI only through files in the data directory (~/.claude/terminal-fm by default, or the folder named by TERMINAL_FM_HOME).
  • Outbound connections. radio gen, radio egen and the credit-balance check call https://api.stability.ai (the three URLs under stability_api in config.json) over TLS: Python's urllib with certificate verification and User-Agent terminal-fm/1.0, and stability_api.ca_bundle may point verification at a PEM file such as certifi's. The DJ, the local model (llama-cli, run as a local process) and playback make no network calls. The one other caller is radio setup <extra> install, only when you run it (in Claude Code, only after you say yes): it downloads from github.com and huggingface.co (both redirect to their CDNs), pip fetches the voice's packages from PyPI, and on a machine with no suitable Python it runs winget or brew to install Python 3.13. Each file it downloads itself is pinned in radio.py to a size and SHA-256 its publisher lists, and a file that doesn't match is deleted. The Python packages are not pinned: pip installs what PyPI serves for kokoro-onnx>=0.6 and soundfile, into the voice's own environment.
  • The Hugging Face login. radio setup tokenizer install reads your token from HF_TOKEN, HUGGING_FACE_HUB_TOKEN or the file huggingface_hub keeps (HF_TOKEN_PATH, else <HF_HOME>/token), sends it as a Bearer header to huggingface.co only (a redirect keeps it only while it stays on the same scheme, host and port, so the CDN never gets it), and never prints or stores it. Claude never asks for it.
  • The API key. Read from <data dir>/.key first, then from the STABILITY_API_KEY environment variable. The repository ships no key and .key is git-ignored. radio key reads the key at a hidden prompt (never as an argument, so it stays out of shell history and process listings), writes it atomically through a temp file created with 0600 permissions on POSIX, so no other user can read it at any point. If that rename is refused, it writes .key directly, still with 0600 permissions applied before the key goes in. On Windows the file gets the data directory's default permissions. radio key show prints only whether a key is set and where it came from, never any of its characters. The key is sent only as a Bearer header to the stability_api URLs.
  • The curl fallback. If Python's own request never connects (a DNS, TCP or TLS failure, not an HTTP error), radio.py retries through the system curl when one is present. The Authorization header goes to curl through a config read from stdin (curl -K -), so the key never appears on curl's command line or in a process listing, and form fields are passed with --form-string, so a prompt starting with @ or < is sent as text and never makes curl read a local file. On Windows 10 the fallback cannot reach the API at all (Schannel curl has no TLS 1.3), so it is effectively inert there.
  • Local files the radio writes. state.json (pids and playback position), nowplaying.txt, config.json, playlist.json, resume.json, last_*.json, the queue/ folder of pending DJ lines, breaking.txt, prompt_history.jsonl (every prompt and idea you generate from, append-only), .kokoro_python (an interpreter path), dj_engine.log, and statusline.py (copied from the plugin by the SessionStart hook). setup <extra> install adds the voice's Python environment (kokoro/venv/), the models, llama.cpp's files in llm/bin/, and .part files while a download is in progress. Anything you would not want in a shared folder is best kept out of TERMINAL_FM_HOME.
  • dj_engine.log keeps text. Every spoken line appends one record naming the TTS engine used, why, the interpreter, and the first 60 characters of the spoken text. Spoken lines come from radio say, play --say and the Claude Code Stop hook, so the log can contain fragments of your Claude session. Delete or rotate it as you see fit; the radio only appends.
  • The Stop hook reads Claude's last message. When Claude Code runs radio.py hook Stop (through the plugin's hooks/radio-hook.sh, or a settings.json entry on the manual install), the hook receives Claude Code's JSON on stdin. It takes cwd for the project name and Claude's last message from the last_assistant_message field, which Claude Code sends with Stop (seen on version 2.1.296); when that field is present the session transcript is never opened. Only when it is absent, as on older Claude Code versions, does the hook read the transcript JSONL at the transcript_path it is given, trusting that input, and it reads no other transcript. The extracted text goes to the DJ queue (a file in queue/), the TTS engine, and dj_engine.log as above. Nothing is read unless music is playing or radio announce is on. Turn narration off by uninstalling the plugin (or not adding the manual hooks), or keep the hooks and leave radio announce off and the radio stopped.
  • Subprocesses. The radio launches the audio player, the TTS engine (kokoro_tts.py through a probed Python interpreter, or the system fallback), llama-cli for the local model, ffmpeg for radio format wav+mp3, and optionally curl. setup <extra> install also runs python -m venv, pip, winget or brew, and the downloaded llama-cli --version before moving it into place; it unpacks llama.cpp's archive itself and refuses one holding anything but plain files and links to files beside them, or any path that climbs out of its folder. The plugin's hook launcher, hooks/radio-hook.sh, runs a working python3, python or py found on PATH. All are found on PATH or in the data directory; an attacker who can write to those locations can already run code as you. Prompts and DJ lines are passed as arguments or on stdin, never through a shell; the TTS engines get the spoken text on stdin or from a file, so a line starting with - can't become an option.
  • Install from GitHub or a clean copy, never from a data directory. The .gitignore keeps the key, settings, library and models out of the repository, but it does not protect a directory-source install: claude plugin marketplace add <local path> plus claude plugin install copies the whole folder, .key included, into ~/.claude/plugins/cache/, and claude plugin uninstall leaves that copy behind.
  • Third-party models and binaries are not bundled; you download them, by hand or with setup <extra> install (see THIRD_PARTY_NOTICES.md). By hand, verify what you download against its source page.

Out of scope

Weaknesses in the audio players, TTS engines, llama.cpp, FFmpeg, curl or the Stability API belong to those projects. Misuse of a leaked Stability key is between you and Stability: rotate the key at https://platform.stability.ai if you suspect exposure.

There aren't any published security advisories