Skip to content

Commit c5a5f57

Browse files
awgeorgeacinader
authored andcommitted
Updates based on review
1 parent ff33c99 commit c5a5f57

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

spec/Schema.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ describe('SchemaController', () => {
687687
});
688688
});
689689

690-
it('refuses to add CLP with incorrect protectedFields', done => {
690+
it('refuses to add CLP when incorrectly sending a string to protectedFields object value instead of an array', done => {
691691
const levelPermissions = {
692692
find: { '*': true },
693693
get: { '*': true },

spec/UserPII.spec.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,8 @@ describe('Personally Identifiable Information', () => {
522522
.catch(done.fail);
523523
});
524524

525-
// Explict ACL should be able to read sensitive information
526-
describe('with privilaged user no CLP', () => {
525+
// Explicit ACL should be able to read sensitive information
526+
describe('with privileged user no CLP', () => {
527527
let adminUser;
528528

529529
beforeEach(async done => {
@@ -748,21 +748,18 @@ describe('Personally Identifiable Information', () => {
748748
protectedFields: {
749749
_User: { '*': ['ssn', 'zip'], 'role:Administrator': [] },
750750
},
751-
}).then(() => done());
751+
}).then(done);
752752
});
753753

754754
it('should be able to get own PII via API with object', done => {
755755
const userObj = new (Parse.Object.extend(Parse.User))();
756756
userObj.id = user.id;
757-
userObj.fetch().then(
758-
fetchedUser => {
759-
expect(fetchedUser.get('email')).toBe(EMAIL);
760-
expect(fetchedUser.get('zip')).toBe(ZIP);
761-
expect(fetchedUser.get('ssn')).toBe(SSN);
762-
done();
763-
},
764-
e => done.fail(e)
765-
);
757+
userObj.fetch().then(fetchedUser => {
758+
expect(fetchedUser.get('email')).toBe(EMAIL);
759+
expect(fetchedUser.get('zip')).toBe(ZIP);
760+
expect(fetchedUser.get('ssn')).toBe(SSN);
761+
done();
762+
}, done.fail);
766763
});
767764

768765
it('should not be able to get PII via API with object', done => {
@@ -997,7 +994,7 @@ describe('Personally Identifiable Information', () => {
997994
.catch(done.fail);
998995
});
999996

1000-
// Explict ACL should be able to read sensitive information
997+
// Explicit ACL should be able to read sensitive information
1001998
describe('with privilaged user CLP', () => {
1002999
let adminUser;
10031000

src/Controllers/DatabaseController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,7 @@ class DatabaseController {
14391439
[...(auth.userRoles || [])].forEach(role => {
14401440
const fields = protectedFields[role];
14411441
if (fields) {
1442-
protectedKeys = protectedKeys.filter(v => fields.includes(v));
1442+
protectedKeys = protectedKeys.filter(fields.includes);
14431443
}
14441444
});
14451445

src/ParseServer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ function injectDefaults(options: ParseServerOptions) {
352352
console.warn(
353353
`\nDEPRECATED: userSensitiveFields has been replaced by protectedFields allowing the ability to protect fields in all classes with CLP. \n`
354354
);
355+
/* eslint-enable no-console */
355356

356357
const userSensitiveFields = Array.from(
357358
new Set([
@@ -360,7 +361,6 @@ function injectDefaults(options: ParseServerOptions) {
360361
])
361362
);
362363

363-
/* eslint-enable no-console */
364364
options.protectedFields = { _User: { '*': userSensitiveFields } };
365365
}
366366

0 commit comments

Comments
 (0)