[Bug] mqadmin createUser/updateUser trim the ACL password, storing a secret the caller never typed
Los mantenedores suelen responder en 1 día
@iloveeyjafjalla ya está trabajando en esto.
Desde el 16/10/2026.
- #11447 de @iloveeyjafjalla — abierto
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- java
- Área
- authentication, cli
Línea de trabajo
El recorte de la contraseña está en los subcomandos de mqadmin createUser y updateUser, donde el valor de la opción password se pasa por StringUtils.trim antes de la llamada a la API de administración. Empieza por las pruebas CreateUserSubCommandTest.testCreateKeepsThePasswordVerbatim y UpdateUserSubCommandTest.testUpdateKeepsThePasswordVerbatim, que actualmente fallan. Está terminado cuando la contraseña llega sin cambios al DefaultMQAdminExt simulado, mientras que el nombre de usuario, el tipo de usuario y la dirección del broker siguen recortándose.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Before Creating the Bug Report
- I have searched the open issues of this repository and believe that this is not a duplicate.
- This is a defect in Apache RocketMQ, not a usage question.
- I can reproduce this on the current
developbranch.
RocketMQ Version
develop @ 5d68880cbdfa5c6d87b5681c5eb3684df0e18ef8 (the revision this was verified on)
Describe the Bug
mqadmin createUser -p <secret> and mqadmin updateUser -p <secret> run the password through StringUtils.trim before calling the admin API:
String username = StringUtils.trim(commandLine.getOptionValue('u'));
String password = StringUtils.trim(commandLine.getOptionValue('p')); // <-- the secret
String userType = StringUtils.trim(commandLine.getOptionValue('t'));
A secret is a payload, not a name. RocketMQ stores the secret it is given (AuthMigrator copies accessConfig.getSecretKey() into the user record, User.of(accessKey, secretKey, ...) in the authentication manager) and every client is authenticated against exactly that string, so leading or trailing whitespace is part of a legal secret - and secrets pasted from a vault or a file routinely carry one.
The CLI silently stores the trimmed value, so:
mqadmin createUser -u bob -p " s3cret " -b 127.0.0.1:10911storess3cret;- every client that presents the real secret
" s3cret "is rejected as unauthenticated, and nothing in the CLI output or the broker log points at the difference; - through the admin API the same secret is stored verbatim, so the CLI and the API disagree about the same user.
The neighbouring command sendMessage carried the same shape for the message body until #11414 dropped its .trim().
Steps to Reproduce
mqadmin createUser -u bob -p " s3cret " -b 127.0.0.1:10911(or the same throughupdateUser).- Read the stored user back (
mqadmin getUser -u bob -b 127.0.0.1:10911): the stored secret iss3cret, not the string that was passed. - Authenticate one client with
" s3cret "and one withs3cret: the first is rejected, the second succeeds.
A unit test makes the same point without a broker: the mocked DefaultMQAdminExt receives "s3cret" for the argument " s3cret ":
CreateUserSubCommandTest.testCreateKeepsThePasswordVerbatim:65 expected:<[ s3cret ]> but was:<[s3cret]>
UpdateUserSubCommandTest.testUpdateKeepsThePasswordVerbatim:65 expected:<[ p@ss word ]> but was:<[p@ss word]>
What Did You Expect to See?
The password reaches createUser / updateUser exactly as the operator passed it. The username, the user type and the broker address keep their trim.
What Did You See Instead?
Both commands trim the secret, so a secret with leading or trailing whitespace cannot be provisioned through mqadmin at all, and the mismatch only shows up later as an authentication failure.
- Lenguaje dominante
- Java
- Estrellas
- 22.6k
- Forks
- 12k
- Merge medio
- 5 d 14 h
- PR fusionados (30 d)
- 18
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/rocketmq
-
[Bug] notifyMasterOnline aborts the long-polling wake-up with a NullPointerException when an arrival drains a bucket firstPosiblemente ocupada @iloveeyjafjalla la tomó hace 10 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
apache/rocketmq#11441 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Enhancement] FilterFactory duplicate-registration and unregister semantics lack testsPosiblemente ocupada @chennaji9 la tomó hace 15 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
apache/rocketmq#11340 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
[Enhancement] LogicExpression three-valued truth table and short-circuit behavior lack direct testsPosiblemente ocupada @chennaji9 la tomó hace 15 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/rocketmq#11339 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
[Enhancement] SyncStateInfo defensive-copy and epoch semantics lack direct testsPosiblemente ocupada @chennaji9 la tomó hace 15 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/rocketmq#11338 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
[Enhancement] ControllerClosure request-completion semantics lack direct testsPosiblemente ocupada @chennaji9 la tomó hace 15 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/rocketmq#11337 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de apache/rocketmq
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
-
[Bug]: REST API URL starting with "http" but no scheme (e.g. httpbin.org/get) is not given an http:// prefixPosiblemente ocupada @ItsDeadlyProgrammer la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
appsmithorg/appsmith#42471 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
code-maintenance
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
-
bug priority: medium Review effort [1-5]: 3 status: needs-triage type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
carlos-emr/carlos#5258 ·
Los mantenedores suelen responder en 1 día