fix(security): scrub credentials from ffmpeg/ffprobe media helpers - #73879
fix(security): scrub credentials from ffmpeg/ffprobe media helpers#73879Drexuxux wants to merge 1 commit into
Conversation
The TTS/STT command scrub (NousResearch#56332 / NousResearch#70342) and the voice-mode playback scrub established the rule: an OS media helper must not inherit Hermes credentials. ffmpeg and ffprobe are the same kind of process — third-party binaries shelled out to for transcoding and duration probes — and three of them still ran with the full process environment: - tools/tts_tool.py::_ffmpeg_transcode_to_opus — the voice-note OGG transcode, in the same file whose command provider was already scrubbed - plugins/platforms/telegram/adapter.py::_probe_voice_duration_seconds - plugins/platforms/discord/adapter.py::_probe_audio_duration_seconds Each one therefore saw every provider API key, bot token and SUDO_PASSWORD in the process env, on paths that run for ordinary inbound voice notes and outbound TTS replies. Pass hermes_subprocess_env(inherit_credentials=False), matching the sibling call sites. The NeuTTS synthesis subprocess is deliberately left alone: it runs Hermes's own tools/neutts_synth.py, not a third-party binary.
|
Thanks for tracing the ffmpeg/ffprobe paths and using the existing scrubber. The three changed call sites match the established mechanism in Problems
Suggested changes
Automated hermes-sweeper review. |
|
suggesting changes The three edited subprocesses now use a credential-scrubbed environment and the new tests pass, but the claimed media-helper invariant is incomplete. Multiple ffmpeg/ffprobe subprocesses in Discord, gateway, TTS, STT, Matrix, Signal, QQ, WhatsApp, and other plugins still inherit os.environ, so the residual credential exposure requires changes.
Security evidence:
Review setup: I reviewed a run-owned local rebase or patch replay against current GitHub Not checked:
Signed: GPT-5.6-luna-max in Codex |
What
The TTS/STT command scrub (#56332 / #70342) and the voice-mode playback scrub established the rule that an OS media helper must not inherit Hermes credentials.
ffmpegandffprobeare the same kind of process — third-party binaries Hermes shells out to for transcoding and duration probes — and three of them still ran with the full process environment:tools/tts_tool.py::_ffmpeg_transcode_to_opusplugins/platforms/telegram/adapter.py::_probe_voice_duration_secondsplugins/platforms/discord/adapter.py::_probe_audio_duration_secondsEach one saw every provider API key, bot token and
SUDO_PASSWORDpresent in the process env. The first is in the same file whose command provider was already scrubbed — a sibling path of the very fix that introduced the rule.Fix
Pass
hermes_subprocess_env(inherit_credentials=False), matching the sibling call sites (voice playback, TTS/STT command provider, transcription).Deliberately left alone: the NeuTTS synthesis subprocess in the same file — it runs Hermes's own
tools/neutts_synth.py, not a third-party binary.Tests
tests/tools/test_media_helper_env_scrub.py— seedsOPENAI_API_KEY/ANTHROPIC_API_KEY/TELEGRAM_BOT_TOKEN, captures the spawn kwargs and asserts none of them reach the child. Mirrors the existingtest_voice_mode_playback_env_scrub.py.main(env is None— the helper inherited everything) and pass with this change.pytest tests/tools/ -q -k "tts or voice or transcription"→ 927 passed / 17 pre-existing failures; the stashed baseline shows the same 17 (18 there only because the new tts test is counted before the fix).pytest tests/gateway/ -q -k "telegram or discord"→ 2431 passed / 14 failed, byte-identical to the stashed baseline.