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

[BUG][Workspace] Workspace name duplication check not work for name contains operators of simple query string #6480

Closed
Hailong-am opened this issue Apr 16, 2024 · 2 comments
Labels
bug Something isn't working workspace

Comments

@Hailong-am
Copy link
Collaborator

Describe the bug

Workspace name suppose to be unique across the system, we have add a unique check https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/plugins/workspace/server/workspace_client.ts#L94-L103

  const existingWorkspaceRes = await this.getScopedClientWithoutPermission(requestDetail)?.find(
    {
      type: WORKSPACE_TYPE,
      search: attributes.name,
      searchFields: ['name'],
    }
  );
  if (existingWorkspaceRes && existingWorkspaceRes.total > 0) {
    throw new Error(DUPLICATE_WORKSPACE_NAME_ERROR);
  }

under the hood, this search will use simple_query_string syntax to do query. If workspace name contains operators of simple_query_string, it will get parsed and not treat as literal value as workspace name.

An example, if we have workspace name foo bar that will parsed to workspace name is foo or workspace is bar, that will duplicate with existing workspace named foo.

To resolve this, we might need to support limit the operators as NONE, reference: https://opensearch.org/docs/latest/query-dsl/full-text/simple-query-string/#limit-operators

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

OpenSearch Version
Please list the version of OpenSearch being used.

Dashboards Version
Please list the version of OpenSearch Dashboards being used.

Plugins

Please list all plugins currently enabled.

Screenshots

If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Browser and version [e.g. 22]

Additional context

#4944

@BionIT
Copy link
Collaborator

BionIT commented Jun 4, 2024

@Hailong-am Looks like a PR has been merged, can this issue be closed?

@Hailong-am
Copy link
Collaborator Author

@Hailong-am Looks like a PR has been merged, can this issue be closed?

Yes, close now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working workspace
Projects
None yet
Development

No branches or pull requests

3 participants