From 050461ec83384c700507c59b01c8517edd607e6e Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Tue, 28 Jul 2026 12:01:53 -0700 Subject: [PATCH] fix: hoist STT credential read guard to the public transcribe_audio entry point The rebase onto #73510's prepare/dispatch split left the guard inside _transcribe_prepared_audio, where source validation ran first and a blocked .env surfaced a format error instead of the read-block message. Guard now fires before any validation/preprocessing. --- tools/transcription_tools.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/transcription_tools.py b/tools/transcription_tools.py index 2dc88f78fbb..54acdf72f7b 100644 --- a/tools/transcription_tools.py +++ b/tools/transcription_tools.py @@ -2397,6 +2397,15 @@ def _transcribe_prepared_audio(file_path: str, model: Optional[str] = None) -> D def transcribe_audio(file_path: str, model: Optional[str] = None) -> Dict[str, Any]: """Safely validate, preprocess supported inputs, and dispatch transcription.""" + # Refuse to feed a credential / secret store (auth.json, .env, OAuth + # tokens, mcp-tokens/, ...) to an STT provider — before ANY validation or + # preprocessing, so the refusal names the real reason rather than a + # format error. Mirrors the image-gen / video-gen read guards. + from agent.file_safety import get_read_block_error + blocked = get_read_block_error(file_path) + if blocked: + return {"success": False, "transcript": "", "error": blocked} + # Cap .silk sources before the decoder runs (decoder safety). For all # other inputs the remote-upload size cap is provider-scoped and enforced # in _transcribe_prepared_audio, so local whisper can handle big files.