From 1f03954dd8ae9523da4e7d229c44f5c8adb7c42e Mon Sep 17 00:00:00 2001 From: Kyle Kelley Date: Sat, 22 Nov 2014 14:01:06 -0600 Subject: [PATCH] Handle CSP Reports --- IPython/html/services/security/__init__.py | 0 IPython/html/services/security/handlers.py | 17 +++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 IPython/html/services/security/__init__.py create mode 100644 IPython/html/services/security/handlers.py diff --git a/IPython/html/services/security/__init__.py b/IPython/html/services/security/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/IPython/html/services/security/handlers.py b/IPython/html/services/security/handlers.py new file mode 100644 index 000000000..1b842edeb --- /dev/null +++ b/IPython/html/services/security/handlers.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +class CSPReportHandler(IPythonHandler): + '''Accepts a content security policy violation report''' + @web.authenticated + @json_errors + def post(self): + '''Log a content security policy violation report''' + csp_report = self.get_json_body() + self.log.debug(csp_report) + +csp_report_uri = r"/api/security/csp-report" + +default_handlers = [ + (csp_report_uri, CSPReportHandler) +]