-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Ensure User ACL's are more flexible and secure #3588 #4860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…s no access to the object
spec/helper.js
Outdated
@@ -114,7 +114,7 @@ if (process.env.PARSE_SERVER_TEST_CACHE === 'redis') { | |||
} | |||
|
|||
const openConnections = {}; | |||
|
|||
console.log('YOLO!!!'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some nits and a question.
src/Auth.js
Outdated
@@ -21,11 +21,11 @@ function Auth({ config, isMaster = false, isReadOnly = false, user, installation | |||
|
|||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right :)
src/RestQuery.js
Outdated
throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, | ||
'This session token is invalid.'); | ||
'invalid session token'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cap the i: Invalid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
insufficient
:).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
src/rest.js
Outdated
@@ -155,7 +155,7 @@ function handleSessionMissingError(error, className) { | |||
// 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.'); | |||
throw new Parse.Error(Parse.Error.SESSION_MISSING, 'insufficient auth.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
isWrite
on 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.