Files
Fast-Whisper-MCP-Server/test_filename_fix.py
Alihan fb1e5dceba Upgrade to PyTorch 2.6.0 and enhance GPU reset script with Ollama management
- Upgrade PyTorch and torchaudio to 2.6.0 with CUDA 12.4 support
- Update GPU reset script to gracefully stop/start Ollama via supervisorctl
- Add Docker Compose configuration for both API and MCP server modes
- Implement comprehensive Docker entrypoint for multi-mode deployment
- Add GPU health check cleanup to prevent memory leaks
- Fix transcription memory management with proper resource cleanup
- Add filename security validation to prevent path traversal attacks
- Include .dockerignore for optimized Docker builds
- Remove deprecated supervisor configuration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-27 23:01:22 +03:00

61 lines
1.5 KiB
Python

#!/usr/bin/env python3
"""
Quick manual test to verify the filename validation fix.
Tests the exact case from the bug report.
"""
import sys
sys.path.insert(0, 'src')
from utils.input_validation import validate_filename_safe, PathTraversalError
print("\n" + "="*70)
print("FILENAME VALIDATION FIX - MANUAL TEST")
print("="*70 + "\n")
# Bug report case
bug_report_filename = "This Weird FPV Drone only takes one kind of Battery... Rekon 35 V2.m4a"
print(f"Testing bug report filename:")
print(f" '{bug_report_filename}'")
print()
try:
result = validate_filename_safe(bug_report_filename)
print(f"✅ SUCCESS: Filename accepted!")
print(f" Returned: '{result}'")
except PathTraversalError as e:
print(f"❌ FAILED: {e}")
sys.exit(1)
except Exception as e:
print(f"❌ ERROR: {e}")
sys.exit(1)
print()
# Test that security still works
print("Verifying security (path traversal should still be blocked):")
dangerous_filenames = [
"../../../etc/passwd",
"../../secrets.txt",
"dir/file.m4a",
]
for dangerous in dangerous_filenames:
try:
validate_filename_safe(dangerous)
print(f"❌ SECURITY ISSUE: '{dangerous}' was accepted (should be blocked!)")
sys.exit(1)
except PathTraversalError:
print(f"'{dangerous}' correctly blocked")
print()
print("="*70)
print("ALL TESTS PASSED! ✅")
print("="*70)
print()
print("The fix is working correctly:")
print(" ✓ Filenames with ellipsis (...) are now accepted")
print(" ✓ Path traversal attacks are still blocked")
print()