apache / apache/rocketmq-dashboard

[Studio][Bug] Studio user search does not escape SQL LIKE wildcards

Open Beginner friendly
#4,223 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.4k
Forks
683
Avg merge
2d 14h
Merged PRs (30d)
58

Description

## Problem

`AuthService.listUsers` passes the raw username search into MyBatis-Plus `like("username", normalizedSearch)` without escaping SQL LIKE wildcards. A search for `admin_` matches `adminX`, `admin1`, etc.; a search for `admin%` matches any suffix.

Instance, credential, and operation-audit search paths already escape `\`, `%`, and `_` (see #4192–#4194). The studio user search path does not.

## Evidence

```java
String normalizedSearch = search == null ? "" : search.trim();
// ...
.like(!normalizedSearch.isEmpty(), "username", normalizedSearch)
```

`AuthService.java` `listUsers`.

## Expected behavior

Username search matches the literal search string. `_` and `%` in the query are not treated as wildcards.

## Scope

`AuthService.listUsers` + focused unit regression test. No API change.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in AuthService.java at listUsers and compare its username search with the escaping used by the instance, credential, and operation-audit search paths referenced in #4192–#4194. Add a focused unit regression test showing that literal _ and % characters do not act as SQL LIKE wildcards, then verify the search matches the literal username string.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
84/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.