fix /csp_violations
parent
24ba5a6663
commit
ae83aa15ed
|
@ -356,17 +356,12 @@ def donate(v):
|
||||||
return render_template(f'donate_{SITE_NAME}.html', v=v)
|
return render_template(f'donate_{SITE_NAME}.html', v=v)
|
||||||
|
|
||||||
|
|
||||||
items_we_want = ('blocked-uri', 'document-uri', 'effective-directive', 'source-file', 'violated-directive')
|
|
||||||
|
|
||||||
@app.post('/csp_violations')
|
@app.post('/csp_violations')
|
||||||
@limiter.limit("10/minute;50/day")
|
@limiter.limit("10/minute;50/day")
|
||||||
def csp_violations():
|
def csp_violations():
|
||||||
content = json.dumps(request.get_json())
|
content = request.get_json(force=True)['csp-report']
|
||||||
try:
|
print('--------', flush=True)
|
||||||
if content["source-file"].startswith(SITE_FULL):
|
for k, val in content.items():
|
||||||
print('--------', flush=True)
|
print(f"{k}: {val}", flush=True)
|
||||||
for i in items_we_want:
|
print('--------', flush=True)
|
||||||
print(f"{i}: {content['i']}", flush=True)
|
|
||||||
except:
|
|
||||||
print(content, flush=True)
|
|
||||||
return ''
|
return ''
|
||||||
|
|
Loading…
Reference in New Issue