Skip to content

Feature/prevent create api with cloud api key #129966

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

Open
wants to merge 37 commits into
base: main
Choose a base branch
from

Conversation

ankit--sethi
Copy link
Contributor

Not supporting this at this time per TDD

n1v0lg and others added 30 commits May 26, 2025 10:21
…ud-api-key-authentication

# Conflicts:
#	server/src/main/java/org/elasticsearch/TransportVersions.java
…authentication

# Conflicts:
#	server/src/main/java/org/elasticsearch/TransportVersions.java
…ate-api-with-cloud-api-key

# Conflicts:
#	server/src/main/java/org/elasticsearch/TransportVersions.java
#	x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/Authentication.java
#	x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java
@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label v9.1.0 labels Jun 24, 2025
if (authentication.isCloudApiKey()) {
listener.onFailure(new IllegalArgumentException("creating elasticsearch api keys using cloud api keys is not supported"));
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest to add this check in ApiKeyService#createApiKey method.
Reason is to cover all possible cases, including creating cross-cluster API keys and granting API keys.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, let's add a unit test for this change in ApiKeyServiceTests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

@ankit--sethi ankit--sethi added :Security/Security Security issues without another label labels Jun 25, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Security Meta label for security team label Jun 25, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label Jun 25, 2025
@ankit--sethi ankit--sethi added >non-issue needs:triage Requires assignment of a team area label and removed Team:Security Meta label for security team needs:triage Requires assignment of a team area label labels Jun 25, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Security Meta label for security team label Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>non-issue :Security/Security Security issues without another label Team:Security Meta label for security team v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants