block api requests by referer

This commit is contained in:
Jack 2016-09-16 03:40:06 -04:00
parent a9e4343775
commit 7085b1e3c3

View file

@ -402,10 +402,16 @@ class LBRYDaemon(jsonrpc.JSONRPC):
def render(self, request):
origin = request.getHeader("Origin")
referer = request.getHeader("Referer")
if origin not in [None, 'http://localhost:5279']:
log.warning("Attempted api call from %s", origin)
return server.failure
if referer not in [None, 'http://localhost:5279/']:
log.warning("Attempted api call from %s", referer)
return server.failure
request.content.seek(0, 0)
# Unmarshal the JSON-RPC data.
content = request.content.read()