not-embeddable-frame.py (585B)
1 def main(request, response): 2 headers = [] 3 if request.GET.first(b'xFrameOptions', None): 4 headers.append((b'X-Frame-Options', request.GET[b'xFrameOptions'])) 5 6 csp_header = b'Content-Security-Policy-Report-Only' \ 7 if request.GET.first(b'reportOnly', None) == b'true' else b'Content-Security-Policy' 8 report_uri_base = request.GET.first(b'reportUriBase', b'') 9 headers.append((csp_header, b"frame-ancestors 'none'; report-uri " + report_uri_base + b"/reporting/resources/report.py?op=put&reportID=" + request.GET[b'reportID'])) 10 11 return headers, b'{}'