{"id":34095504,"url":"https://github.com/kdpisda/django-rls","last_synced_at":"2026-04-08T19:31:34.591Z","repository":{"id":302149134,"uuid":"1010428978","full_name":"kdpisda/django-rls","owner":"kdpisda","description":"Row Level Security for Django","archived":false,"fork":false,"pushed_at":"2026-01-05T10:45:14.000Z","size":270,"stargazers_count":72,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-01-06T16:54:58.731Z","etag":null,"topics":["django","postgres","postgresql","rls","security"],"latest_commit_sha":null,"homepage":"https://django-rls.com/","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/kdpisda.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["kdpisda"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2025-06-29T03:46:58.000Z","updated_at":"2026-01-05T14:29:41.000Z","dependencies_parsed_at":"2025-06-30T21:35:32.785Z","dependency_job_id":null,"html_url":"https://github.com/kdpisda/django-rls","commit_stats":null,"previous_names":["kdpisda/django-rls"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/kdpisda/django-rls","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdpisda%2Fdjango-rls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdpisda%2Fdjango-rls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdpisda%2Fdjango-rls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdpisda%2Fdjango-rls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kdpisda","download_url":"https://codeload.github.com/kdpisda/django-rls/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdpisda%2Fdjango-rls/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31571600,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["django","postgres","postgresql","rls","security"],"created_at":"2025-12-14T15:14:26.099Z","updated_at":"2026-04-08T19:31:34.585Z","avatar_url":"https://github.com/kdpisda.png","language":"Python","funding_links":["https://github.com/sponsors/kdpisda"],"categories":[],"sub_categories":[],"readme":"# Django RLS\n\n[![PyPI version](https://badge.fury.io/py/django-rls.svg)](https://badge.fury.io/py/django-rls)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/django-rls)](https://pypi.org/project/django-rls/)\n[![CI](https://github.com/kdpisda/django-rls/actions/workflows/ci.yml/badge.svg)](https://github.com/kdpisda/django-rls/actions/workflows/ci.yml)\n[![Documentation](https://github.com/kdpisda/django-rls/actions/workflows/deploy-docs.yml/badge.svg)](https://django-rls.com)\n[![codecov](https://codecov.io/gh/kdpisda/django-rls/branch/main/graph/badge.svg)](https://codecov.io/gh/kdpisda/django-rls)\n[![Python Version](https://img.shields.io/pypi/pyversions/django-rls)](https://pypi.org/project/django-rls/)\n[![Django Version](https://img.shields.io/badge/django-5.0%20%7C%205.1%20%7C%205.2%20%7C%206.0-green.svg)](https://www.djangoproject.com/)\n[![License](https://img.shields.io/pypi/l/django-rls)](LICENSE)\n\nA Django package that provides PostgreSQL Row Level Security (RLS) capabilities at the database level.\n\nSee [CONTRIBUTING.md](.github/CONTRIBUTING.md).\n\n## Security\n\nSee [SECURITY.md](.github/SECURITY.md).\n\n## Features\n\n- 🔒 Database-level Row Level Security using PostgreSQL RLS\n- 🏢 Tenant-based and user-based policies\n- 🐍 **Pythonic Policies**: Define policies using standard Django `Q` objects\n- 🌳 **Hierarchical RLS**: Support for recursive CTEs and nested organizations\n- ⚡ **Context Processors**: Inject dynamic context variables (e.g. user IP, session data)\n- 🔧 Django 5.0, 5.1, 5.2 (LTS), and 6.0 support\n- 🧪 Comprehensive test coverage\n- 📖 Extensible policy system\n- ⚡ Performance optimized\n\n## Quick Start\n\n```python\nfrom django.db import models\nfrom django.db.models import Q\nfrom django_rls.models import RLSModel\nfrom django_rls.policies import ModelPolicy, RLS\n\nclass Project(RLSModel):\n    name = models.CharField(max_length=100)\n    owner = models.ForeignKey(User, on_delete=models.CASCADE)\n    is_public = models.BooleanField(default=False)\n\n    class Meta:\n        rls_policies = [\n            # Pythonic Policy: Owner OR Public\n            ModelPolicy(\n                'access_policy',\n                filters=Q(owner=RLS.user_id()) | Q(is_public=True)\n            ),\n        ]\n```\n\n## Installation\n\nInstall from PyPI:\n\n```bash\npip install django-rls\n```\n\nOr install the latest development version:\n\n```bash\npip install git+https://github.com/kdpisda/django-rls.git\n```\n\n### Requirements\n\n- Python 3.10, 3.11, 3.12, or 3.13\n- Django 5.0, 5.1, 5.2 (LTS), or 6.0\n- PostgreSQL 12 or higher (tested with PostgreSQL 17)\n\nAdd to your Django settings:\n\n```python\nINSTALLED_APPS = [\n    # ... your apps\n    'django_rls',\n]\n\nMIDDLEWARE = [\n    # ... your middleware\n    'django_rls.middleware.RLSContextMiddleware',\n]\n```\n\n## Documentation\n\nFull documentation is available at [django-rls.com](https://django-rls.com)\n\n### Quick Links\n\n- [Getting Started](https://django-rls.com/docs/intro)\n- [Installation Guide](https://django-rls.com/docs/installation)\n- [API Reference](https://django-rls.com/docs/api-reference)\n- [Examples](https://django-rls.com/docs/examples/basic-usage)\n\n## License\n\nBSD 3-Clause License - see LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdpisda%2Fdjango-rls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkdpisda%2Fdjango-rls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdpisda%2Fdjango-rls/lists"}