-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Field-level security with inner_hits can cause index out-of-bounds exception #30624
Comments
Pinging @elastic/es-security |
There's what seems to be a related issue where you don't get an error, but you do get the wrong inner hit back. If you repeat the above steps, but instead index the document
and rerun the search which throws an exception, you no longer get an exception, but the "inner_hits" part of the response contains the "kitten" metadata field instead of the "problem" one which you actually searched for. This seems consistent with the guess that it locates the array index of the inner hit before doing the filtering, and looks it up properly afterwards. |
@james-uffindell-granta Thanks for reporting this problem. The inner hit source filtering is not working correctly with field level security. Stacktrace of the first request:
|
…ters out all fields Prior to this change an json array element with no fields would be omitted from json array. Nested inner hits source filtering relies on the fact that the json array element numbering remains untouched and this causes AOOB exceptions in the ES side during the fetch phase without this change. Closes elastic#30624
…ters out all fields (#30709) Prior to this change an json array element with no fields would be omitted from json array. Nested inner hits source filtering relies on the fact that the json array element numbering remains untouched and this causes AOOB exceptions in the ES side during the fetch phase without this change. Closes #30624
…ters out all fields (#30709) Prior to this change an json array element with no fields would be omitted from json array. Nested inner hits source filtering relies on the fact that the json array element numbering remains untouched and this causes AOOB exceptions in the ES side during the fetch phase without this change. Closes #30624
…ters out all fields (#30709) Prior to this change an json array element with no fields would be omitted from json array. Nested inner hits source filtering relies on the fact that the json array element numbering remains untouched and this causes AOOB exceptions in the ES side during the fetch phase without this change. Closes #30624
Elasticsearch version (
bin/elasticsearch --version
):Version: 6.2.4, Build: ccec39f/2018-04-12T20:37:28.497551Z
Plugins installed:
x-pack
x-pack-core
x-pack-deprecation
x-pack-graph
x-pack-logstash
x-pack-ml
x-pack-monitoring
x-pack-security
x-pack-upgrade
x-pack-watcher
JVM version (
java -version
):java 9
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
OS version (
uname -a
if on a Unix-like system):Windows 10
Description of the problem including expected versus actual behavior:
Running a query with field-level security on a subfield of a nested array field and asking for inner_hits can cause an index out of bounds exception.
Expected behavior: no error. (If this is a known limitation of either inner_hits or field-level security then I couldn't see it in the documentation.)
Steps to reproduce:
Now, if you rerun the previous query but authenticating as this new user, instead of getting results, it fails:
Removing
"inner_hits":{}
from the query will make it work.My guess is that it figures out that
metadata[1]
is the inner hit which matches, then strips out the fields you aren't allowed to see, which removesmetadata[0]
since it doesn't have ametadata.sv
field, which leaves themetadata
array one element long instead of two, so when it then looks upmetadata[1]
to put it in the inner hits node, it goes bang?The text was updated successfully, but these errors were encountered: