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

Skip isSimpleMatchPattern check for expressions in indirect requests such as ShardLevelRequest #119629

Open
gmarouli opened this issue Jan 7, 2025 · 1 comment
Labels
>enhancement :Security/Authorization Roles, Privileges, DLS/FLS, RBAC/ABAC Team:Security Meta label for security team

Comments

@gmarouli
Copy link
Contributor

gmarouli commented Jan 7, 2025

Follow up from #78321 and this issue is proposed in #78321 (comment).

In

ResolvedIndices resolveIndicesAndAliasesWithoutWildcards(String action, IndicesRequest indicesRequest) {
, requests like ShardSearchRequest already have their wildcard and selectors expanded and do not need the following checks that are executed for every expression:

  • Regex.isSimpleMatchPattern(selector)
  • Regex.isSimpleMatchPattern(localExpression)

We can gain some performance here for large list of indices if we have an allowlist to skip this check.

Proposal

TransportClient can potentially send a shard level request directly with wildcard not expanded. But I don't think we need to worry about it since the actual search will not rely on the indices (it uses ShardSearchRequest#shardId). Also the comment below clearly states that it is acceptable to allow wildcards in shard level requests. They just won't get expanded.

It would be great if we have a formal way to categorise non-replaceable requests into

  1. directly created for REST level requests (e.g. PutIndexRequest) and
  2. NOT directly created for REST level requests (e.g. ShardSearchRequest).

Because major part of this method is necessary for (1) but not (2). For now, an allowlist is a viable alternative.

@gmarouli gmarouli added :Security/Authorization Roles, Privileges, DLS/FLS, RBAC/ABAC >enhancement labels Jan 7, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Security Meta label for security team label Jan 7, 2025
@elasticsearchmachine
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement :Security/Authorization Roles, Privileges, DLS/FLS, RBAC/ABAC Team:Security Meta label for security team
Projects
None yet
Development

No branches or pull requests

2 participants