OpenSearch/x-pack/plugin/security
Yogesh Gaikwad b6d1d2e6ec
Add 'create_doc' index privilege (#45806) (#47645)
Use case:
User with `create_doc` index privilege will be allowed to only index new documents
either via Index API or Bulk API.

There are two cases that we need to think:
- **User indexing a new document without specifying an Id.**
   For this ES auto generates an Id and now ES version 7.5.0 onwards defaults to `op_type` `create` we just need to authorize on the `op_type`.
- **User indexing a new document with an Id.**
   This is problematic as we do not know whether a document with Id exists or not.
   If the `op_type` is `create` then we can assume the user is trying to add a document, if it exists it is going to throw an error from the index engine.

Given these both cases, we can safely authorize based on the `op_type` value. If the value is `create` then the user with `create_doc` privilege is authorized to index new documents.

In the `AuthorizationService` when authorizing a bulk request, we check the implied action.
This code changes that to append the `:op_type/index` or `:op_type/create`
to indicate the implied index action.
2019-10-07 23:58:44 +11:00
..
cli [DOCS] Change "a SSL" to "an SSL" in the Java docs (#46524) (#46618) 2019-09-11 15:55:57 -04:00
forbidden Add an OpenID Connect authentication realm (#40674) (#41178) 2019-04-15 12:41:16 +03:00
licenses Update http-core and http-client dependencies (#46549) 2019-09-12 09:45:29 +02:00
qa Restrict which tasks can use testclusters (#45198) 2019-08-09 13:38:01 +03:00
src Add 'create_doc' index privilege (#45806) (#47645) 2019-10-07 23:58:44 +11:00
build.gradle [Backport] Remove dependency substitutions 7.x (#42866) 2019-06-04 13:50:23 -07:00