From 6015b2a9ee0c57227ed47e282229cd5c08ce6265 2014-12-02 21:12:13 From: Kyle Kelley Date: 2014-12-02 21:12:13 Subject: [PATCH] Handle CSP Reports --- diff --git a/IPython/html/services/security/__init__.py b/IPython/html/services/security/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/IPython/html/services/security/__init__.py diff --git a/IPython/html/services/security/handlers.py b/IPython/html/services/security/handlers.py new file mode 100644 index 0000000..1b842ed --- /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) +]