Ensure User ACL's are more flexible and secure #3588#4860
Conversation
…s no access to the object
spec/helper.js
Outdated
|
|
||
| const openConnections = {}; | ||
|
|
||
| console.log('YOLO!!!'); |
Codecov Report
@@ Coverage Diff @@
## master #4860 +/- ##
==========================================
- Coverage 92.81% 92.81% -0.01%
==========================================
Files 119 119
Lines 8813 8825 +12
==========================================
+ Hits 8180 8191 +11
- Misses 633 634 +1
Continue to review full report at Codecov.
|
- Improves find method so we can attempt to read for a write poking the right ACL instead of using masterKey - This ensure we do not run beforeDelete/beforeFind/beforeSave in the wrong scenarios
8be466c to
deddf8d
Compare
acinader
left a comment
There was a problem hiding this comment.
some nits and a question.
src/Auth.js
Outdated
| // Whether this auth could possibly modify the given user id. | ||
| // It still could be forbidden via ACLs even if this returns true. | ||
| Auth.prototype.couldUpdateUserId = function(userId) { | ||
| Auth.prototype.couldUpdateUserId = function() { |
There was a problem hiding this comment.
so this is confusing to me now. the name couldUpdateUserId with a userId argument the way it was made sense why this would exist, but I can no longer really understand. Is this just loggedInOrMaster?
There was a problem hiding this comment.
you are right :)
src/RestQuery.js
Outdated
| if (!this.auth.user) { | ||
| throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, | ||
| 'This session token is invalid.'); | ||
| 'invalid session token'); |
There was a problem hiding this comment.
This is in small letters at other places, I can update it all (everywhere)
src/rest.js
Outdated
| // If we're trying to update a user without / with bad session token | ||
| if (className === '_User' | ||
| && error.code === Parse.Error.OBJECT_NOT_FOUND) { | ||
| throw new Parse.Error(Parse.Error.SESSION_MISSING, 'insuffisant auth.'); |
src/rest.js
Outdated
| if (className === '_User' | ||
| && error.code === Parse.Error.OBJECT_NOT_FOUND) { | ||
| throw new Parse.Error(Parse.Error.SESSION_MISSING, 'insuffisant auth.'); | ||
| throw new Parse.Error(Parse.Error.SESSION_MISSING, 'insufficient auth.'); |
There was a problem hiding this comment.
man, I feel bad saying this, but, can you please leading cap this....
note that the sdk is consistent
https://github.com/parse-community/Parse-SDK-JS/search?q=throw+new&unscoped_q=throw+new
but parse-server isn't, but should be
https://github.com/parse-community/parse-server/search?p=2&q=throw+new&unscoped_q=throw+new****
There was a problem hiding this comment.
no need to feel bad :)
* Fixes an issue that would let the beforeDelete be called when user has no access to the object * Ensure we properly lock user - Improves find method so we can attempt to read for a write poking the right ACL instead of using masterKey - This ensure we do not run beforeDelete/beforeFind/beforeSave in the wrong scenarios * nits * Caps insufficient
* Fixes an issue that would let the beforeDelete be called when user has no access to the object * Ensure we properly lock user - Improves find method so we can attempt to read for a write poking the right ACL instead of using masterKey - This ensure we do not run beforeDelete/beforeFind/beforeSave in the wrong scenarios * nits * Caps insufficient
…arse-community#4860) * Fixes an issue that would let the beforeDelete be called when user has no access to the object * Ensure we properly lock user - Improves find method so we can attempt to read for a write poking the right ACL instead of using masterKey - This ensure we do not run beforeDelete/beforeFind/beforeSave in the wrong scenarios * nits * Caps insufficient
Hi guys! This is a fix for a long standing issue #3588. This should ensure user ACL'S let admins roles / other users manage them, while ensuring there is no data issue lock out possibility from the user himself.
This also fixes an issue where the beforeDelete would be called when the object is not writable because we were using the masterKey. It introduces a new
isWriteon the find operation inthe DB so we can force the ACL's to use the write column (a find for an intended write).If you got test suggestions, let me know.