File tree Expand file tree Collapse file tree
modules/dashboard/controllers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,8 +13,9 @@ module OrganizationScoped
1313 if org_id . present?
1414 where ( organization_id : org_id )
1515 else
16- Rails . logger . warn ( "[SCOPE] OrganizationScoped: Current.organization_id is nil for #{ name } " )
17- all
16+ # SECURITY: Fail-safe - retorna scope vazio em vez de expor dados de todas as orgs
17+ Rails . logger . error ( "[SECURITY] OrganizationScoped: organization_id is nil for #{ name } - BLOCKING ACCESS" )
18+ where ( '1=0' )
1819 end
1920 }
2021 end
Original file line number Diff line number Diff line change @@ -163,9 +163,9 @@ def roster_status_data
163163 def fetch_recent_activities
164164 # Fetch recent audit logs and format them.
165165 # includes(:user) preloads the user in one query — avoids N+1 on log.user&.email
166- activities = AuditLog
166+ # SECURITY: Use organization_scoped helper for consistent scoping
167+ activities = organization_scoped ( AuditLog )
167168 . includes ( :user )
168- . where ( organization : current_organization )
169169 . order ( created_at : :desc )
170170 . limit ( 20 )
171171
You can’t perform that action at this time.
0 commit comments