-
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
Fix remote cluster credential secure settings reload #111535
Changes from 12 commits
564f63c
85fccbe
b89c507
eda3711
f248cc3
89381dd
1dec187
f6d905a
b7d560f
3211c9a
cbde0d4
bfdf2eb
7cab1de
52639f3
4a70f8f
a2bb171
b9669f1
26d0b32
80d5c66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 111535 | ||
summary: Fix remote cluster credential secure settings reload | ||
area: Authorization | ||
type: bug | ||
issues: [] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2202,13 +2202,19 @@ private void reloadRemoteClusterCredentials(Settings settingsWithKeystore) { | |
return; | ||
} | ||
|
||
final PlainActionFuture<ActionResponse.Empty> future = new UnsafePlainActionFuture<>(ThreadPool.Names.GENERIC); | ||
getClient().execute( | ||
ActionTypes.RELOAD_REMOTE_CLUSTER_CREDENTIALS_ACTION, | ||
new TransportReloadRemoteClusterCredentialsAction.Request(settingsWithKeystore), | ||
future | ||
); | ||
future.actionGet(); | ||
// Run this action in system context -- it was authorized upstream and should not be tied to end-user permissions | ||
final ThreadContext ctx = getClient().threadPool().getThreadContext(); | ||
assert ctx != null : "Thread context must be set for reload call"; | ||
try (ThreadContext.StoredContext ignore = ctx.stashContext()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we stash the context and mark as system context from Since the expectation is that work is implicitly allowed as a sub action from Alternatively, I think we could change There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I included it here primarily because it's an implementation detail that it's an action to begin with -- most other reload calls happen at the "service" layer and are not subject to authz at all -- it would be the same here if we had access to the right services within the Security plugin (we'd just call However, I don't feel strongly -- There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Discussed on Slack -- switching to system context in Since To accommodate this, we've decided to simply rename the action to have a prefix that's covered by |
||
ctx.markAsSystemContext(); | ||
final PlainActionFuture<ActionResponse.Empty> future = new UnsafePlainActionFuture<>(ThreadPool.Names.GENERIC); | ||
getClient().execute( | ||
ActionTypes.RELOAD_REMOTE_CLUSTER_CREDENTIALS_ACTION, | ||
new TransportReloadRemoteClusterCredentialsAction.Request(settingsWithKeystore), | ||
future | ||
); | ||
future.actionGet(); | ||
} | ||
} | ||
|
||
public Map<String, String> getAuthContextForSlowLog() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems useful for future debugging...