Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 1 | # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style |
| 3 | # license that can be found in the LICENSE file or at |
| 4 | # https://developers.google.com/open-source/licenses/bsd |
| 5 | |
| 6 | """Servlet for Content Security Policy violation reporting. |
| 7 | See http://www.html5rocks.com/en/tutorials/security/content-security-policy/ |
| 8 | for more information on how this mechanism works. |
| 9 | """ |
| 10 | from __future__ import print_function |
| 11 | from __future__ import division |
| 12 | from __future__ import absolute_import |
| 13 | |
Adrià Vilanova Martínez | 9f9ade5 | 2022-10-10 23:20:11 +0200 | [diff] [blame^] | 14 | import flask |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 15 | import logging |
| 16 | |
| 17 | |
Adrià Vilanova Martínez | 9f9ade5 | 2022-10-10 23:20:11 +0200 | [diff] [blame^] | 18 | def postCsp(): |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 19 | """CSPReportPage serves CSP violation reports.""" |
Adrià Vilanova Martínez | 9f9ade5 | 2022-10-10 23:20:11 +0200 | [diff] [blame^] | 20 | logging.error('CSP Violation: %s' % flask.request.get_data(as_text=True)) |