3 ms·
I'm a bit unclear on how you're preventing DOS attacks. Does the client have to request a "signed" URL from another part of the application first? If the user
by tlrobinson 19y ago
I'm a bit unclear on how you're preventing DOS attacks. Does the client have to request a "signed" URL from another part of the application first?
If the user has to login to your application, couldn't you just limit it based on that? Or by IP address? (of course that won't help against DDOS, but that's another problem all together...)
As far as hashing algorithms go, if you're just trying to keep an attacker from pounding your server in a DOS attack, any of the SHA1, SHA2, or MD5 should be fine, since even though there may be weaknesses, in reality it takes a long time to find collisions.
- brianr 19y agoFor performance reasons, we wanted to serve everything directly from the filesystem instead of dynamically using a script. If an image requested is not found, the 404 handler generates it, saves it to disk, and sends it back. The legitimate URLs are for 'static' images (static in the sense that once they have been generated, they will never need to be generated again) that are stored on disk using the filesystem. For example, an image url might look like: http://example.com/1e/2f/c/(image generation parameters).png The idea is that 1e2fc (the hash) serves as both the path on disk (so that files are roughly evenly distributed among the 2^20 directories) and as a checksum to prevent DOS.
- calambrac 19y agoHow does the user generate a legitimate new image? You aren't handing out the secret key to everyone, so I assume that's being handled in an application component?