forked from MarseyWorld/MarseyWorld
fix csp violation
parent
98f262e640
commit
c326c999f2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -335,11 +335,14 @@ 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 = request.get_json(force=True)
|
content = json.dumps(request.get_json())
|
||||||
content = str(json.dumps(content, indent=4, sort_keys=True))
|
if content["source-file"].startswith(SITE_FULL):
|
||||||
if f'"source-file": "{SITE_FULL}' in content:
|
print('--------', flush=True)
|
||||||
print(content, flush=True)
|
for i in items_we_want:
|
||||||
|
print(f"{i}: {content['i']}")
|
||||||
return ''
|
return ''
|
||||||
|
|
Loading…
Reference in New Issue