-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Describe the bug/problem
After updating to the latest version, where Python-magic has been addedd to validate myme-types (PR 3061), some uploads fail.
My assumption is that some magicnumbers might be missing, since it only appears to happen with some specific files.
Here's an example where both files are M4B (which is accepted according to EXTENSIONS_UPLOAD constant), but one uploads and the other doesn't:
The first one doesn't work, and I haven't been able to find any reference to that Magic number, although it appears to be some sort of reference to M4A and M4A is also accepted according to EXTENSIONS_UPLOAD constant:
0000 001c 6674 7970 4d34 4120 0000 0001 4d34 4120 6d70 3431 6d70 3432
-> Doesn't work
The second one does work and I've found it belongs to MPEG4 Part 14.
0000 0020 6674 7970 6973 6f6d 0000 0200 6973 6f32 6d70 3431 4d34 4120
-> Works
To Reproduce
Steps to reproduce the behavior:
- Drag & Drop an M4B file with the first magic number, such as the above M4B audiobook (upload expirates in 30days)
- See error "
File type isn't allowed to be uploaded to this server
":
Logfile
Add content of calibre-web.log file or the relevant error, try to reproduce your problem with "debug" log-level to get more output.
Expected behavior
All valid files should be accepted. Either this (and any other missing) magic number is also allowlisted, or instead we opt for a denylist approach with only malicious files (executables and such) are denied, which would be much more maintainable and aligned with any future improvement (such as the adition of a ClamAV or similar upload scan).
Environment (please complete the following information):
- OS: [Raspberry Pi OS]
- Python version: [python3.12]
- Calibre-Web version: [0.6.22]:
- Docker container: [LinuxServer]:
- Special Hardware: [Rasperry Pi 4B+]
- Browser: [Chrome 126.0.6478.127]
Additional context
N/A