fix: yt-dlp update failure when run as non-root user (#451)#458
fix: yt-dlp update failure when run as non-root user (#451)#458dialmaster merged 1 commit intodevfrom
Conversation
dialmaster
commented
Mar 15, 2026
- Move yt-dlp binary from /usr/local/bin/ to /opt/yt-dlp/ with world-writable permissions so non-root containers (YOUTARR_UID/GID) can perform self-updates
- Detect yt-dlp's "Unable to write to" error message in addition to "Permission denied" so users see the helpful platform-specific message instead of a generic exit code error
- Add test coverage
- Move yt-dlp binary from /usr/local/bin/ to /opt/yt-dlp/ with world-writable permissions so non-root containers (YOUTARR_UID/GID) can perform self-updates - Detect yt-dlp's "Unable to write to" error message in addition to "Permission denied" so users see the helpful platform-specific message instead of a generic exit code error - Add test coverage
📊 Test Coverage ReportBackend Coverage
Frontend Coverage
Coverage Requirements
Coverage report generated for commit 45021fa |
PR Review: fix: yt-dlp update failure when run as non-root userThe intent is solid. The JS-layer fix and test are clean. The Dockerfile approach has a security problem worth addressing before merge. Security Issue: World-Writable Binary (chmod 0777)Making both the directory and the binary itself world-writable means any process in the container can silently replace yt-dlp with arbitrary code. This is particularly risky because yt-dlp processes user-supplied URLs. If a malicious payload escaped the yt-dlp sandbox, a world-writable binary is an easy pivot point for persistence or further exploitation. Recommended fix: handle ownership in the entrypoint rather than relaxing permissions globally. Dockerfile at build-time with normal permissions: docker-entrypoint-simple.sh before starting the server: This way only the designated app user can write to the directory; all other processes get read/execute only. JS Fix (ytdlpModule.js): looks goodThe added "Unable to write to" detection is correct and minimal. That string is what yt-dlp emits on permission errors, so catching it here is the right fix. Test Coverage: looks goodThe new test accurately exercises the new error-string branch and verifies the user-facing result.message surfaces as "Permission denied". No issues. Minor Notes
Summary: please fix the chmod 0777 before merging. The entrypoint-based chown approach achieves the same goal without the world-writable binary risk. Everything else looks good. |
|
The Claude review is not quite correct: The entrypoint runs as the non-root user (set via user: |