Skip to content

Commit 19e4da9

Browse files
committed
fix 2
1 parent 49a4afc commit 19e4da9

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

Diff for: src/Controllers/DatabaseController.js

+2-12
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,8 @@ const filterSensitiveData = (
130130
schema: SchemaController.SchemaController | any,
131131
className: string,
132132
protectedFields: null | Array<any>,
133-
object: any,
134-
query: any = {}
133+
object: any
135134
) => {
136-
if (!isMaster && !Array.isArray(protectedFields)) {
137-
protectedFields = new DatabaseController().addProtectedFields(
138-
schema,
139-
className,
140-
query,
141-
aclGroup,
142-
auth
143-
);
144-
}
145-
146135
let userId = null;
147136
if (auth && auth.user) userId = auth.user.id;
148137

@@ -1821,6 +1810,7 @@ class DatabaseController {
18211810
}
18221811

18231812
static _validateQuery: any => void;
1813+
static filterSensitiveData: (boolean, any[], any, any, any, string, any[], any) => void;
18241814
}
18251815

18261816
module.exports = DatabaseController;

Diff for: src/LiveQuery/ParseLiveQueryServer.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
toJSONwithObjects,
1919
} from '../triggers';
2020
import { getAuthForSessionToken, Auth } from '../Auth';
21-
import { getCacheController } from '../Controllers';
21+
import { getCacheController, getDatabaseController } from '../Controllers';
2222
import LRU from 'lru-cache';
2323
import UserRouter from '../Routers/UsersRouter';
2424
import DatabaseController from '../Controllers/DatabaseController';
@@ -598,14 +598,24 @@ class ParseLiveQueryServer {
598598
if (!obj) {
599599
return;
600600
}
601+
let protectedFields = classLevelPermissions?.protectedFields || [];
602+
if (!client.hasMasterKey && !Array.isArray(protectedFields)) {
603+
protectedFields = getDatabaseController(this.config).addProtectedFields(
604+
classLevelPermissions,
605+
res.object.className,
606+
query,
607+
aclGroup,
608+
clientAuth
609+
);
610+
}
601611
return DatabaseController.filterSensitiveData(
602612
client.hasMasterKey,
603613
aclGroup,
604614
clientAuth,
605615
op,
606616
classLevelPermissions,
607617
res.object.className,
608-
classLevelPermissions?.protectedFields,
618+
protectedFields,
609619
obj,
610620
query
611621
);

0 commit comments

Comments
 (0)