pad to avoid oracle attacks on /api/known_instances
This commit is contained in:
parent
8cca6c2fe3
commit
ec10d15217
|
@ -4,6 +4,7 @@ from flask import jsonify, redirect, make_response, request, Response
|
||||||
from model import Account
|
from model import Account
|
||||||
import libforget.settings
|
import libforget.settings
|
||||||
import libforget.json
|
import libforget.json
|
||||||
|
import random
|
||||||
|
|
||||||
@app.route('/api/health_check')
|
@app.route('/api/health_check')
|
||||||
def health_check():
|
def health_check():
|
||||||
|
@ -68,6 +69,10 @@ def known_instances():
|
||||||
if not known:
|
if not known:
|
||||||
return Response('[]', 404, mimetype='application/json')
|
return Response('[]', 404, mimetype='application/json')
|
||||||
|
|
||||||
|
# pad to avoid oracle attacks
|
||||||
|
for _ in range(random.randint(0, 1000)):
|
||||||
|
known += random.choice((' ', '\t', '\n'))
|
||||||
|
|
||||||
return Response(known, mimetype='application/json')
|
return Response(known, mimetype='application/json')
|
||||||
|
|
||||||
elif request.method == 'DELETE':
|
elif request.method == 'DELETE':
|
||||||
|
|
Loading…
Reference in New Issue