@@ -1122,11 +1122,19 @@ describe('Personally Identifiable Information', () => {
1122
1122
// Even with an authenticated user, Public read ACL should never expose sensitive data.
1123
1123
describe ( 'with another authenticated user' , ( ) => {
1124
1124
let anotherUser ;
1125
+ const ANOTHER_EMAIL = '[email protected] ' ;
1125
1126
1126
1127
beforeEach ( async done => {
1127
1128
return Parse . User . signUp ( 'another' , 'abc' )
1128
1129
. then ( loggedInUser => ( anotherUser = loggedInUser ) )
1129
1130
. then ( ( ) => Parse . User . logIn ( anotherUser . get ( 'username' ) , 'abc' ) )
1131
+ . then ( ( ) =>
1132
+ anotherUser
1133
+ . set ( 'email' , ANOTHER_EMAIL )
1134
+ . set ( 'zip' , ZIP )
1135
+ . set ( 'ssn' , SSN )
1136
+ . save ( )
1137
+ )
1130
1138
. then ( ( ) => done ( ) ) ;
1131
1139
} ) ;
1132
1140
@@ -1156,6 +1164,36 @@ describe('Personally Identifiable Information', () => {
1156
1164
. catch ( done . fail ) ;
1157
1165
} ) ;
1158
1166
1167
+ it ( 'should not be able to get user PII via API with Find without constraints' , done => {
1168
+ new Parse . Query ( Parse . User )
1169
+ . find ( )
1170
+ . then ( fetchedUsers => {
1171
+ const notCurrentUser = fetchedUsers . find (
1172
+ u => u . id !== anotherUser . id
1173
+ ) ;
1174
+ expect ( notCurrentUser . get ( 'email' ) ) . toBe ( undefined ) ;
1175
+ expect ( notCurrentUser . get ( 'zip' ) ) . toBe ( undefined ) ;
1176
+ expect ( notCurrentUser . get ( 'ssn' ) ) . toBe ( undefined ) ;
1177
+ done ( ) ;
1178
+ } )
1179
+ . catch ( done . fail ) ;
1180
+ } ) ;
1181
+
1182
+ it ( 'should be able to get own PII via API with Find without constraints' , done => {
1183
+ new Parse . Query ( Parse . User )
1184
+ . find ( )
1185
+ . then ( fetchedUsers => {
1186
+ const currentUser = fetchedUsers . find (
1187
+ u => u . id === anotherUser . id
1188
+ ) ;
1189
+ expect ( currentUser . get ( 'email' ) ) . toBe ( ANOTHER_EMAIL ) ;
1190
+ expect ( currentUser . get ( 'zip' ) ) . toBe ( ZIP ) ;
1191
+ expect ( currentUser . get ( 'ssn' ) ) . toBe ( SSN ) ;
1192
+ done ( ) ;
1193
+ } )
1194
+ . catch ( done . fail ) ;
1195
+ } ) ;
1196
+
1159
1197
it ( 'should not be able to get user PII via API with Get' , done => {
1160
1198
new Parse . Query ( Parse . User )
1161
1199
. get ( user . id )
0 commit comments