pypi django-tenants 4.1.2

2 hours ago

Security release

This release stops clone_schema() from leaving cloned tenants using the source schema, and from dropping row-level security (GHSA-f56r-f5v7-m3v7, medium).

When a schema was cloned (CloneSchema().clone_schema(), the clone_tenant command, or tenants created from TENANT_BASE_SCHEMA), row-level security could be left off or lose FORCE; policies, functions pinned with SET search_path, SQL-standard function bodies, argument defaults and aggregates could keep reading or writing the source schema; and views lost security_invoker, security_barrier and check_option.

Affected: all versions before 4.1.2. All users who clone schemas should upgrade, especially projects that clone existing tenants or whose template schema uses row-level security, policies, functions or views with these options.

See the advisory for full details, workarounds and how to check tenants created by cloning.

Upgrade notes

  • A clone whose policies or functions would still depend on the source schema is now refused and rolled back.
  • These templates now make the clone fail instead of silently keeping references to the source schema: a policy using an object the clone doesn't copy (an operator, a text search configuration), an aggregate whose sort operator is in the source schema, a view calling a function that takes or returns a view's row type, and, when data is copied, a function taking or returning a materialized view's row type.
  • Cloned functions are now created with only the new schema in the search_path, so an unqualified name in them no longer finds a same-named object in public.

Full changelog: v4.1.1...v4.1.2

Don't miss a new django-tenants release

NewReleases is sending notifications on new releases.