Socket
Socket
Sign inDemoInstall

django-http-referrer-policy

Package Overview
Dependencies
0
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    django-http-referrer-policy

django-http-referrer-policy provides a middleware class implementing the Referrer-Policy header for Django-powered sites.


Maintainers
1

Readme

============================= Django HTTP Referrer Policy

.. image:: https://badge.fury.io/py/django-http-referrer-policy.svg :target: https://badge.fury.io/py/django-http-referrer-policy

.. image:: https://travis-ci.org/DmytroLitvinov/django-http-referrer-policy.svg?branch=master :target: https://travis-ci.org/DmytroLitvinov/django-http-referrer-policy

.. image:: https://readthedocs.org/projects/django-http-referrer-policy/badge/?version=latest :target: https://django-http-referrer-policy.readthedocs.io/en/latest/?badge=latest :alt: Documentation Status

.. image:: https://codecov.io/gh/DmytroLitvinov/django-http-referrer-policy/branch/master/graph/badge.svg :target: https://codecov.io/gh/DmytroLitvinov/django-http-referrer-policy

django-referrer-policy provides a middleware class implementing the Referrer-Policy header <https://www.w3.org/TR/referrer-policy/>_ for Django <https://www.djangoproject.com/>_-powered sites.

Note: Starting from Django v3.0, Django itself has default support <https://docs.djangoproject.com/en/3.0/ref/middleware/#referrer-policy>_ of Referrer-Policy header in SecurityMiddleware via setting variable SECURE_REFERRER_POLICY.

Documentation

The full documentation is at https://django-http-referrer-policy.readthedocs.io.

Quickstart

Install Django HTTP Referrer Policy::

pip install django-http-referrer-policy

Add Django HTTP Referrer Policy Middleware to your settings:

.. code-block:: python

MIDDLEWARE = [
    ...
    'django_http_referrer_policy.middleware.ReferrerPolicyMiddleware',
    ...
]

Optional: provide variable REFERRER_POLICY to your settings with valid value if default value 'no-referrer-when-downgrade' does not suit to you:

.. code-block:: python

REFERRER_POLICY = 'no-referrer'

More details about valid referrer policies: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy#Syntax

Running Tests

Does the code actually work?

::

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Credits

Maintainable version of original library <https://github.com/ubernostrum/django-referrer-policy/>_.

Tools used in rendering this package:

  • Cookiecutter_
  • cookiecutter-djangopackage_

.. _Cookiecutter: https://github.com/audreyr/cookiecutter .. _cookiecutter-djangopackage: https://github.com/pydanny/cookiecutter-djangopackage .. _origin library: https://google.com

History

1.1.1 (2020-11-02) ++++++++++++++++++

  • Add deprecation warning about Django v3.0. Django itself has default support <https://docs.djangoproject.com/en/3.0/ref/middleware/#referrer-policy>_ of Referrer-Policy header in SecurityMiddleware via setting variable SECURE_REFERRER_POLICY.

1.1.0 (2020-10-27) ++++++++++++++++++

  • Set default value to 'no-referrer-when-downgrade' instead of requiring it
  • Add Django 3.1 and Python 3.9 for testing

1.0.1 (2019-08-23) ++++++++++++++++++

  • Update setup.py
  • Update docs for setting value in django-settings.

1.0.0 (2019-08-11) ++++++++++++++++++

  • First release on PyPI.

Keywords

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc