other
Warning
- Location
- rules/transcribe-captions.md:21
- Finding
- Unrestricted Upload of Local Audio and Filename Metadata to a Third-Party Service<![CDATA[ ## Vulnerability Details **File Location**: `rules/transcribe-captions.md:21-42` **Vulnerability Type**: Sensitive Data Disclosure to a Third-Party Service **Risk Level**: Medium ### Vulnerable Code ```typescript import * as fs from 'fs'; const SKILLBOSS_API_KEY = process.env.SKILLBOSS_API_KEY; const API_BASE = 'https://api.skillbossai.com/v1'; async function transcribeAudio(audioFilePath: string): Promise<string> { const audioData = fs.readFileSync(audioFilePath).toString('base64'); const filename = audioFilePath.split('/').pop() ?? 'audio.mp3'; const r = await fetch(`${API_BASE}/pilot`, { method: 'POST', headers: { 'Authorization': `Bearer ${SKILLBOSS_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ type: 'stt', inputs: { audio_data: audioData, filename }, }), }); const result = await r.json(); return result.result.text; } ``` ### Technical Analysis The documented implementation accepts a local filesystem path, reads the entire referenced file using the privileges of the executing process, Base64-encodes its contents, and transmits both the contents and basename to `https://api.skillbossai.com/v1/pilot`. Base64 is only a transport encoding and does not provide confidentiality. The resulting request discloses the original audio to a third-party cloud service. Audio can contain confidential conversations, personal data, authentication phrases, customer information, or other regulated content. The filename may independently reveal project names, identities, case numbers, or other sensitive metadata. The example does not include: - Explicit, per-file consent before uploading data. - Validation that the path belongs to an approved media directory. - Protection against paths or symbolic links resolving to unintended files. - Audio MIME type or extension validation. - File-size or upload-volume limits. - A privacy, retention, or data-processing notice for the exter ...[truncated 2499 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. **Use local transcription by default** - Prefer `@remotion/install-whisper-cpp` or `@remotion/whisper-web`. - Treat cloud transcription as an explicit opt-in rather than the default recommendation. 2. **Obtain informed consent** - Before uploading, clearly identify the destination service and the data that will be sent. - Require explicit confirmation for each file or approved batch. - Document applicable retention, privacy, and data-processing terms. 3. **Restrict filesystem access** - Resolve the supplied path with `fs.realpath()`. - Require the resolved path to remain inside a configured media directory. - Reject directory traversal and symbolic links that escape the approved directory. - Do not accept arbitrary filesystem paths directly from untrusted users. 4. **Validate the selected file** - Permit only expected audio extensions and verified media types. - Enforce conservative file-size and duration limits before reading or uploading. - Prefer streaming or bounded reads for large files. 5. **Minimize disclosed metadata** - Do not send the original basename unless the service requires it. - If a name is required, replace it with a generated neutral identifier and a validated extension. - Avoid including local directory information in errors or telemetry. 6. **Harden network behavior** - Keep the destination on a strict HTTPS hostname allowlist. - Add an `AbortController` timeout. - Check `response.ok` before parsing the response. - Validate the response against an expected schema. - Do not automatically follow redirects to unapproved hosts. 7. **Handle credentials safely** - Fail closed when `SKILLBOSS_API_KEY` is missing. - Keep the key in a secret manager or protected environment variable. - Never expose the bearer token in client-side bundles, logs, or error messages. - Use a narrowly scoped credential where the provider supports one. 8. ** ...[truncated 249 chars]
