Repository navigation
[M2.3g2] Forced row security on audit events - #119
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
M2.3g2: forced row-level security on
audit_events, which completes M2.3g.20261105140000_audit_row_security:tenant_read(SELECT): only events of the activeapp.org_id. Account and system events (organization_idnull) are never readable by the runtime role.append(INSERT): allowed from every command transaction. Inside a tenant context, only events of that organization or of no organization.PrismaAuditEventStore.append. Now usescreateMany, which sends noRETURNINGclause. Row security checks a returned row as a read, so acreateof an account event would have failed.assertTenantDatabaseRole. It now requires 9 forced-RLS tables.testing/audit-log.tsreader reads stored events through the administrative login.integrationAppandfleetDatabaseregister and release it.prisma.auditEvent.withauditLog()..runtime-role.integration.spec.tsnow proves that the restricted login reads no account events, that a tenant context reads only its own events, and that it cannot append another tenant's.Why
The audit read API (M2.4a) must not be able to leak another tenant's history, even through a repository bug.
How it was tested
Security considerations