blob: 08c061da45567e5f35e2521707ab7dcd65572f61 [file] [log] [blame]
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +01001# Copyright 2016 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
Copybara854996b2021-09-07 19:36:02 +00004
5"""Servlet for Content Security Policy violation reporting.
6See http://www.html5rocks.com/en/tutorials/security/content-security-policy/
7for more information on how this mechanism works.
8"""
9from __future__ import print_function
10from __future__ import division
11from __future__ import absolute_import
12
Adrià Vilanova Martínez9f9ade52022-10-10 23:20:11 +020013import flask
Copybara854996b2021-09-07 19:36:02 +000014import logging
15
16
Adrià Vilanova Martínez9f9ade52022-10-10 23:20:11 +020017def postCsp():
Copybara854996b2021-09-07 19:36:02 +000018 """CSPReportPage serves CSP violation reports."""
Adrià Vilanova Martínez9f9ade52022-10-10 23:20:11 +020019 logging.error('CSP Violation: %s' % flask.request.get_data(as_text=True))
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +010020 return ''