diff --git a/app.py b/app.py index 2523bc5..4fa9d21 100644 --- a/app.py +++ b/app.py @@ -690,11 +690,13 @@ async def run_job(job_id, job_data): jobs[job_id]['logs'].append("No metadata file generated.") else: jobs[job_id]['status'] = 'failed' - jobs[job_id]['logs'].append(f"Process failed with exit code {returncode}") + jobs[job_id]['logs'].append(_scrub_secrets(f"Process failed with exit code {returncode}")) except Exception as e: jobs[job_id]['status'] = 'failed' - jobs[job_id]['logs'].append(f"Execution error: {str(e)}") + # Exception text can embed URLs with credentials (e.g. the proxy URL + # inside a yt-dlp/httpx error) — scrub before it reaches client logs. + jobs[job_id]['logs'].append(_scrub_secrets(f"Execution error: {str(e)}")) @app.get("/health") async def health(): diff --git a/main.py b/main.py index 5e7a657..474e044 100644 --- a/main.py +++ b/main.py @@ -474,10 +474,9 @@ def download_youtube_video(url, output_dir="."): with open(cookies_path, 'w') as f: f.write(cookies_env) if os.path.exists(cookies_path): + # Never print file CONTENT here: with a headerless cookies + # blob this would leak live YouTube session cookies to logs. print(f" Debug: Cookies file created. Size: {os.path.getsize(cookies_path)} bytes") - with open(cookies_path, 'r') as f: - content = f.read(100) - print(f" Debug: First 100 chars of cookie file: {content}") except Exception as e: print(f"⚠️ Failed to write cookies file: {e}") cookies_path = None