Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
fix: add security validations to custom endpoint feature
Gabriel Stein7dc28474253e
diff --git a/src/components/AIModelSelectorEnhanced.tsx b/src/components/AIModelSelectorEnhanced.tsxindex 78ad81454..f0e4ac7a6 100644--- a/src/components/AIModelSelectorEnhanced.tsx+++ b/src/components/AIModelSelectorEnhanced.tsx@@ -224,6 +224,16 @@ export default function AIModelSelectorEnhanced({return;}+ // Security: Only allow HTTPS endpoints (except localhost for development)+ const isLocalhost = normalizedBase.includes('://localhost') || normalizedBase.includes('://127.0.0.1');+ if (!normalizedBase.startsWith('https://') && !isLocalhost) {+ if (isMountedRef.current && latestReasoningBaseRef.current === normalizedBase) {+ setCustomModelsError('Only HTTPS endpoints are allowed (except localhost for testing).');+ setCustomModelsLoading(false);+ }+ return;+ }+const headers: Record<string, string> = {};if (apiKey) {headers.Authorization = `Bearer ${apiKey}`;diff --git a/src/components/OnboardingFlow.tsx b/src/components/OnboardingFlow.tsxindex f233c81d8..882a9bccf 100644--- a/src/components/OnboardingFlow.tsx+++ b/src/components/OnboardingFlow.tsx@@ -156,6 +156,13 @@ export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) {setCustomModelsLoading(true);setCustomModelsError(null);try {+ // Security: Only allow HTTPS endpoints (except localhost for development)+ const isLocalhost = normalizedReasoningBaseUrl.includes('://localhost') ||+ normalizedReasoningBaseUrl.includes('://127.0.0.1');+ if (!normalizedReasoningBaseUrl.startsWith('https://') && !isLocalhost) {+ throw new Error('Only HTTPS endpoints are allowed (except localhost for testing).');+ }+const headers: Record<string, string> = {};const trimmedKey = apiKey.trim();if (trimmedKey) {diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.jsindex cb6cb9047..ff375b480 100644--- a/src/helpers/audioManager.js+++ b/src/helpers/audioManager.js@@ -1,4 +1,4 @@-import TextCleanup from "../utils/textCleanup";+import TextCleanup from "../utils/textCleanup";import ReasoningService from "../services/ReasoningService";import { API_ENDPOINTS, buildApiUrl, normalizeBaseUrl } from "../config/constants";@@ -626,6 +626,13 @@ class AudioManager {return API_ENDPOINTS.TRANSCRIPTION;}+ // Security: Only allow HTTPS endpoints (except localhost for development)+ const isLocalhost = normalizedBase.includes('://localhost') || normalizedBase.includes('://127.0.0.1');+ if (!normalizedBase.startsWith('https://') && !isLocalhost) {+ console.warn('Non-HTTPS endpoint rejected for security. Using default.');+ return API_ENDPOINTS.TRANSCRIPTION;+ }+if (/\/audio\/(transcriptions|translations)$/i.test(normalizedBase)) {return normalizedBase;}diff --git a/src/services/ReasoningService.ts b/src/services/ReasoningService.tsindex 6f8c4efdc..ff75522b3 100644--- a/src/services/ReasoningService.ts+++ b/src/services/ReasoningService.ts@@ -1,4 +1,4 @@-import { getModelProvider } from "../utils/languages";+import { getModelProvider } from "../utils/languages";import { BaseReasoningService, ReasoningConfig } from "./BaseReasoningService";import { SecureCache } from "../utils/SecureCache";import { withRetry, createApiRetryStrategy } from "../utils/retry";@@ -39,7 +39,19 @@ class ReasoningService extends BaseReasoningService {const stored = window.localStorage.getItem('cloudReasoningBaseUrl') || '';const trimmed = stored.trim();const candidate = trimmed || API_ENDPOINTS.OPENAI_BASE;- return normalizeBaseUrl(candidate) || API_ENDPOINTS.OPENAI_BASE;+ const normalized = normalizeBaseUrl(candidate) || API_ENDPOINTS.OPENAI_BASE;++ // Security: Only allow HTTPS endpoints (except localhost for development)+ const isLocalhost = normalized.includes('://localhost') || normalized.includes('://127.0.0.1');+ if (!normalized.startsWith('https://') && !isLocalhost) {+ debugLogger.logReasoning('OPENAI_BASE_REJECTED', {+ reason: 'Non-HTTPS endpoint rejected for security',+ attempted: normalized+ });+ return API_ENDPOINTS.OPENAI_BASE;+ }++ return normalized;} catch {return API_ENDPOINTS.OPENAI_BASE;}