Skip to main content

Utilities and a 'linter' to help you make your Django site more secure.

Project description

Helping you remember to do the stupid little things to improve your Django site’s security.

Inspired by Mozilla’s Secure Coding Guidelines, and intended for sites that are entirely or mostly served over SSL (which should include anything with user logins).

Quickstart

Dependencies

Tested with Django 1.2 through trunk, and Python 2.5 through 2.7. Quite likely works with older versions of both, though; it’s not very complicated.

Installation

Install from PyPI with pip:

pip install django-secure

or get the in-development version:

pip install django-secure==dev

Usage

  • Add "djangosecure" to your INSTALLED_APPS setting.

  • Add "djangosecure.middleware.SecurityMiddleware" to your MIDDLEWARE_CLASSES setting (where depends on your other middlewares, but near the beginning of the list is probably a good choice).

  • Set the SECURE_SSL_REDIRECT setting to True if all non-SSL requests should be permanently redirected to SSL.

  • Set the SECURE_HSTS_SECONDS setting to an integer number of seconds, if you want to use HTTP Strict Transport Security.

  • Set the SECURE_FRAME_DENY setting to True, if you want to prevent framing of your pages and protect them from clickjacking.

  • Set SESSION_COOKIE_SECURE and SESSION_COOKIE_HTTPONLY to True if you are using django.contrib.sessions. These settings are not part of django-secure, but they should be used if running a secure site, and the checksecure management command will check their values.

  • Run python manage.py checksecure to verify that your settings are properly configured for serving a secure SSL site.

Documentation

See the full documentation for more details.

CHANGES

0.1.0 (2011.05.29)

  • Initial release.

TODO

Project details


Download files

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

Source Distribution

django-secure-0.1.0.tar.gz (20.9 kB view details)

Uploaded Source

File details

Details for the file django-secure-0.1.0.tar.gz.

File metadata

File hashes

Hashes for django-secure-0.1.0.tar.gz
Algorithm Hash digest
SHA256 599690bed51965e9f2addb30a6ba0e61f5c14d47c3ad7671513127ce047948b2
MD5 b39b53af0a1aeffafc97631ac5c96a06
BLAKE2b-256 8001dbc0eb467e0de89bb979f6d87c3de9bdaa7d5f167c2c01ad668a1a888001

See more details on using hashes here.

Provenance

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