rupa / sprunge

command line pastebin for google appengine
http://sprunge.us
723 stars 70 forks source link

[Brute force] Prevent brute force query on sprunge #52

Open trinhnx opened 1 year ago

trinhnx commented 1 year ago

[Given] Sprunge is simple, get content then push, an URL is returned and that's it. It's quick. But now there is no way to control the content which is already pushed.

[Problem] The returned URL is simple and short enough for an attacker to write a simple create to crawl it all. I do not see any threshold limit or any mechanism related to prevent such dangerous action.

zzo38 commented 1 year ago

An advantage of a short URL is that you can easily write it down quickly. A disadvantage is what you describe. Using a cryptographic hash (e.g. SHA-3) instead would make it longer (and would lose the advantage of writing it down quickly), but avoids that problem as well as allowing to check for duplicates easily and you can verify the data easily enough (that it has not been tampered with) once you have the URL.