fix: Parse Pointer allows to access internal Parse Server classes and circumvent beforeFind query trigger; fixes security vulnerability [GHSA-fcv6-fg5r-jm9q](https://github.com/parse-community/parse-server/security/advisories/GHSA-fcv6-fg5r-jm9q)

This commit is contained in:
Manuel
2023-09-04 14:19:48 +02:00
committed by GitHub
parent 328918178f
commit be4c7e23c6
12 changed files with 414 additions and 224 deletions

View File

@@ -603,7 +603,7 @@ RestWrite.prototype.handleAuthData = async function (authData) {
};
// The non-third-party parts of User transformation
RestWrite.prototype.transformUser = function () {
RestWrite.prototype.transformUser = async function () {
var promise = Promise.resolve();
if (this.className !== '_User') {
return promise;
@@ -618,19 +618,25 @@ RestWrite.prototype.transformUser = function () {
if (this.query && this.objectId()) {
// If we're updating a _User object, we need to clear out the cache for that user. Find all their
// session tokens, and remove them from the cache.
promise = new RestQuery(this.config, Auth.master(this.config), '_Session', {
user: {
__type: 'Pointer',
className: '_User',
objectId: this.objectId(),
const query = await RestQuery({
method: RestQuery.Method.find,
config: this.config,
auth: Auth.master(this.config),
className: '_Session',
runBeforeFind: false,
restWhere: {
user: {
__type: 'Pointer',
className: '_User',
objectId: this.objectId(),
},
},
})
.execute()
.then(results => {
results.results.forEach(session =>
this.config.cacheController.user.del(session.sessionToken)
);
});
});
promise = query.execute().then(results => {
results.results.forEach(session =>
this.config.cacheController.user.del(session.sessionToken)
);
});
}
return promise