parse-community / parse-community/parse-server

Post invalid iso date string success instead of return 400 with error message

Open
#7,054 1 comment 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

When post an invalid iso date string, the post success instead of return 400 with error message

Steps to reproduce
curl --location --request POST 'http://localhost:1337/parse/classes/gordonTest' \
--header 'Content-Type: application/json' \
--header 'x-parse-master-key: isotest' \
--data-raw '{
    "isoTest":{
        "__type":"Date",
        "iso":"not iso"
    }
}'
Actual Outcome

The post success and result value is 1970-01-01T00:00:00.000Z

Expected Outcome

Returns 400 with message field isoTest is not a proper iso string

Environment

Server

  • Parse Server version: 4.4.0
  • Operating system: Mac
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): local

Database

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

Client
http

Logs
[39645] parse-server running on http://localhost:1337/parse
verbose: REQUEST for [POST] /parse/classes/gordonTest: {
  "isoTest": {
    "__type": "Date",
    "iso": "not iso"
  }
} {"method":"POST","url":"/parse/classes/gordonTest","headers":{"content-type":"application/json","x-parse-master-key":"isotest","user-agent":"PostmanRuntime/7.26.8","accept":"*/*","cache-control":"no-cache","postman-token":"6a0c9a67-cfd9-48d6-8c75-8a1cfa6f40b3","host":"localhost:1337","accept-encoding":"gzip, deflate, br","connection":"keep-alive","content-length":"74"},"body":{"isoTest":{"__type":"Date","iso":"not iso"}}}
verbose: RESPONSE from [POST] /parse/classes/gordonTest: {
  "status": 201,
  "response": {
    "objectId": "K01d1kyetL",
    "createdAt": "2020-12-09T21:55:59.158Z"
  },
  "location": "http://localhost:1337/parse/classes/gordonTest/K01d1kyetL"
} {"result":{"status":201,"response":{"objectId":"K01d1kyetL","createdAt":"2020-12-09T21:55:59.158Z"},"location":"http://localhost:1337/parse/classes/gordonTest/K01d1kyetL"}}

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 POST request to /parse/classes/gordonTest with the invalid Date value shown in the issue, then trace how the request validates and stores the iso field. Done means the request returns HTTP 400 with an error identifying isoTest instead of creating an object with a 1970 date.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.