I would say that the _purge operation should be treated similarily to _compact in terms of the security level required to run it. It is a operation that affects the structure of the database and is invisible in _changes or VDU.
Expected Behavior
POST to the _purge endpoint should check if the user is server admin before allowing the clustered pruge to be executed.
Current Behavior
Every user that has access to the db can run it:
$ curl -X POST -H "content-type: application/json" -d "{"test":["2-eec205a9d413992850a6e32678485900"]}" http://localhost:5984/test/_purge
{"purge_seq":null,"purged":{"test":["2-eec205a9d413992850a6e32678485900"]}}
Compared with compact:
$ curl -X POST -H "content-type: application/json" -d {} http://localhost:5984/test/_compact
{"error":"unauthorized","reason":"You are not a server or db admin."}
Possible Solution
Add the same security check as for _compact
Steps to Reproduce (for bugs)
See above
Context
DB that is available to users via HTTP
Your Environment
CouchDB 2.3.0 (master) on Linux
I can create a PR for it, if you agree that we should have an admin check in place here.
I would say that the _purge operation should be treated similarily to _compact in terms of the security level required to run it. It is a operation that affects the structure of the database and is invisible in _changes or VDU.
Expected Behavior
POST to the _purge endpoint should check if the user is server admin before allowing the clustered pruge to be executed.
Current Behavior
Every user that has access to the db can run it:
$ curl -X POST -H "content-type: application/json" -d "{"test":["2-eec205a9d413992850a6e32678485900"]}" http://localhost:5984/test/_purge
{"purge_seq":null,"purged":{"test":["2-eec205a9d413992850a6e32678485900"]}}
Compared with compact:
$ curl -X POST -H "content-type: application/json" -d {} http://localhost:5984/test/_compact
{"error":"unauthorized","reason":"You are not a server or db admin."}
Possible Solution
Add the same security check as for _compact
Steps to Reproduce (for bugs)
See above
Context
DB that is available to users via HTTP
Your Environment
CouchDB 2.3.0 (master) on Linux
I can create a PR for it, if you agree that we should have an admin check in place here.