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

Core: Handle security manager permission for deprecation log rolling #37281

Merged
merged 4 commits into from
Jan 10, 2019

Conversation

rjernst
Copy link
Member

@rjernst rjernst commented Jan 9, 2019

When the deprecation log is written to within scripting support code
like ScriptDocValues, it runs under the reduces privileges of scripts.
Sometimes this can trigger log rolling, which then causes uncaught
security errors, as was handled in #28485. While doing individual
deprecation handling within each deprecation scripting location is
possible, there are a growing number of deprecations in scripts.

This commit wraps the logging call within the deprecation logger use a
doPrivileged block, just was we would within individual logging call
sites for scripting utilities.

When the deprecation log is written to within scripting support code
like ScriptDocValues, it runs under the reduces privileges of scripts.
Sometimes this can trigger log rolling, which then causes uncaught
security errors, as was handled in elastic#28485. While doing individual
deprecation handling within each deprecation scripting location is
possible, there are a growing number of deprecations in scripts.

This commit wraps the logging call within the deprecation logger use a
doPrivileged block, just was we would within individual logging call
sites for scripting utilities.
@rjernst rjernst added :Core/Infra/Core Core issues without another label v7.0.0 >refactoring labels Jan 9, 2019
@@ -318,7 +320,10 @@ void deprecated(final Set<ThreadContext> threadContexts, final String message, f
}

if (log) {
logger.warn(message, params);
AccessController.doPrivileged((PrivilegedAction<Void>)() -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want this to be wrapped in a doPrivileged block for all calls or just for ones made from scripts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all callers is fine. It is essentially a noop for other callers, since they already run with at least the permissions of the server jar. Scripts are the only place with reduced privileges.

Copy link
Contributor

@jdconrad jdconrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rjernst rjernst merged commit fcf7df3 into elastic:master Jan 10, 2019
@rjernst rjernst deleted the deprecation_log_permission branch January 10, 2019 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label >refactoring v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants