HaveAGitGat / Tdarr

Tdarr - Distributed transcode automation using FFmpeg/HandBrake + Audio/Video library analytics + video health checking (Windows, macOS, Linux & Docker)
Other
2.92k stars 92 forks source link

ffprobe is only executable by owner #1064

Closed patsoffice closed 1 week ago

patsoffice commented 3 weeks ago

Describe the bug The tdarr node's distribution has the ffprobe binary only executable by owner. That means that if tdarr node is installed by root but runs as a non-root user, it can't execute ffprobe.

To Reproduce Grabbing the latest Tdarr_Node ZIP file and extracting the contents:

root@tdarr-node-151:/tmp/node# wget https://f000.backblazeb2.com/file/tdarrs/versions/2.24.05/linux_x64/Tdarr_Node.zip root@tdarr-node-151:/tmp# mkdir node root@tdarr-node-151:/tmp# cd node/ root@tdarr-node-151:/tmp/node# unzip -q ../Tdarr_Node.zip

Listing the ffprobe binary:

root@tdarr-node-151:/tmp/node# ls -l ./node_modules/@ffprobe-installer/linux-x64/ffprobe -rwxr--r-- 1 root root 78926144 Aug 22 12:24 ./node_modules/@ffprobe-installer/linux-x64/ffprobe

Expected behavior The permissions for this file should be 755, not 744.

Screenshots N/A

Please provide the following information: This has only been checked on Linux but may also affect other platforms.

Additional context N/A

HaveAGitGat commented 2 weeks ago

I don't think that's quite right. If I create a non-root testuser I can unzip and run it fine as that user.

unzip -q ../Tdarr_Node.zip

ls -l ./node_modules/@ffprobe-installer/linux-x64/ffprobe
-rwxr--r-- 1 testuser testuser 78926144 Aug 22 12:24 ./node_modules/@ffprobe-installer/linux-x64/ffprobe

 ./node_modules/@ffprobe-installer/linux-x64/ffprobe
ffprobe version N-66595-gc2b38619c0-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2007-2023 the FFmpeg developers

It seems in your case you are unzipping as root and then running as non-root?

sudo unzip -q ../Tdarr_Node.zip

 ls -l ./node_modules/@ffprobe-installer/linux-x64/ffprobe
-rwxr--r-- 1 root root 78926144 Aug 22 12:24 ./node_modules/@ffprobe-installer/linux-x64/ffprobe

 ./node_modules/@ffprobe-installer/linux-x64/ffprobe
bash: ./node_modules/@ffprobe-installer/linux-x64/ffprobe: Permission denied
patsoffice commented 2 weeks ago

Yes, that's correct. However, this is literally the only binary that has owner-only execute permissions (that I saw).

root@tdarr-node-151:/tmp/node# find . -perm /u=x ! \( -perm /g=x -o -perm /o=x \) -type f -print0 | xargs -0 -n 10 ls -l
-rwxr--r-- 1 root root 78926144 Aug 22 12:24 ./node_modules/@ffprobe-installer/linux-x64/ffprobe
patsoffice commented 2 weeks ago

I updated the initial bug report and title to reflect the real issue.

HaveAGitGat commented 1 week ago

Sure I'll update that for next version

HaveAGitGat commented 1 week ago

Updated for next version.