parse-community / parse-community/parse-server

Embedded document modification requires addField permission

Open
#7,371 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:bug
Dominant language
JavaScript
Stars
21.4k
Forks
4.8k
Avg merge
7h 45m
Merged PRs (30d)
11

Description

New Issue Checklist
Issue Description

Using PUT to modify a nested document fails unless the caller has addField permissions, even if the request doesn't add a new field.

Steps to reproduce
  1. Create a new class, nested_test.
  2. Remove public addField permission from the class.
  3. Use PUSH to create this object: { "a": {"b":1}}
  4. Use PUT to change the 1 to a 2 : {"a.b": 4}
  5. Observer that the operation fails due to a lack of addField permission.
  6. Grant addField to the public for the class.
  7. Observe that the request now successfully modifies the nested key.
Actual Outcome

The first PUT request should succeed, even without the addField permission, because it does not add a new field.

Expected Outcome

It fails due to a lack of addField permission.

Failing Test Case / Pull Request
  • 🤩 I submitted a PR with a fix and a test case.
  • 🧐 I submitted a PR with a failing test case.
Environment

Server

  • Parse Server version: 94b7b32 , a commit from 19/04/2021
  • Operating system: Ubuntu 20.04
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): local

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 4.4.5
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): local

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): any
  • SDK version: any
Logs

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the case with the nested_test class: remove public addField permission, create {"a":{"b":1}}, and send the nested PUT update. Trace the permission check involved in modifying an existing nested key, then verify that the update succeeds without addField permission and add or run a regression test for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb
Domain
api, authorization, backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.