Merge pull request from GHSA-8w3j-g983-8jh5

* Add Test and Authenticator for ghsa-8w3j-g983-8jh5

* fix for ghsa-8w3j-g983-8jh5

* nit whitespace

not sure why lint isn't catching...
This commit is contained in:
Fabian Strachanski
2019-07-10 15:47:23 +02:00
committed by Arthur Cinader
parent 050dd19e80
commit 73b0f9a339
3 changed files with 68 additions and 10 deletions

View File

@@ -449,17 +449,10 @@ RestWrite.prototype.handleAuthData = function(authData) {
let results;
return this.findUsersWithAuthData(authData).then(async r => {
results = this.filteredObjectsByACL(r);
if (results.length > 1) {
// More than 1 user with the passed id's
throw new Parse.Error(
Parse.Error.ACCOUNT_ALREADY_LINKED,
'this auth is already used'
);
}
this.storage['authProvider'] = Object.keys(authData).join(',');
if (results.length == 1) {
this.storage['authProvider'] = Object.keys(authData).join(',');
if (results.length > 0) {
const userResult = results[0];
const mutatedAuthData = {};
Object.keys(authData).forEach(provider => {
@@ -543,7 +536,15 @@ RestWrite.prototype.handleAuthData = function(authData) {
}
}
}
return this.handleAuthDataValidation(authData);
return this.handleAuthDataValidation(authData).then(() => {
if (results.length > 1) {
// More than 1 user with the passed id's
throw new Parse.Error(
Parse.Error.ACCOUNT_ALREADY_LINKED,
'this auth is already used'
);
}
});
});
};