You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(security): enforce referenced-object RLS/FLS on $expand (#2850) (#2961)
* fix(security): enforce referenced-object RLS/FLS on $expand (#2850)
`expandRelatedRecords` resolved lookup/master_detail/user references by
calling the driver directly, so the REFERENCED object's row- and
field-level security never ran — only tenant isolation survived. Any
API/session caller who could read a base row could `?expand=` a foreign
key and receive the full referenced record, including RLS-hidden rows and
FLS-masked fields.
Route the expand batch through the engine's own `find` so the security
middleware applies the referenced object's RLS + FLS to the `id $in [...]`
batch (one query, no N+1). The read is tagged with a server-set
`__expandRead` context marker; the security middleware waives ONLY the
object-level CRUD / requiredPermissions gate for PUBLIC referenced objects
(already broadly readable — avoids over-blocking common status/owner
lookups), while PRIVATE referenced objects keep the full gate. RLS
injection and FLS masking run for both. Covers the list and single-record
REST/protocol surfaces (find + findOne).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh6cpe9MV7bMiXvooeWLH9
* chore: add changeset for #2850
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vh6cpe9MV7bMiXvooeWLH9
---------
Co-authored-by: Claude <zhuangjianguo@steedos.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
0 commit comments