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 logo: a lookout tower

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

Notes

  • 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 settings.py:

INSTALLED_APPS = [
    ...
    'lookout',
    ...
]

Step 2

Add the API endpoint to urls.py.

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

Notes

  • 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:

./manage.py migrate lookout

Useful Guides

Content Security Policy

HTTP Public Key Pinning

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.

Notes

  • 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

Supported

Supported

HTTP Public Key Pinning (HPKP)

Supported

Under Consideration

Not Supported

Not Supported

Out-of-Band Reporting API

Planned

Not Supported

Not Supported

Not Supported

Network Error Logging (NEL)

Planned

Under Consideration

Not Supported

Not Supported

Expect-CT

Planned

Planned

?

?

Expect-Staple

?

?

?

?

Tools and Similar Projects

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

Django_Lookout-0.1.1-py3-none-any.whl (22.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page