Skip to content

Commit c29cdef

Browse files
author
Adam Locke
authored
[DOCS] Updating doc level security limitations (#64426)
* Updating doc level security limitations. * Incorporating review feedback. * Changes from review feedback. * Remove statement about the stats API.
1 parent 61b51ba commit c29cdef

File tree

2 files changed

+58
-37
lines changed

2 files changed

+58
-37
lines changed

x-pack/docs/en/security/authorization/document-level-security.asciidoc

+38-16
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,31 @@
33
=== Document level security
44

55
Document level security restricts the documents that users have read access to.
6-
In particular, it restricts which documents can be accessed from document-based
7-
read APIs.
6+
In particular, it restricts which documents can be accessed from document-based
7+
read APIs.
88

99
To enable document level security, you use a query to specify the documents that
10-
each role can access. The document query is associated with a particular data
10+
each role can access. The document `query` is associated with a particular data
1111
stream, index, or wildcard (`*`) pattern and operates in conjunction with the
1212
privileges specified for the data streams and indices.
1313

14+
The specified document `query`:
15+
16+
* Expects the same format as if it was defined in the search request
17+
* Supports <<templating-role-query,templating a role query>> that can access
18+
the details of the currently authenticated user
19+
* Accepts queries written as either string values or nested JSON
20+
* Supports the majority of the {es}
21+
<<query-dsl,Query Domain Specific Language (DSL)>>, with <<field-document-limitations,some limitations>> for field and document level security
22+
23+
IMPORTANT: Omitting the `query` parameter entirely disables document level
24+
security for the respective indices permission entry.
25+
1426
The following role definition grants read access only to documents that
1527
belong to the `click` category within all the `events-*` data streams and indices:
1628

1729
[source,console]
18-
--------------------------------------------------
30+
----
1931
POST /_security/role/click_role
2032
{
2133
"indices": [
@@ -26,19 +38,33 @@ POST /_security/role/click_role
2638
}
2739
]
2840
}
29-
--------------------------------------------------
41+
----
3042

31-
NOTE: Omitting the `query` entry entirely disables document level security for
32-
the respective indices permission entry.
43+
You can write this same query using nested JSON syntax:
3344

34-
The specified `query` expects the same format as if it was defined in the
35-
search request and supports the full {es} <<query-dsl,query DSL>>.
45+
[source,console]
46+
----
47+
POST _security/role/click_role
48+
{
49+
"indices": [
50+
{
51+
"names": [ "events-*" ],
52+
"privileges": [ "read" ],
53+
"query": {
54+
"match": {
55+
"category": "click"
56+
}
57+
}
58+
}
59+
]
60+
}
61+
----
3662

37-
For example, the following role grants read access only to the documents whose
63+
The following role grants read access only to the documents whose
3864
`department_id` equals `12`:
3965

4066
[source,console]
41-
--------------------------------------------------
67+
----
4268
POST /_security/role/dept_role
4369
{
4470
"indices" : [
@@ -51,8 +77,4 @@ POST /_security/role/dept_role
5177
}
5278
]
5379
}
54-
--------------------------------------------------
55-
56-
NOTE: `query` also accepts queries written as string values.
57-
58-
For more information, see <<field-and-document-access-control>>.
80+
----

x-pack/docs/en/security/limitations.asciidoc

+20-21
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
[discrete]
1010
=== Plugins
1111

12-
Elasticsearch's plugin infrastructure is extremely flexible in terms of what can
13-
be extended. While it opens up Elasticsearch to a wide variety of (often custom)
12+
{es}'s plugin infrastructure is extremely flexible in terms of what can
13+
be extended. While it opens up {es} to a wide variety of (often custom)
1414
additional functionality, when it comes to security, this high extensibility level
1515
comes at a cost. We have no control over the third-party plugins' code (open
1616
source or not) and therefore we cannot guarantee their compliance with
@@ -20,7 +20,7 @@ officially supported on clusters with {security-features} enabled.
2020
[discrete]
2121
=== Changes in wildcard behavior
2222

23-
Elasticsearch clusters with the {security-features} enabled apply the `/_all`
23+
{es} clusters with the {security-features} enabled apply the `/_all`
2424
wildcard, and all other wildcards, to the data streams, indices, and index aliases that the current user has
2525
privileges for, not all data streams, indices, and index aliases on the cluster.
2626

@@ -38,44 +38,43 @@ Aliases containing filters are not a secure way to restrict access to individual
3838
documents, due to the limitations described in
3939
<<alias-limitations, Index and field names can be leaked when using aliases>>.
4040
The {stack-security-features} provide a secure way to restrict access to
41-
documents through the
41+
documents through the
4242
<<field-and-document-access-control, document-level security>> feature.
4343

4444
[discrete]
45+
[[field-document-limitations]]
4546
=== Field and document level security limitations
4647

47-
When a user's role enables document or field level security for a data stream or index:
48+
When a user's role enables document or <<field-level-security,field level security>> for a data stream or index:
4849

4950
* The user cannot perform write operations:
5051
** The update API isn't supported.
5152
** Update requests included in bulk requests aren't supported.
5253
* The request cache is disabled for search requests.
5354

54-
When a user's role enables document level security for a data stream or index:
55+
When a user's role enables <<document-level-security,document level security>> for a data stream or index:
5556

56-
* Document level security isn't applied for APIs that aren't document based.
57-
An example is the field stats API.
5857
* Document level security doesn't affect global index statistics that relevancy
59-
scoring uses. So this means that scores are computed without taking the role
60-
query into account. Note that documents not matching with the role query are
58+
scoring uses. This means that scores are computed without taking the role
59+
query into account. Documents that don't match the role query are
6160
never returned.
62-
* The `has_child` and `has_parent` queries aren't supported as query in the
63-
role definition. The `has_child` and `has_parent` queries can be used in the
64-
search API with document level security enabled.
65-
* Any query that makes remote calls to fetch data to query by isn't supported.
66-
The following queries aren't supported:
67-
** The `terms` query with terms lookup isn't supported.
68-
** The `geo_shape` query with indexed shapes isn't supported.
69-
** The `percolate` query isn't supported.
70-
* If suggesters are specified and document level security is enabled then
71-
the specified suggesters are ignored.
61+
* The `has_child` and `has_parent` queries aren't supported as query parameters
62+
in the role definition. The `has_child` and `has_parent` queries can be used in
63+
the search API with document level security enabled.
64+
* <<date-math,Date math>> expressions cannot contain `now` in <<ranges-on-dates,range queries with date fields>>
65+
* Any query that makes remote calls to fetch query data isn't supported,
66+
including the following queries:
67+
** `terms` query with terms lookup
68+
** `geo_shape` query with indexed shapes
69+
** `percolate` query
70+
* If suggesters are specified and document level security is enabled, the specified suggesters are ignored.
7271
* A search request cannot be profiled if document level security is enabled.
7372

7473
[discrete]
7574
[[alias-limitations]]
7675
=== Index and field names can be leaked when using aliases
7776

78-
Calling certain Elasticsearch APIs on an alias can potentially leak information
77+
Calling certain {es} APIs on an alias can potentially leak information
7978
about indices that the user isn't authorized to access. For example, when you get
8079
the mappings for an alias with the `_mapping` API, the response includes the
8180
index name and mappings for each index that the alias applies to.

0 commit comments

Comments
 (0)