Skip to content
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

script.allowed_contexts - unknown script context #44232

Closed
mohmad-null opened this issue Jul 11, 2019 · 8 comments · Fixed by #45410
Closed

script.allowed_contexts - unknown script context #44232

mohmad-null opened this issue Jul 11, 2019 · 8 comments · Fixed by #45410
Labels
:Core/Infra/Scripting Scripting abstractions, Painless, and Mustache >docs General docs changes

Comments

@mohmad-null
Copy link

mohmad-null commented Jul 11, 2019

I have a config file that works file with 6.3.2 but when I try and upgrade to 7.2.0 I get this exception:

[2019-07-11T17:26:36,202][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [1node] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: unknown script context [search] found in setting [script.allowed_contexts].
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-7.2.0.jar:7.2.0]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.2.0.jar:7.2.0]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.2.0.jar:7.2.0]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-7.2.0.jar:7.2.0]
        at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.2.0.jar:7.2.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.2.0.jar:7.2.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.2.0.jar:7.2.0]
Caused by: java.lang.IllegalArgumentException: unknown script context [search] found in setting [script.allowed_contexts].
        at org.elasticsearch.script.ScriptService.<init>(ScriptService.java:209) ~[elasticsearch-7.2.0.jar:7.2.0]
        at org.elasticsearch.script.ScriptModule.<init>(ScriptModule.java:92) ~[elasticsearch-7.2.0.jar:7.2.0]
        at org.elasticsearch.node.Node.<init>(Node.java:331) ~[elasticsearch-7.2.0.jar:7.2.0]
        at org.elasticsearch.node.Node.<init>(Node.java:251) ~[elasticsearch-7.2.0.jar:7.2.0]
        at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:221) ~[elasticsearch-7.2.0.jar:7.2.0]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:221) ~[elasticsearch-7.2.0.jar:7.2.0]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:349) ~[elasticsearch-7.2.0.jar:7.2.0]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.2.0.jar:7.2.0]
        ... 6 more

The pertinent lines are:

# Limit scripting. "inline" is necessary for custom scoring.
script.allowed_types: inline
# Only allow scripts to be used for searching
script.allowed_contexts: search

If I remove script.allowed_contexts line then 7.2.0 starts fine. Except that this is documented as being correct: https://www.elastic.co/guide/en/elasticsearch/reference/7.2/modules-scripting-security.html
No plugins.

@mohmad-null
Copy link
Author

script.allowed_contexts: update - starts fine. Except I don't want update, I want search

@mohmad-null
Copy link
Author

Related docs issue - there doesn't seem to be any docs page anywhere stating what the actual permitted values for these settings is.

@cbuescher cbuescher added :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache >docs General docs changes labels Jul 11, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-docs

@rjernst
Copy link
Member

rjernst commented Jul 11, 2019

Thanks very much for your interest in Elasticsearch.

The name of the scoring script context changed in 6.4. See #30816.

We'd like to direct these kinds of issues to the forums. If you can stop by there, we'd appreciate it. There is an active community there that should be able to help get an answers to your questions. This allows us to use GitHub for verified bug reports, feature requests, and pull requests. As such, I hope you don't mind that I close this.

@rjernst rjernst closed this as completed Jul 11, 2019
@rjernst
Copy link
Member

rjernst commented Jul 11, 2019

For additional context, we do have the contexts documented, but we currently lack the name associated with each context.

@mohmad-null
Copy link
Author

@rjernst - Thanks but this remains a bug albeit in the documentation apparently. The docs are explicitly wrong which is why I reported it here rather than asked in the forum. I can see the following issues with the docs:

  • They explicitly state an invalid value as an example
  • No reference to the deprecation/change on that docs page or the provided painless contexts page
  • It's not even slightly clear from the new "painless contexts" page what they're on about. Which one(s) is/are required for a basic "search"? Do you expect users to test every possible combination? I'd suggest it's a bad idea to require users to have a deep understanding of how ES processes queries if they want to set up decent security - the more bars there are for security, the less likely people will engage with it.
  • There's no link to the "painless contexts" from the security page.

@rjernst
Copy link
Member

rjernst commented Aug 9, 2019

@mohmad-null Apologies, I see your point now. I am reopening to fix this.

@rjernst rjernst reopened this Aug 9, 2019
rjernst added a commit to rjernst/elasticsearch that referenced this issue Aug 9, 2019
The docs contain an example how to limit the scripting contexts allowed,
but the example used an outdated name for the scoring context.

closes elastic#44232
rjernst added a commit that referenced this issue Aug 12, 2019
The docs contain an example how to limit the scripting contexts allowed,
but the example used an outdated name for the scoring context.

closes #44232
rjernst added a commit that referenced this issue Aug 12, 2019
The docs contain an example how to limit the scripting contexts allowed,
but the example used an outdated name for the scoring context.

closes #44232
rjernst added a commit that referenced this issue Aug 12, 2019
The docs contain an example how to limit the scripting contexts allowed,
but the example used an outdated name for the scoring context.

closes #44232
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Scripting Scripting abstractions, Painless, and Mustache >docs General docs changes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants