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

Bridge should refrain from uploading htm/l files to the media server. #442

Closed
derram opened this issue Jun 2, 2018 · 8 comments
Closed
Labels
enhancement New feature or request
Milestone

Comments

@derram
Copy link

derram commented Jun 2, 2018

This just seems like a huge security hazard and I didn't see a way to prevent in on the caddy plugin side.

selection_215
selection_216

@42wim
Copy link
Owner

42wim commented Jun 3, 2018

I understand it could be annoying, but what exactly is the security hazard ?

Haven't tested it but I think you can get people to download the file instead of showing it (if that's the issue you're referring to) by using the mime setting

https://caddyserver.com/docs/mime

mime {
   .html application/octet-stream
   .htm application/octet-stream
}

@derram
Copy link
Author

derram commented Jun 4, 2018

Yes, displaying it is the problem because a malicious user could upload something bad enough to get a vps/domain provider to pull an account without appeal.

Using the mime setting would prevent me from setting my own index.html file to hide the file index as well, I believe.

@42wim
Copy link
Owner

42wim commented Jun 4, 2018

From the caddy docs.

By default, file listings are disabled and a 
request to a directory path (where no index file
is present) will result in a 404 for obscurity 
reasons.

So you don't need to put an index file yourself

@42wim
Copy link
Owner

42wim commented Jun 5, 2018

Could you confirm if this fixes your issue ?
It would be handy to have an extension blacklist filter though.

@42wim 42wim added the enhancement New feature or request label Jun 5, 2018
@derram
Copy link
Author

derram commented Jun 7, 2018

Maybe the upload plugin changes something because the file index was definitely visible before I set an index file.

Also I'm just using the caddy file from the media server setup documentation so I don't think it's anything in there.

@42wim
Copy link
Owner

42wim commented Jun 8, 2018

Oh, I see, if you used the documentation, please remove the browse command from your caddy config.
This will disable the index listing

@42wim 42wim added this to the 1.10.2 milestone Jun 9, 2018
@42wim
Copy link
Owner

42wim commented Jun 9, 2018

I've added an option to master so you can select which files can be blacklisted

#MediaDownloadBlacklist allows you to blacklist specific files from being downloaded.
#Filenames matching these regexp will not be download/uploaded to the mediaserver
#You can use regex for this, see https://regex-golang.appspot.com/assets/html/index.html for more regex info
#OPTIONAL (default empty)
MediaDownloadBlacklist=[".html$",".htm$"]

@42wim 42wim closed this as completed in bd9ea7a Jun 9, 2018
@derram
Copy link
Author

derram commented Jun 9, 2018

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants