django-tenants bug could leave database connections on the wrong tenant schema
A security advisory, GHSA-q7xr-949m-53qg, was published for django-tenants on 2026-11-17, covering versions below 4.0.5. Under certain conditions, the library's tenant context managers could leave a database connection pointed at another tenant's schema, causing subsequent queries to silently read and write that tenant's data. The flaw surfaced in setups using multiple database aliases, where the switching logic did not consistently target the intended connection. The author reported the issue, and the eventual fix amounts to adding a missing reference, though the underlying code had existed for years before the multi-alias feature exposed it. The write-up uses the case to illustrate how two individually correct statements can be wrong when combined.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in