[Bug] mqadmin createUser/updateUser trim the ACL password, storing a secret the caller never typed
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- java
- 領域
- authentication, cli
調査の方向性
パスワードのトリムは、mqadminのサブコマンドcreateUserとupdateUserにあり、管理APIを呼び出す前に、password オプションの値がStringUtils.trimに渡されています。現在失敗しているテスト CreateUserSubCommandTest.testCreateKeepsThePasswordVerbatim と UpdateUserSubCommandTest.testUpdateKeepsThePasswordVerbatim から始めてください。パスワードがモックされた DefaultMQAdminExt に変更されずに届き、ユーザー名、ユーザータイプ、ブローカーアドレスは引き続きトリムされる状態になれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Java
- スター
- 22.7k
- フォーク
- 12k
- 平均マージ
- 3日 1時間
- マージ済み PR(30日)
- 16
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/rocketmq のほかの issue
-
[rocketmq-client-python] TransactionMQProducer allocates an unused producer during initializationオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
[Bug] notifyMasterOnline aborts the long-polling wake-up with a NullPointerException when an arrival drains a bucket first対応中かも @iloveeyjafjalla が 24 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
apache/rocketmq#11441 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Enhancement] FilterFactory duplicate-registration and unregister semantics lack tests対応中かも @chennaji9 が 29 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
apache/rocketmq#11340 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[Enhancement] LogicExpression three-valued truth table and short-circuit behavior lack direct tests対応中かも @chennaji9 が 29 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/rocketmq#11339 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[Enhancement] SyncStateInfo defensive-copy and epoch semantics lack direct tests対応中かも @chennaji9 が 29 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/rocketmq#11338 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
apache/rocketmq の issue をすべて見る
似ている issue
-
hermes-queue
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
chrisalunlloyd2-sudo/mindpalace#349 ·
メンテナーはふだん 1 日以内に返信
-
Retry-After parser accepts invalid delay-seconds values対応中かも @Dhruvraj-Rana が今日担当しました。 オープンBug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
open-telemetry/opentelemetry-java#9018 ·
メンテナーはふだん 2 日以内に返信
-
bug priority: medium Review effort [1-5]: 2 status: needs-triage type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
carlos-emr/carlos#5818 ·
メンテナーはふだん 1 日以内に返信
-
bug good first issue help wanted tooling
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
appmonster007/kmip-adapter#100 ·
-
accepted good first issue java
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信