-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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 privilege requirement for CCS with Point In Time reader #62261
Conversation
Pinging @elastic/es-security (:Security/Authorization) |
public void testUserWithNoRolesOpenPointInTimeWithRemoteIndices() { | ||
final boolean hasLocalIndices = randomBoolean(); | ||
final String[] indices = new String[]{ | ||
hasLocalIndices ? randomAlphaOfLength(5) : "other_cluster:" + randomAlphaOfLength(5), |
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.
I would also exercise the condition that remote indices are wildcards (it could be a random)
@@ -479,6 +484,46 @@ public void testRemoteIndicesOnlyWorkWithApplicableRequestTypes() throws IOExcep | |||
verifyNoMoreInteractions(auditTrail); | |||
} | |||
|
|||
public void testUserWithNoRolesOpenPointInTimeWithRemoteIndices() { | |||
final boolean hasLocalIndices = randomBoolean(); |
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.
set this to both values in a for-each.
...security/src/test/java/org/elasticsearch/xpack/security/authz/AuthorizationServiceTests.java
Outdated
Show resolved
Hide resolved
...ter-search-security/src/test/resources/rest-api-spec/test/multi_cluster/80_point_in_time.yml
Outdated
Show resolved
Hide resolved
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.
LGTM Nice one Yang!
I had just a couple of small nits +
Also can you please amend the IndicesAndAliasesResolverTests#testRemotableRequestsAllowRemoteIndices
test for the OpenPointInTimeRequest
(and maybe randomly make foo
a wildcard foo*
).
@ywangd Thanks for fixing this. |
Co-authored-by: Albert Zaharovits <albert.zaharovits@gmail.com>
…into pit-ccs-permission
Thanks @albertzaharovits That was a good catch on the yaml test. You are right, neither subsequent search nor close remote PIT require any local privilege. It was a copy/paste error from the previous test's Authorization headers. I have now rectified them. Thanks! |
…62261) When target indices are remote only, CCS does not require user to have privileges on the local cluster. This PR ensure Point-In-Time reader follows the same pattern. Relates: elastic#61827
When target indices are remote only, CCS does not require user to have privileges on the local cluster. This PR ensure Point-In-Time reader follows the same pattern.
Relates: #61827
@dnhatn @jimczi