Skip to content

Commit deb5172

Browse files
committed
fix2
1 parent 8584f36 commit deb5172

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

src/Controllers/DatabaseController.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,19 +126,8 @@ const filterSensitiveData = (
126126
schema: SchemaController.SchemaController | any,
127127
className: string,
128128
protectedFields: null | Array<any>,
129-
object: any,
130-
query: any = {}
129+
object: any
131130
) => {
132-
if (!isMaster && !Array.isArray(protectedFields)) {
133-
protectedFields = new DatabaseController().addProtectedFields(
134-
schema,
135-
className,
136-
query,
137-
aclGroup,
138-
auth
139-
);
140-
}
141-
142131
let userId = null;
143132
if (auth && auth.user) userId = auth.user.id;
144133

@@ -1756,6 +1745,7 @@ class DatabaseController {
17561745
}
17571746

17581747
static _validateQuery: any => void;
1748+
static filterSensitiveData: (boolean, any[], any, any, any, string, any[], any) => void;
17591749
}
17601750

17611751
module.exports = DatabaseController;

src/LiveQuery/ParseLiveQueryServer.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
maybeRunAfterEventTrigger,
1818
} from '../triggers';
1919
import { getAuthForSessionToken, Auth } from '../Auth';
20-
import { getCacheController } from '../Controllers';
20+
import { getCacheController, getDatabaseController } from '../Controllers';
2121
import LRU from 'lru-cache';
2222
import UserRouter from '../Routers/UsersRouter';
2323
import DatabaseController from '../Controllers/DatabaseController';
@@ -553,16 +553,25 @@ class ParseLiveQueryServer {
553553
if (!obj) {
554554
return;
555555
}
556+
let protectedFields = classLevelPermissions?.protectedFields || [];
557+
if (!client.hasMasterKey && !Array.isArray(protectedFields)) {
558+
protectedFields = getDatabaseController(this.config).addProtectedFields(
559+
classLevelPermissions,
560+
res.object.className,
561+
query,
562+
aclGroup,
563+
clientAuth
564+
);
565+
}
556566
return DatabaseController.filterSensitiveData(
557567
client.hasMasterKey,
558568
aclGroup,
559569
clientAuth,
560570
op,
561571
classLevelPermissions,
562572
res.object.className,
563-
classLevelPermissions?.protectedFields,
564-
obj,
565-
query
573+
protectedFields,
574+
obj
566575
);
567576
};
568577
res.object = filter(res.object);

0 commit comments

Comments
 (0)