Skip to content

[Failure Store] Test API keys and skip_unavailable with RCS1 #125782

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

Merged

Conversation

slobodanadamovic
Copy link
Contributor

@slobodanadamovic slobodanadamovic commented Mar 27, 2025

Adjust existing RCS1 tests to randomize using API keys for authorization
and skip_unavailable setting.

Followup on #125252

slobodanadamovic and others added 30 commits March 19, 2025 06:49
@slobodanadamovic slobodanadamovic added >test Issues or PRs that are addressing/adding tests :Security/Security Security issues without another label Team:Security Meta label for security team auto-backport Automatically create backport pull requests when merged v8.19.0 v9.1.0 labels Mar 27, 2025
@slobodanadamovic slobodanadamovic self-assigned this Mar 27, 2025
…ccs-with-api-keys

# Conflicts:
#	x-pack/plugin/security/qa/multi-cluster/src/javaRestTest/java/org/elasticsearch/xpack/remotecluster/AbstractRemoteClusterSecurityFailureStoreRestIT.java
#	x-pack/plugin/security/qa/multi-cluster/src/javaRestTest/java/org/elasticsearch/xpack/remotecluster/RemoteClusterSecurityRCS1FailureStoreRestIT.java
public void testRCS1CrossClusterSearch() throws Exception {
final boolean rcs1Security = true;
final boolean isProxyMode = randomBoolean();
final boolean skipUnavailable = false; // we want to get actual failures and not skip and get empty results
final boolean skipUnavailable = randomBoolean();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressing this suggestion: https://github.com/elastic/elasticsearch/pull/125252/files#r2010058827

The result does come empty, but it also contains failure reason per remote cluster. Which is what I'm asserting on.

assertOK(client().performRequest(indexDocRequest));
}

private static void setupUserAndRoleOnQueryCluster() throws IOException {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These changes are mostly refactorings in order to reuse the role definitions when creating API keys.

"names": ["local_index"],
"privileges": ["read"]
},
{
Copy link
Contributor Author

@slobodanadamovic slobodanadamovic Mar 28, 2025

Choose a reason for hiding this comment

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

The roles on query cluster now include index privileges which were previously only defined on fulfilling cluster. This is needed, because API keys are created on query cluster for each user. Without this, API keys would be useless as they would not have any privilege to access, because their roles are limited-by owning user's privileges.

@slobodanadamovic slobodanadamovic requested review from Copilot and n1v0lg and removed request for Copilot March 28, 2025 09:23
@slobodanadamovic slobodanadamovic marked this pull request as ready for review March 28, 2025 09:23
Copilot

This comment was marked as off-topic.

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

Copy link
Contributor

@n1v0lg n1v0lg left a comment

Choose a reason for hiding this comment

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

LGTM

@slobodanadamovic slobodanadamovic merged commit d12eb8d into elastic:main Apr 9, 2025
22 checks passed
slobodanadamovic added a commit to slobodanadamovic/elasticsearch that referenced this pull request Apr 9, 2025
…#125782)

Adjust existing RCS1 tests to randomize using API keys for authorization
and `skip_unavailable` setting.

Followup on elastic#125252
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.x

elasticsearchmachine pushed a commit that referenced this pull request Apr 9, 2025
#126555)

Adjust existing RCS1 tests to randomize using API keys for authorization
and `skip_unavailable` setting.

Followup on #125252
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged :Security/Security Security issues without another label Team:Security Meta label for security team >test Issues or PRs that are addressing/adding tests v8.19.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants