Open
Description
New Issue Checklist
- Report security issues confidentially.
- Any contribution is under this license.
- Before posting search existing issues.
Issue Description
Parse.Object.save throws "Object not found.", code 101 error when trying to save an existing object with the session token of a user that does not have write permissions on that object.
Steps to reproduce
Fetch a valid object that can be read by everyone, using a query.
const query = ...;
const result = await query.first();
log(result.get("key")); // Will show a valid value here since the user has read permission.
Set any value on the object and try to save it using the session token of a user who does not have write access for the object.
result.set("key", 1);
await result.save(null, { sessionToken: "valid_session_token_without_write_access" });
// Throws a 101 error because the user does not have write permission. The error code should probably be a different one though.
Actual Outcome
101: OBJECT_NOT_FOUND error is thrown.
Expected Outcome
Other error should be thrown:
- 209: INVALID_SESSION_TOKEN
- 119: OPERATION_FORBIDDEN
- Other new error code...
Environment
Tested on the versions mentioned below only.
Server
- Parse Server version:
8.0.0
- Operating system:
Ubuntu
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc):
Self Hosted Remote
Database
- System (MongoDB or Postgres):
MongoDB
- Database version:
7.0.14
- Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc):
Self Hosted Remote
Client
- SDK (iOS, Android, JavaScript, PHP, Unity, etc):
JavaScript
- SDK version:
6.0.0