question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Guidelines on using django-tenants in a secure manner

See original GitHub issue

Are there any guidelines on using django-tenants in a secure manner?

I can think of at least one issue by which using django-tenants could lead to a security vulnerability. By having 'django.contrib.sessions' in SHARED_APPS, can’t a user in one sub-domain/tenant impersonate a user in some other sub-domain/tenant?

While I am not sure if my guess is correct, we should have a section on security in the documentation and also have checks in the code that will catch insecurely configured projects.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:20 (15 by maintainers)

github_iconTop GitHub Comments

2reactions
suriyacommented, Aug 2, 2018

In a recent project, we have auth models in the public tenant and other models in the private ones. We don’t want a user who logically belongs to one tenant to access data in a different one. We have a custom middleware immediately after django.contrib.auth.middleware.AuthenticationMiddleware which raises 403 in case of cross-tenant access.

1reaction
tomturnercommented, Nov 13, 2015

@suriya Thanks for pointing this out. Yes it is a problem if you have you session table in your tenant I have proved it on two different projects. I agree we need to document this out. Please do as @kosz85 states and have the session table in each tenant. I will work on the documentation over the next week.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Guidelines on using django-tenants in a secure manner #52
We don't want a user who logically belongs to one tenant to access data in a different one. We have a custom middleware...
Read more >
Using django-tenants — django_tenants dev documentation
Creating a tenant works just like any other model in django. The first thing we should do is to create the public tenant...
Read more >
Use django-tenant-schemas to Create a Multi-Tenant App
Easier version management. · The data is secure and private because it is stored in independent databases. · Having multiple database instances ...
Read more >
A guide to design and develop a multi-tenant, secure and ...
In this guide you would learn how to use open technology stacks and a set of cloud services & platforms (that provide free...
Read more >
Securing Open Source Clouds Using Models
We detail the implementation of these models in Django Web Framework and also show how to use the behavioral interfaces to implement a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found