Skip to content

Commit f86176d

Browse files
fix(users): remove overly aggressive search validation that broke internal queries
The repository-level object check rejected all object values including legitimate MongoDB operators ($in, etc.) used by seed and internal code. NoSQL injection is already prevented at controller boundaries via String() coercion and key allowlists.
1 parent 1cbcc41 commit f86176d

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

modules/users/repositories/users.repository.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,7 @@ const get = (user = {}) => {
7676
* @param {Object} mongoose input request
7777
* @returns {Array} users
7878
*/
79-
const search = (input) => {
80-
for (const value of Object.values(input)) {
81-
if (typeof value === 'object' && value !== null) {
82-
throw new Error('Invalid search parameter');
83-
}
84-
}
85-
return User.find(input).exec();
86-
};
79+
const search = (input) => User.find(input).exec();
8780

8881
/**
8982
* @desc Function to update a user in db

0 commit comments

Comments
 (0)