Skip to content

Commit

Permalink
Merge pull request from GHSA-wvh7-5p38-2qfc
Browse files Browse the repository at this point in the history
  • Loading branch information
dplewis authored Nov 23, 2019
1 parent f140227 commit d110617
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions integration/test/ParseUserTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -898,4 +898,22 @@ describe('Parse User', () => {
expect(user.get('authData').twitter.id).toBe(authData.id);
expect(user.get('authData').facebook.id).toBe('test');
});

it('fix GHSA-wvh7-5p38-2qfc', async () => {
Parse.User.enableUnsafeCurrentUser();
const user = new Parse.User();
user.setUsername('username');
user.setPassword('password');
await user.signUp();

const path = Parse.Storage.generatePath('currentUser');
let userData = Parse.Storage.getItem(path);
expect(JSON.parse(userData).password).toBeUndefined();

user.setPassword('password');
await user.save(null, { useMasterKey: true });

userData = Parse.Storage.getItem(path);
expect(JSON.parse(userData).password).toBeUndefined();
});
});
2 changes: 2 additions & 0 deletions src/ParseUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,8 @@ const DefaultController = {
updateUserOnDisk(user) {
const path = Storage.generatePath(CURRENT_USER_KEY);
const json = user.toJSON();
delete json.password;

json.className = user.constructor.name === ParseUser.name ? '_User' : user.constructor.name;
return Storage.setItemAsync(
path, JSON.stringify(json)
Expand Down

0 comments on commit d110617

Please sign in to comment.