Skip to content
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

datetime handling - some invalid datetimes accepted, some invalid ones return incorrect status code #175

Closed
philvarner opened this issue Feb 22, 2022 · 0 comments
Assignees
Milestone

Comments

@philvarner
Copy link
Collaborator

philvarner commented Feb 22, 2022

The server accepts numerous datetime values that are not valid RFC 3339 datetimes. This is because the server does minimal validation and passes the datetime values to ES. There should be RFC 3339 validation so users don't create non-portable datetime queries (e.g., that fail on other STAC API servers).

luxon has a method DateTime#fromISO that gets us part the way there. These should also be run through the regex outlined here https://github.com/radiantearth/stac-api-spec/blob/master/implementation.md#datetime-parameter-handling

warnings:

  • Search with datetime=1985-04-12 returned status code 200 instead of 400
  • Search with datetime=1937-01-01T12:00:27.87+0100 returned status code 200 instead of 400
  • Search with datetime=1985-12-12T23:20:50.52 returned status code 200 instead of 400
  • Search with datetime=1985-04-12T23:20:50.Z returned status code 200 instead of 400
  • Search with datetime=1985-04-12T23:20:50,Z returned status code 200 instead of 400
  • Search with datetime=1986-04-12T23:20:50.52Z/1985-04-12T23:20:50.52Z returned status code 200 instead of 400
  • Search with datetime=1985-04-12T23:20:50,52Z returned status code 200 instead of 400

errors:

  • Search with datetime=1985-04-12t23:20:50.000z returned status code 500
  • Search with datetime=37-01-01T12:00:27.87Z returned status code 500 instead of 400
  • Search with datetime=21985-12-12T23:20:50.52Z returned status code 500 instead of 400
  • Search with datetime=1985-13-12T23:20:50.52Z returned status code 500 instead of 400
  • Search with datetime=1985-12-32T23:20:50.52Z returned status code 500 instead of 400
  • Search with datetime=1985-12-01T25:20:50.52Z returned status code 500 instead of 400
  • Search with datetime=1985-12-01T00:60:50.52Z returned status code 500 instead of 400
  • Search with datetime=1985-12-01T00:06:61.52Z returned status code 500 instead of 400
  • Search with datetime=1990-12-31T23:59:61Z returned status code 500 instead of 400
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant