Ensure Data Isolation Between Organisations During Aggregation
The platform serves multiple organisations (NHF, Blindeforbundet, HLF, Barnekreftforeningen) on shared infrastructure. During aggregation, the multi-org data isolator must enforce row-level security so that each coordinator's aggregation pipeline operates exclusively on their own organisation's records. This is both a data integrity requirement and a legal obligation under GDPR, as organisations must not process each other's beneficiary data.
User Story
Acceptance Criteria
- Given a coordinator from organisation A triggers aggregation, when the aggregation query runs, then only activity records with organisation A's tenant identifier are included
- Given the platform has records from multiple organisations, when aggregation completes, then the summary totals are consistent with the count of records belonging exclusively to the coordinator's organisation
- Given an attempt is made to access another organisation's records, when the query executes against Supabase, then row-level security policies block the access and no cross-org data is returned
- Given aggregation runs for a multi-chapter organisation, when chapter data is compiled, then all included chapters belong to the same organisation root
- Given a data isolation violation is detected during testing, when the violation is logged, then the aggregation is aborted and an error is returned rather than proceeding with contaminated data
Business Value
Sharing a multi-tenant platform across competing organisations demands strict data isolation. A cross-contamination incident would constitute a GDPR breach exposing beneficiary data, destroy trust between organisations, and potentially invalidate Bufdir submissions for multiple organisations simultaneously. Enforcing isolation at the database and service layer is a non-negotiable regulatory and contractual requirement.
Components
- Multi-Organization Data Isolator data
- Supabase Aggregation RPC Functions infrastructure
- Aggregation Query Builder data
- Bufdir Aggregation Service service
- Bufdir Metrics Repository data