Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
django-cookies-samesite-fork
Advanced tools
Middleware which sets SameSite flag for session and csrf cookies in legacy versions of Django. Forked from https://pypi.org/project/django-cookies-samesite/
.. image:: https://badge.fury.io/py/django-cookies-samesite.svg :target: https://badge.fury.io/py/django-cookies-samesite
.. image:: https://travis-ci.org/jotes/django-cookies-samesite.svg?branch=master :target: https://travis-ci.org/jotes/django-cookies-samesite
.. image:: https://codecov.io/gh/jotes/django-cookies-samesite/branch/master/graph/badge.svg :target: https://codecov.io/gh/jotes/django-cookies-samesite
Django 2.1.x introduces support of SameSite flag for session and csrf cookie.
Unfortunately, this functionality will not be ported to older versions of Django e.g. 1.11.x.
This repository contains a middleware which automatically sets SameSite attribute for session and csrf cookies in legacy versions of Django.
Install django-cookies-samesite::
pip install django-cookies-samesite
Add the middleware to the top of MIDDLEWARE_CLASSES
:
.. code-block:: python
MIDDLEWARE_CLASSES = (
'django_cookies_samesite.middleware.CookiesSameSite',
...
)
Set your preferred SameSite policy in settings.py
:
.. code-block:: python
SESSION_COOKIE_SAMESITE = 'Lax'
This can be 'Lax', 'Strict', or None to disable the flag.
Also, you can set this flag in your custom cookies:
.. code-block:: python
SESSION_COOKIE_SAMESITE_KEYS = {'my-custom-cookies'}
After that you should be able to see SameSite flag set for session and csrf cookies:
Does the code actually work?
::
source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox
Tools used in rendering this package:
cookiecutter-djangopackage
_.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _cookiecutter-djangopackage
: https://github.com/pydanny/cookiecutter-djangopackage
0.1.0 (2018-05-16) ++++++++++++++++++
FAQs
Middleware which sets SameSite flag for session and csrf cookies in legacy versions of Django. Forked from https://pypi.org/project/django-cookies-samesite/
We found that django-cookies-samesite-fork demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.