ash_postgres cross-tenant data exposure in lateral relationship joins
ash-project ash_postgres
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| ash-project ash_postgres |
| No fix yet |
| ash-project ash_postgres |
| No fix yet |
Original description
Incorrect Authorization vulnerability in ash-project ash_postgres allows a user to load destination records linked to a source record only through another tenant's join rows.
When a many_to_many relationship, or a through relationship, is loaded with a lateral join (for example with a per-record limit or sort), AshPostgres.DataLayer builds the query for the join resource, and for each resource along a through path, in lateral_join_query/3 and through_step_queries/4 without running that resource's read action, which is where attribute multitenancy is applied. When those resources use strategy :attribute multitenancy, rows belonging to other tenants were joined, so the load returned destination records that the caller's tenant is not related to.