Skip to content

fix: security hardening, memory leak, file cleanup, and UX improvements#3

Open
salmanrajz wants to merge 2 commits intoaverygan:mainfrom
salmanrajz:fix-audit-improvements
Open

fix: security hardening, memory leak, file cleanup, and UX improvements#3
salmanrajz wants to merge 2 commits intoaverygan:mainfrom
salmanrajz:fix-audit-improvements

Conversation

@salmanrajz
Copy link
Copy Markdown

Security:

  • Add URL validation (http/https only) on all endpoints
  • Add format_id sanitization to prevent yt-dlp flag injection
  • Add job_id format validation (hex, 10 chars)
  • Add path traversal protection on file serving endpoint
  • Add non-root user in Dockerfile
  • Mask internal errors from API responses
  • Add .env and .vscode/ to .gitignore

Stability:

  • Add threading lock for jobs dict (race condition fix)
  • Add job TTL auto-purge (1hr) to prevent memory exhaustion
  • Add MAX_JOBS cap (500) with 503 response when full
  • Add JSON parse error handling in /api/info
  • Add explicit debug=False on Flask entry point

File management:

  • Add /api/cleanup endpoint for client-triggered file removal
  • Frontend calls cleanup 5s after save to free disk space
  • Pin dependency versions in requirements.txt

UX/Frontend:

  • Fix dlAll() to properly await each download via Promise-based polling
  • Add ARIA labels on interactive elements
  • Improve title sanitization (80 char limit, control char removal, no hidden files)

DevEx:

  • Add structured logging throughout backend
  • Add type hints on all functions
  • reclip.sh now always runs pip install on venv reuse
  • reclip.sh adds exit trap for clean shutdown message

Security:
- Add URL validation (http/https only) on all endpoints
- Add format_id sanitization to prevent yt-dlp flag injection
- Add job_id format validation (hex, 10 chars)
- Add path traversal protection on file serving endpoint
- Add non-root user in Dockerfile
- Mask internal errors from API responses
- Add .env and .vscode/ to .gitignore

Stability:
- Add threading lock for jobs dict (race condition fix)
- Add job TTL auto-purge (1hr) to prevent memory exhaustion
- Add MAX_JOBS cap (500) with 503 response when full
- Add JSON parse error handling in /api/info
- Add explicit debug=False on Flask entry point

File management:
- Add /api/cleanup endpoint for client-triggered file removal
- Frontend calls cleanup 5s after save to free disk space
- Pin dependency versions in requirements.txt

UX/Frontend:
- Fix dlAll() to properly await each download via Promise-based polling
- Add ARIA labels on interactive elements
- Improve title sanitization (80 char limit, control char removal, no hidden files)

DevEx:
- Add structured logging throughout backend
- Add type hints on all functions
- reclip.sh now always runs pip install on venv reuse
- reclip.sh adds exit trap for clean shutdown message
nandanosql referenced this pull request in nandanosql/reclip Apr 7, 2026
- Add POST /api/batch/download endpoint accepting multiple URLs
- Add GET /api/batch/status/<batch_id> for batch progress tracking
- Use ThreadPoolExecutor with 3 concurrent workers for parallel downloads
- Limit batch to 20 URLs per request
- Update frontend 'Download All' to use batch API instead of sequential
- Fallback to sequential download if batch API fails
- Batch status shows done/errors/pending counts

Fixes #3
DeBondor added a commit to DeBondor/reclip that referenced this pull request Apr 11, 2026
…dening, memory leak, UX)

- Pin yt-dlp>=2026.3.17 to fix YouTube SABR 403 errors (fixes averygan#8)
- Add --upgrade-deps to reclip.sh venv setup
- Add URL validation (http/https only)
- Add format_id sanitization against yt-dlp flag injection
- Add job_id format validation
- Add path traversal protection on file serving
- Add non-root user in Dockerfile
- Add threading lock for jobs dict (race condition fix)
- Add job TTL auto-purge (1hr) + MAX_JOBS cap (500)
- Add /api/cleanup endpoint + frontend cleanup call after download
- Add structured logging + type hints
- Fix dlAll() to await each download via Promise-based polling
- Add ARIA labels on interactive elements
- Improve title sanitization (80 char limit)
- reclip.sh: always run pip install on venv reuse
- reclip.sh: add EXIT trap for clean shutdown message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant