{"id":13491054,"url":"https://github.com/mxsasha/django-restricted-sessions","last_synced_at":"2025-06-22T16:33:26.471Z","repository":{"id":14206878,"uuid":"16913570","full_name":"mxsasha/django-restricted-sessions","owner":"mxsasha","description":"Restrict Django sessions to IP and/or user agent.","archived":false,"fork":false,"pushed_at":"2023-06-02T11:12:46.000Z","size":50,"stargazers_count":82,"open_issues_count":0,"forks_count":24,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-09T20:05:58.100Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://django-restricted-sessions.readthedocs.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mxsasha.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2014-02-17T13:25:23.000Z","updated_at":"2025-01-16T02:00:11.000Z","dependencies_parsed_at":"2023-01-13T17:50:19.915Z","dependency_job_id":"27bcb067-ab92-4d12-b17e-60e8d1c32c79","html_url":"https://github.com/mxsasha/django-restricted-sessions","commit_stats":{"total_commits":35,"total_committers":6,"mean_commits":5.833333333333333,"dds":0.5428571428571429,"last_synced_commit":"5b03047ec0e6d51bf8d4f88f1e83c36363d6a064"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxsasha%2Fdjango-restricted-sessions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxsasha%2Fdjango-restricted-sessions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxsasha%2Fdjango-restricted-sessions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mxsasha%2Fdjango-restricted-sessions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mxsasha","download_url":"https://codeload.github.com/mxsasha/django-restricted-sessions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103871,"owners_count":21048245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T19:00:53.164Z","updated_at":"2025-04-09T20:06:03.326Z","avatar_url":"https://github.com/mxsasha.png","language":"Python","funding_links":[],"categories":["Libs"],"sub_categories":["Session management"],"readme":"=============================\ndjango-restricted-sessions\n=============================\n\n.. image:: https://badge.fury.io/py/django-restricted-sessions.png\n    :target: http://badge.fury.io/py/django-restricted-sessions\n\n.. image:: https://travis-ci.org/mxsasha/django-restricted-sessions.png?branch=master\n    :target: https://travis-ci.org/mxsasha/django-restricted-sessions\n\n.. image:: https://coveralls.io/repos/mxsasha/django-restricted-sessions/badge.png?branch=master\u0026\n    :target: https://coveralls.io/r/mxsasha/django-restricted-sessions?branch=master\n\nRestricts Django sessions to IP and/or user agent.\n\nIf the IP or user agent changes after creating the session, the a 400 response is given to the request, the session is\nflushed (all session data deleted, new session created) and a warning is logged. The goal of this middleware is to\nmake it harder for an attacker to use a session ID they obtained. It does not make abuse of session IDs impossible.\n\nFor compatibility with IPv6 privacy extensions, by default only the first 64 bits of an IPv6 address are checked.\n\nDocumentation\n-------------\n\nThe full documentation is at https://django-restricted-sessions.readthedocs.org.\n\nQuickstart\n----------\n\nInstall django-restricted-sessions::\n\n    pip install django-restricted-sessions\n\nThen add it to your middleware after SessionMiddleware::\n\n    MIDDLEWARE = [\n        \"django.middleware.security.SecurityMiddleware\",\n        \"django.contrib.sessions.middleware.SessionMiddleware\",\n        'restrictedsessions.middleware.RestrictedSessionsMiddleware',\n        ....\n    ]\n\nIf you use ``RESTRICTEDSESSIONS_AUTHED_ONLY``, ensure this middleware is added after\n``AuthenticationMiddleware`` so that the ``request.user`` is present.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmxsasha%2Fdjango-restricted-sessions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmxsasha%2Fdjango-restricted-sessions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmxsasha%2Fdjango-restricted-sessions/lists"}