You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2021/08/11 04:44:18 UTC
[GitHub] [couchdb] jaydoane opened a new pull request #3701: Restrict design doc update methods
jaydoane opened a new pull request #3701:
URL: https://github.com/apache/couchdb/pull/3701
<!-- Thank you for your contribution!
Please file this form by replacing the Markdown comments
with your text. If a section needs no action - remove it.
Also remember, that CouchDB uses the Review-Then-Commit (RTC) model
of code collaboration. Positive feedback is represented +1 from committers
and negative is a -1. The -1 also means veto, and needs to be addressed
to proceed. Once there are no objections, the PR can be merged by a
CouchDB committer.
See: http://couchdb.apache.org/bylaws.html#decisions for more info. -->
## Overview
Documentation for design doc update functions specifies that permitted
methods are:
POST /{db}/_design/{ddoc}/_update/{func}
PUT /{db}/_design/{ddoc}/_update/{func}/{docid} [2]
But currently anything is accepted, even bogus methods such as in the
following example work:
```
$ curl -v -u adm localhost:15984/db-1/_design/ddoc/_update/change -X BOGUS
> BOGUS /db-1/_design/bar/_update/change HTTP/1.1
>
< HTTP/1.1 200 OK
< content-length: 11
< content-type: text/html; charset=utf-8
<
* Connection #0 to host localhost left intact
Empty World* Closing connection 0
```
A strict reading of the docs indicates that the null document endpoint
only allows POST [1] while the endpoint taking a document id only
allows PUT [2]. However, the examples in both cases exclusively use
POST, and also PUT doesn't make as much sense from a semantic
perspective since a new resource isn't being created, I assume the PUT
is a typo, and both should be changed to POST.
However, given the inconsistent usage even in CouchDB's own test
suite, it seems prudent to minimize incompatibility, while still
imposing reasonable restrictions, and allow either PUT or POST for
both endpoints.
[1] https://docs.couchdb.org/en/latest/api/ddoc/render.html#post--db-_design-ddoc-_update-func
[2] https://docs.couchdb.org/en/latest/api/ddoc/render.html#put--db-_design-ddoc-_update-func-docid
<!-- Please give a short brief for the pull request,
what problem it solves or how it makes things better. -->
## Testing recommendations
```
make check
```
<!-- Describe how we can test your changes.
Does it provides any behaviour that the end users
could notice? -->
## Related Issues or Pull Requests
https://github.com/apache/couchdb-documentation/pull/674
<!-- If your changes affects multiple components in different
repositories please put links to those issues or pull requests here. -->
## Checklist
- [x] Code is written and works correctly
- [x] Changes are covered by tests
- [ ] Any new configurable parameters are documented in `rel/overlay/etc/default.ini`
- [x] A PR for documentation changes has been made in https://github.com/apache/couchdb-documentation
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] jaydoane edited a comment on pull request #3701: Restrict design doc update methods
Posted by GitBox <gi...@apache.org>.
jaydoane edited a comment on pull request #3701:
URL: https://github.com/apache/couchdb/pull/3701#issuecomment-900754570
> hm, not sure here. the _show / _list / _update handlers exist to allow users to decide their own semantics, so allowing any http method for _update makes sense (e.g, PATCH).
@rnewson if that's the intention, the documentation doesn't make it clear, since it specifies [PUT](https://docs.couchdb.org/en/latest/api/ddoc/render.html#put--db-_design-ddoc-_update-func-docid) and [POST](https://docs.couchdb.org/en/latest/api/ddoc/render.html#post--db-_design-ddoc-_update-func), but no others. So, maybe we just need to improve the docs?
Can you point to where in the documentation it says that users are allowed to decide their own semantics?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] rnewson commented on pull request #3701: Restrict design doc update methods
Posted by GitBox <gi...@apache.org>.
rnewson commented on pull request #3701:
URL: https://github.com/apache/couchdb/pull/3701#issuecomment-900562109
hm, not sure here. the _show / _list / _update handlers exist to allow users to decide their own semantics, so allowing any http method for _update makes sense (e.g, PATCH).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] nickva commented on pull request #3701: Restrict design doc update methods
Posted by GitBox <gi...@apache.org>.
nickva commented on pull request #3701:
URL: https://github.com/apache/couchdb/pull/3701#issuecomment-900630192
Added a comment related to this on the docs PR https://github.com/apache/couchdb-documentation/pull/674#issuecomment-900463236
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] jaydoane commented on pull request #3701: Restrict design doc update methods
Posted by GitBox <gi...@apache.org>.
jaydoane commented on pull request #3701:
URL: https://github.com/apache/couchdb/pull/3701#issuecomment-901358564
> As _update handlers go away in the next version (4.0) I think, at most, a doc fix is appropriate, not a compatibility-breaking change.
Ah, I was not aware update functions are deprecated! Unlike [list](https://docs.couchdb.org/en/latest/api/ddoc/render.html#db-design-design-doc-list-list-name-view-name) and [show](https://docs.couchdb.org/en/latest/api/ddoc/render.html#db-design-design-doc-show-show-name) functions, update functions are not currently annotaged as deprecated.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] rnewson commented on pull request #3701: Restrict design doc update methods
Posted by GitBox <gi...@apache.org>.
rnewson commented on pull request #3701:
URL: https://github.com/apache/couchdb/pull/3701#issuecomment-901202474
-1.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] jaydoane edited a comment on pull request #3701: Restrict design doc update methods
Posted by GitBox <gi...@apache.org>.
jaydoane edited a comment on pull request #3701:
URL: https://github.com/apache/couchdb/pull/3701#issuecomment-900754570
> hm, not sure here. the _show / _list / _update handlers exist to allow users to decide their own semantics, so allowing any http method for _update makes sense (e.g, PATCH).
@rnewson if that's the intention, the documentation doesn't make it clear, since it specifies [PUT](https://docs.couchdb.org/en/latest/api/ddoc/render.html#put--db-_design-ddoc-_update-func-docid) and [POST](https://docs.couchdb.org/en/latest/api/ddoc/render.html#post--db-_design-ddoc-_update-func), but no others. So, maybe we just need to improve the docs?
Can you point to where in the documentation it says that users are allowed to decide their own semantics?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] jaydoane closed pull request #3701: Restrict design doc update methods
Posted by GitBox <gi...@apache.org>.
jaydoane closed pull request #3701:
URL: https://github.com/apache/couchdb/pull/3701
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] rnewson commented on pull request #3701: Restrict design doc update methods
Posted by GitBox <gi...@apache.org>.
rnewson commented on pull request #3701:
URL: https://github.com/apache/couchdb/pull/3701#issuecomment-901202086
In this case I think the docs are wrong.
I don't think changing the behaviour of _update is warranted without a major version bump unless there is a security issue at play here that has not yet been mentioned.
As _update handlers go away in the next version (4.0) I think, at most, a doc fix is appropriate, not a compatibility-breaking change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] jaydoane commented on pull request #3701: Restrict design doc update methods
Posted by GitBox <gi...@apache.org>.
jaydoane commented on pull request #3701:
URL: https://github.com/apache/couchdb/pull/3701#issuecomment-900754570
> hm, not sure here. the _show / _list / _update handlers exist to allow users to decide their own semantics, so allowing any http method for _update makes sense (e.g, PATCH).
@rnewson if that's the intention, the documentation doesn't make it clear, since it specifies [PUT](https://docs.couchdb.org/en/latest/api/ddoc/render.html#put--db-_design-ddoc-_update-func-docid) and [POST](https://docs.couchdb.org/en/latest/api/ddoc/render.html#post--db-_design-ddoc-_update-func), but no others. So, maybe we just need to improve the docs?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] nickva commented on pull request #3701: Restrict design doc update methods
Posted by GitBox <gi...@apache.org>.
nickva commented on pull request #3701:
URL: https://github.com/apache/couchdb/pull/3701#issuecomment-900630192
Added a comment related to this on the docs PR https://github.com/apache/couchdb-documentation/pull/674#issuecomment-900463236
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] jaydoane commented on pull request #3701: Restrict design doc update methods
Posted by GitBox <gi...@apache.org>.
jaydoane commented on pull request #3701:
URL: https://github.com/apache/couchdb/pull/3701#issuecomment-900754570
> hm, not sure here. the _show / _list / _update handlers exist to allow users to decide their own semantics, so allowing any http method for _update makes sense (e.g, PATCH).
@rnewson if that's the intention, the documentation doesn't make it clear, since it specifies [PUT](https://docs.couchdb.org/en/latest/api/ddoc/render.html#put--db-_design-ddoc-_update-func-docid) and [POST](https://docs.couchdb.org/en/latest/api/ddoc/render.html#post--db-_design-ddoc-_update-func), but no others. So, maybe we just need to improve the docs?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] rnewson commented on pull request #3701: Restrict design doc update methods
Posted by GitBox <gi...@apache.org>.
rnewson commented on pull request #3701:
URL: https://github.com/apache/couchdb/pull/3701#issuecomment-900562387
"any except GET", rather.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] rnewson commented on pull request #3701: Restrict design doc update methods
Posted by GitBox <gi...@apache.org>.
rnewson commented on pull request #3701:
URL: https://github.com/apache/couchdb/pull/3701#issuecomment-900562109
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [couchdb] rnewson commented on pull request #3701: Restrict design doc update methods
Posted by GitBox <gi...@apache.org>.
rnewson commented on pull request #3701:
URL: https://github.com/apache/couchdb/pull/3701#issuecomment-901382535
@janl double check me on _update deprecation?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org