File tree Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ async function runFindTriggers(
34
34
options = { }
35
35
) {
36
36
const { isGet } = options ;
37
+
37
38
// Run beforeFind trigger - may modify query or return objects directly
38
39
const result = await triggers . maybeRunQueryTrigger (
39
40
triggers . Types . beforeFind ,
@@ -58,18 +59,11 @@ async function runFindTriggers(
58
59
59
60
// Security check: Re-filter objects if not master to ensure ACL/CLP compliance
60
61
if ( ! auth ?. isMaster && ! auth ?. isMaintenance ) {
61
- const inputArray = Array . isArray ( objectsFromBeforeFind )
62
- ? objectsFromBeforeFind
63
- : [ objectsFromBeforeFind ] ;
64
-
65
- const ids = inputArray
62
+ const ids = ( Array . isArray ( objectsFromBeforeFind ) ? objectsFromBeforeFind : [ objectsFromBeforeFind ] )
66
63
. map ( o => ( o && ( o . id || o . objectId ) ) || null )
67
64
. filter ( Boolean ) ;
68
65
69
- // If no valid ids are present, do not return unsanitized data
70
- if ( ids . length === 0 ) {
71
- objectsForAfterFind = [ ] ;
72
- } else {
66
+ if ( ids . length > 0 ) {
73
67
const refilterWhere = isGet ? { objectId : ids [ 0 ] } : { objectId : { $in : ids } } ;
74
68
75
69
// Re-query with proper security: no triggers to avoid infinite loops
You can’t perform that action at this time.
0 commit comments