[Bug] mqadmin createUser/updateUser trim the ACL password, storing a secret the caller never typed
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- java
- Lĩnh vực
- authentication, cli
Hướng nghiên cứu
Việc cắt khoảng trắng của mật khẩu nằm trong các lệnh con createUser và updateUser của mqadmin, nơi giá trị của tùy chọn password được truyền qua StringUtils.trim trước khi gọi API quản trị. Bắt đầu với các test CreateUserSubCommandTest.testCreateKeepsThePasswordVerbatim và UpdateUserSubCommandTest.testUpdateKeepsThePasswordVerbatim, hiện đang thất bại. Hoàn thành khi mật khẩu đến được DefaultMQAdminExt giả lập mà không bị thay đổi, trong khi tên người dùng, loại người dùng và địa chỉ broker vẫn được cắt khoảng trắng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Java
- Star
- 22.6k
- Fork
- 12k
- Merge trung bình
- 2 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 15
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/rocketmq
-
[rocketmq-client-python] TransactionMQProducer allocates an unused producer during initializationCó thể đã có người làm @siddiqueirshad đã nhận 4 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] notifyMasterOnline aborts the long-polling wake-up with a NullPointerException when an arrival drains a bucket firstCó thể đã có người làm @iloveeyjafjalla đã nhận 18 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
apache/rocketmq#11441 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Enhancement] FilterFactory duplicate-registration and unregister semantics lack testsCó thể đã có người làm @chennaji9 đã nhận 23 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
apache/rocketmq#11340 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Enhancement] LogicExpression three-valued truth table and short-circuit behavior lack direct testsCó thể đã có người làm @chennaji9 đã nhận 23 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/rocketmq#11339 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Enhancement] SyncStateInfo defensive-copy and epoch semantics lack direct testsCó thể đã có người làm @chennaji9 đã nhận 23 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/rocketmq#11338 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/rocketmq
Issue tương tự
-
UGS-FX 2.1.27 Open File IssueĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
winder/Universal-G-Code-Sender#3242 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
dfa1/vortex-java#636 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
omatheusmesmo/vintelli#188 ·
Maintainer thường phản hồi trong vòng 1 ngày