Relationships are able to cross tenants with attribute strategy
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Inizia eseguendo i due test sulle relazioni tra tenant introdotti nel commit d8f62872e94bb8e7e115d7e24ec715142ffe4142, quindi confronta il comportamento con la modifica in 0adec1d1634387367bb818e40711e34ceb8cb3e4. Leggi la guida di Ecto sulle foreign key nel multi-tenancy e traccia la generazione della migration coinvolta. Il lavoro è completo quando le relazioni tramite chiave primaria rifiutano gli insert tra tenant a livello di database senza compromettere il caso affrontato da #144.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
Ash Postgres currently allows relating two resources from two different tenants when using attribute strategy and referencing the primary key of the other resource.
To Reproduce
Here is a commit that adds two tests that manage cross-tenant relationships.
The one that references the primary key is able to add a cross-tenant relationship, the other correctly fails (with a rather cryptic error message though, so I'm not sure if it's actually failing for the right reason).
Expected behavior
I would expect cross-tenant relationship not to be possible
Runtime
- Elixir version: 1.15.4
- Erlang version: 26.0.2
- OS: Debian Testing
- Ash Postgres version:
main
Additional context
The Ecto guide covers this usecase by adding composite foreign keys to disallow inserting cross-tenant associations.
This is what happens for relationships referencing non-primary key attributes, and it was happening also for primary key attributes before 0adec1d1634387367bb818e40711e34ceb8cb3e4.
That commit was made to fix the error shown in #144, but I think that the fix shouldn't have been dropping the composite foreign key, but rather adding the extra [:id, :org_id] unique index in the migration generator (should this be added for all multitenant-attribute resources or just as soon as their primary key gets referenced for the first time?), as is also shown in the Ecto guide.
Of course the cross-tenant relationship is correctly filtered out when reading the resource so it can't be retrieved, but I think it would be better to disallow its creation completely at the database level given there's the possibility to do so.
- Lingua principale
- Elixir
- Stelle
- 191
- Fork
- 186
- Merge medio
- 16h 4m
- PR unite (30g)
- 17
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ash-project/ash_postgres
-
Temporal: an update or destroy as of an instant doesn't carry into later versionsForse già presa @hoanle0126 l’ha presa 14 giorni fa. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
ash-project/ash_postgres#915 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
has_create_action?/1 excludes manual creates, making the #49 nullability fix inert on AshEvents resourcesForse di nuovo libera @Mckay-Hinds l’ha presa 19 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
ash-project/ash_postgres#851 · 9 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
ash-project/ash_postgres#650 · 6 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
ash-project/ash_postgres#642 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 40/100
ash-project/ash_postgres#628 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ash-project/ash_postgres
Issue simili
-
Flaky testApertadette technique
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
etalab/transport-site#5701 ·
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
@swmansion/popcorn: published .d.ts files lack extensions on relative imports, breaking moduleResolution node16/nodenextForse già presa @Huyvux12 l’ha presa 1 giorno fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
software-mansion/popcorn#929 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
intellij-elixir/intellij-elixir#4705 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
phoenixframework/phoenix#6908 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno