Personally I'm a big fan of hosting everything myself, just because of the privacy aspect. For that reason I try to use external files as least as possible. Nevertheless, I'm wondering if it is a security risk to hotlink to files other than JavaScript files.
The risk of hotlinking to an external JavaScript file seems pretty clear to me. Since that other domain will be able to execute anything in the clients browser, on your domain. So it's not about JavaScript files. I'm just talking about files like images, cascading style sheets and for example PDF, office or MP3 files.
On the other hand, what if the scenario is exactly other way around? What risks can you potentially face when people are hot-linking to your files or images? I know some anti hotlinking methods, some of them use a mod_rewrite approach, which is based on a referrer that can be easily spoofed.
So I have three questions:
- Is hotlinking to external file (like described above) dangerous or can it be a potential risk to your website or website visitors?
- Can you face a risk yourself when people are hotlinking to self-hosted files, other then a availability risk?
- When question number 2 is a risk: What are the best practices to protect your files from being hotlinked by others?