Fix download forgery

This commit is contained in:
rubenwardy
2019-11-18 21:42:56 +00:00
parent 3f666d2302
commit ff2a74367f
5 changed files with 32 additions and 17 deletions

13
app/rediscache.py Normal file
View File

@@ -0,0 +1,13 @@
from . import r
# This file acts as a facade between the releases code and redis,
# and also means that the releases code avoids knowing about `app`
def make_download_key(ip, package):
return ("{}/{}/{}").format(ip, package.author.username, package.name)
def set_key(key, v):
r.set(key, v)
def has_key(key):
return r.exists(key)