fix(security): skip row security enforcement for specific operations

* Add ShouldSkipRowSecurity function to determine when to bypass row security
* Update ApplyRowSecurity to utilize operation context for enforcement
This commit is contained in:
2026-09-20 15:51:02 +02:00
parent 4f6878099b
commit 87eaa9e18c
2 changed files with 57 additions and 17 deletions
+7
View File
@@ -31,6 +31,9 @@ func RegisterSecurityHooks(handler *Handler, securityList *security.SecurityList
// Hook 2: BeforeScan - Apply row-level security filters
handler.Hooks().Register(BeforeScan, func(hookCtx *HookContext) error {
secCtx := newSecurityContext(hookCtx)
if security.ShouldSkipRowSecurity(secCtx, hookCtx.Operation) {
return nil
}
return security.ApplyRowSecurity(secCtx, securityList)
})
@@ -97,6 +100,10 @@ func (s *securityContext) GetEntity() string {
return s.ctx.Entity
}
func (s *securityContext) GetOperation() string {
return s.ctx.Operation
}
func (s *securityContext) GetModel() interface{} {
return s.ctx.Model
}