Skip to content

Commit

Permalink
Apply credential stripping to all untransforms for _User (parse-commu…
Browse files Browse the repository at this point in the history
…nity#1498) (reverted from commit d57e384)
  • Loading branch information
steven-supersolid committed Apr 20, 2016
1 parent 429f1bc commit c1bc833
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 40 deletions.
37 changes: 0 additions & 37 deletions spec/RestQuery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ var rest = require('../src/rest');
var querystring = require('querystring');
var request = require('request');

var DatabaseAdapter = require('../src/DatabaseAdapter');
var database = DatabaseAdapter.getDatabaseConnection('test', 'test_');

var config = new Config('test');
var nobody = auth.nobody(config);

Expand Down Expand Up @@ -38,40 +35,6 @@ describe('rest query', () => {
});
});

describe('query for user w/ legacy credentials', () => {
var data = {
username: 'blah',
password: 'pass',
sessionToken: 'abc123',
}
describe('without masterKey', () => {
it('has them stripped from results', (done) => {
database.create('_User', data).then(() => {
return rest.find(config, nobody, '_User')
}).then((result) => {
var user = result.results[0];
expect(user.username).toEqual('blah');
expect(user.sessionToken).toBeUndefined();
expect(user.password).toBeUndefined();
done();
});
});
});
describe('with masterKey', () => {
it('has them stripped from results', (done) => {
database.create('_User', data).then(() => {
return rest.find(config, {isMaster: true}, '_User')
}).then((result) => {
var user = result.results[0];
expect(user.username).toEqual('blah');
expect(user.sessionToken).toBeUndefined();
expect(user.password).toBeUndefined();
done();
});
});
});
});

// Created to test a scenario in AnyPic
it('query with include', (done) => {
var photo = {
Expand Down
5 changes: 2 additions & 3 deletions src/Controllers/DatabaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,12 @@ DatabaseController.prototype.untransformObject = function(
return object;
}

delete object.authData;
delete object.sessionToken;

if (isMaster || (aclGroup.indexOf(object.objectId) > -1)) {
return object;
}

delete object.authData;
delete object.sessionToken;
return object;
};

Expand Down

0 comments on commit c1bc833

Please sign in to comment.