Skip to main content

API endpoint for receiving incident reports from Content Security Policy (CSP), HTTP Public Key Pinning (HPKP), and the HTTP Reporting API.

Project description

Django Lookout

![Django Lookout logo: a lookout tower](./lookout/docs/logo.svg)

A Django-based API endpoint for collecting and processing automatic incident reports send by your visitors' web browsers. Currently that includes both [Content Security Policy]( (CSP) and [HTTP Public Key Pinning]( (HPKP), but support for additional report types is planned.

Before getting started you should familiarize yourself with the standards and their potential pitfalls ([especially HPKP]( The risks can be mitigated significantly by using Django Lookout along with report-only policies, which would still allow you to be notified of potential attacks without the risk of accidentally rendering your web site inaccessible.

It's important to note that Django Lookout only handles the *reporting* part of the process. Setting the headers which tell browsers what to do, or even where to send reports, is outside its scope. You'll need to set the `report-uri` property for CSP and/or HPKP to point to your Django Lookout endpoint.

## Install and Configure


* If you're using HPKP, Django Lookout *has* to be set up on a different domain name.

### Step 1

pip install Django-Lookout

Add the app to your Django project's ``:


### Step 2

Add the API endpoint to ``.

urlpatterns = [
# Django Lookout
url(r'^reporting', include('lookout.urls')),


* You can set the pattern to whatever you want. That's where you'll be pointing `report-uri`.
* Be mindful of trailing slashes.

### Step 3

Run the database migrations:

./ migrate lookout

## Useful Guides

### Content Security Policy

* [Google Web Fundamentals – Content Security Policy](
* [Content Security Policy - An Introduction](

### HTTP Public Key Pinning

* [Google – Rolling out Public Key Pinning with HPKP Reporting](
* [Guidance on setting up HPKP](

## Standards

Support for these standards is planned to be implemented in Django Lookout 1.0.

- [Out-of-Band Reporting API]( ✅
A generic incident reporting API that can be used by all of the following standards. Django Lookout automatically converts "legacy" incident reports to the generic schema.
- [Content Security Policy]( ✅
Browsers will (optionally) block unauthorized content and send an incident report if a resource is requested which isn't permitted by the policy.
- [HTTP Public Key Pinning]( ✅
Browsers supporting HPKP will (optionally) block connections and send an incident report if the site doesn't use the specified HTTPS certificate in the future.
- [Network Error Logging](
Browsers supporting NEL will send incident reports if a networking error is encountered when requesting content.
- [Expect-CT](
Browsers supporting Report-CT will send an incident report if it receives a certificate which doesn't adhere to [Certificate Transparency]( guidelines.
- [Expect-Staple](
Browsers supporting Expect-Staple will send an incident report if a TLS handshake with the site doesn't include an [OCSP response](

### Browser Implementation Status

No standards are currently supported across all major browsers, though it's hoped that the generic reporting API will significantly improve the situation in modern browsers.


* This table only considers a feature supported if it includes reporting functionality.
* Internet Explorer is excluded due to the fact that it doesn't support any of these features via standard headers.

| | Chrome | Edge | Firefox | Safari |
| ----------------------------------: | :------------- | :------------------------ | :----------------------- | :------------- |
| **Content Security Policy (CSP)** | Supported | [Supported][2] | Supported | [Supported][4] |
| **HTTP Public Key Pinning (HPKP)** | [Supported][5] | [Under Consideration][6] | [Not Supported][7] | Not Supported |
| **Out-of-Band Reporting API** | [Planned][9] | Not Supported | Not Supported | Not Supported |
| **Network Error Logging (NEL)** | [Planned][13] | [Under Consideration][14] | Not Supported | Not Supported |
| **Expect-CT** | [Planned][17] | [Planned][18] | ? | ? |
| **Expect-Staple** | ? | ? | ? | ? |

[2]: "Partial support for Level 3"
[4]: "Partial support for Level 3"

[6]: "Under Consideration"
[7]: "No report-uri or report-only support."


[13]: "No recent progress"


## Tools and Similar Projects

* [Observatory by Mozilla]( General website security testing suite.
* []( Testing suite for security-related HTTP response headers.
* [django-csp-reports]( A similar project specifically for CSP reports.
* []( A commercial service which serves a similar purpose. They also have some useful free testing tools.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Django-Lookout, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size Django_Lookout-0.1.2-py3-none-any.whl (24.9 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page