Show More
@@ -1,22 +1,23 | |||
|
1 | 1 | """Tornado handlers for security logging.""" |
|
2 | 2 | |
|
3 | 3 | # Copyright (c) IPython Development Team. |
|
4 | 4 | # Distributed under the terms of the Modified BSD License. |
|
5 | 5 | |
|
6 | 6 | from tornado import gen, web |
|
7 | 7 | |
|
8 | 8 | from ...base.handlers import IPythonHandler, json_errors |
|
9 | 9 | from . import csp_report_uri |
|
10 | 10 | |
|
11 | 11 | class CSPReportHandler(IPythonHandler): |
|
12 | 12 | '''Accepts a content security policy violation report''' |
|
13 | 13 | @web.authenticated |
|
14 | 14 | @json_errors |
|
15 | 15 | def post(self): |
|
16 | 16 | '''Log a content security policy violation report''' |
|
17 | 17 | csp_report = self.get_json_body() |
|
18 | self.log.warn(csp_report) | |
|
18 | self.log.warn("Content security violation: %s", | |
|
19 | self.request.body.decode('utf8', 'replace')) | |
|
19 | 20 | |
|
20 | 21 | default_handlers = [ |
|
21 | 22 | (csp_report_uri, CSPReportHandler) |
|
22 | 23 | ] |
General Comments 0
You need to be logged in to leave comments.
Login now