Skip to content

Commit dda49d2

Browse files
committed
- Security Fix: Do not publish all of people collection.
Thanks to Adrian Genaid !
1 parent 53bd527 commit dda49d2

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

server/publications/people.js

+23-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
1-
Meteor.publish('people', (limit) => {
1+
Meteor.publish('people', function(limit) {
22
check(limit, Number);
3-
return Users.find({}, {
4-
limit,
5-
sort: {createdAt: -1},
6-
});
3+
4+
if (!Match.test(this.userId, String)) {
5+
return [];
6+
}
7+
8+
const user = Users.findOne(this.userId);
9+
if (user && user.isAdmin) {
10+
return Users.find({}, {
11+
limit,
12+
sort: {createdAt: -1},
13+
fields: {
14+
'username': 1,
15+
'profile.fullname': 1,
16+
'isAdmin': 1,
17+
'emails': 1,
18+
'createdAt': 1,
19+
'loginDisabled': 1,
20+
},
21+
});
22+
} else {
23+
return [];
24+
}
725
});

0 commit comments

Comments
 (0)