Opened 8 years ago
Closed 8 years ago
#38417 closed defect (bug) (fixed)
Post status enum is ignored in collection params, allowing invalid values
Reported by: | joehoyle | Owned by: | joehoyle |
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | REST API | Keywords: | dev-feedback |
Focuses: | Cc: |
Description
Originally reported at https://github.com/WP-API/WP-API/issues/2889, currently the post status in /wp/v2/posts?status=invalid
does not throw an error and is passed to WP_Query, resulting in all post statuses being returned.
Note: this does not affect unauthenticated users, as we whitelist those types, so there's no permissions / information disclosure here.
Proposed fix in https://github.com/danielbachhuber/wordpress-develop/pull/4
cc @rmccue
Attachments (1)
Change History (6)
#2
@
8 years ago
- Owner set to joehoyle
- Resolution set to fixed
- Status changed from new to closed
In 38911:
#3
@
8 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Previously, if an invalid post status was assigned to a media object, the object would be returned with an unchanged status. Now, an error response is returned.
The assertion in test_get_items_invalid_status_param_is_discarded()
needs to be updated to account for the expected error response.
38417.diff makes this change.
Want to add a bit more background to this. Discussion started in this bit of Slack channel history: https://wordpress.slack.com/archives/core-restapi/p1476975790009158.
I reported getting weird results from authenticated API requests using query param
status=publish,draft
.@joehoyle determined:
And sounds like separate ticket may be opened to discuss queries with multiple status values.