Merge pull request #167 from lbryio/block-api-requests-by-referer

block api requests by referer
This commit is contained in:
Jack Robison 2016-09-16 03:49:55 -04:00 committed by GitHub
commit b3a16f95f7

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()