T09 · Insecure Skill Coding Practices
- Location
scripts/render_timeline.py:366- Finding
API Credential Disclosure Through an Attacker-Controlled API Origin
- Content
View full analysis
str: import requests resp = requests.post( f"{base_url.rstrip('/')}/emotion-enhance", headers={"Authorization": api_key, "Content-Type": "application/json"}, json={"text": text}, timeout=timeout, ) ``` ```python def _noiz_tts( base_url: str, api_key: str, cue: Cue, cfg: Dict[str, Any], output_format: str, timeout: int, out_path: Path, ) -> float: import requests url = f"{base_url.rstrip('/')}/text-to-speech" # ... resp = requests.post( url, headers={"Authorization": api_key}, data=payload, files=files, timeout=timeout, ) ``` ```python ap.add_argument("--api-key", help="API key (required for noiz backend)") ap.add_argument("--output", required=True, help="Output audio file") ap.add_argument("--base-url", default="https://noiz.ai/v1") ``` The main wrapper also forwards its loaded credential and all unrecognized render arguments: ```python render_argv = ["--srt", args.srt, "--voice-map", args.voice_map, "--output", args.output, "--backend", backend] if api_key: render_argv += ["--api-key", api_key] render_argv += extra ``` ```python parser = build_parser() # parse_known_args: extra unknown args are forwarded to render_timeline.py args, extra = parser.parse_known_args(argv) ``` ### Technical Analysis The timeline renderer accepts an unrestricted `--base-url` and attaches the Noiz API key to requests sent to that origin. It does not require HTTPS or verify that the destination hostname is `noiz.ai`. The primary `tts.py` entry point makes this more dangerous: it obtain ...[truncated 1580 chars]- Remediation
View remediation
