Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup CLI command logic deletes all files using "Default File Download Template" #374

Open
imorland opened this issue Dec 5, 2023 · 5 comments
Assignees
Labels
bug keep Issues that should not be closed Stale

Comments

@imorland
Copy link
Member

imorland commented Dec 5, 2023

Related: #360 #352 #333

Reported on discuss: https://discuss.flarum.org/d/4154-friendsofflarum-upload-the-intelligent-file-attachment-extension/2234

I think the cleanup logic is faulty. I just executed it for the first time with --force and I didn't care to check if the files are indeed used (I don't know how to do that anyway, it just lists a URL but I can't possibly know/remember if such a file might be used anywhere on the forum or not...). I opened one of the important old discussion of the forum with many uploads inside and those uploads that were local and use the Download template are not working anymore and I don't keep the files anymore 😕 This is really bad... I can try restoring them from a backup of the forum though but I'm wondering on what other places it may have deleted files, e.g. Amazon where I don't have backups... Really having bad cold chills now, hopefully I haven't screwed my forum uploads for the last three years.

P.S. Warning!

I can confirm the cleanup logic is faulty. When a file was uploaded using the "Default File Download Template" in FoF Upload, the cleanup logic cannot map those files and would assume they are not used, while they are in fact used in posts, and would subsequently delete them from the corresponding storage, in my case local and AWS S3. "Fortunately" I deleted only files between January and December 2022 on my forum, but that's still a lot of files and I broke some of the most important discussions with audio files on my forum and it's a music related forum where people upload their own recordings, etc. To say it's disaster would be an understatement, since I don't have backups and we lost important content forever. I'll try to not be dramatic and just accept that sh1t happens from time to time and it was my turn today, not the end of world after all 😕 I probably lost some trust in my users since I have never screwed up that much and they trusted me that the forum is reliable for uploading files. But I would strongly advise people to be EXTREMELY careful before using the cleanup logic. Always make a backup not only of your forum, but also of all the files on external services such as AWS S3 because the cleanup can delete them too.

P.P.S. Is there any log of the cleanup command that I can find somewhere to at least list all the deleted files, so that I can warn people about the deletions?
@NathanSweet
Copy link

NathanSweet commented May 13, 2024

Spammers are composing a new post, uploading files to my server, not posting, and then using URLs to those files in their spam emails. I can't be giving spammers free hosting! Now that the spammers know about this exploit and are abusing it, all fof-upload users are at risk.

Is it safe to uncomment MapFilesCommand and run it? I'm using only adapters: default file download, just URL, and complete image preview template.

@NathanSweet
Copy link

I removed my site from the showcase since I expect now that spammers know Flarum can be abused, having a collection of sites to exploit is convenient.

@github-actions github-actions bot added the Stale label Jul 17, 2024
Copy link

This issue has been automatically closed because it received no activity for three months. If you think it was closed by accident, please leave a comment. If you are running into a similar issue on the latest version, please open a new issue. Thank you.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 17, 2024
@tipa
Copy link

tipa commented Nov 14, 2024

@imorland @DavideIadeluca why is this issue closed? Is this change permanent?
The command is still documented here

@DavideIadeluca
Copy link
Member

DavideIadeluca commented Nov 14, 2024

@tipa Thanks for highlighting. This issue got closed accidentally.

@DavideIadeluca DavideIadeluca added the keep Issues that should not be closed label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug keep Issues that should not be closed Stale
Projects
None yet
Development

No branches or pull requests

4 participants