You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "Frun1na (via GitHub)" <gi...@apache.org> on 2026/10/15 16:37:30 UTC

[I] [Bug] A line break in an alert rule name reaches the notification email subject header [rocketmq-dashboard]

Frun1na opened a new issue, #6771:
URL: https://github.com/apache/rocketmq-dashboard/issues/6771

   ### Before Creating the Bug Report
   
   - [x] I have searched the [open issues](https://github.com/apache/rocketmq-dashboard/issues) of this repository and believe that this is not a duplicate.
   - [x] This is a defect in RocketMQ Studio, not a usage question and not a defect in another Apache RocketMQ repository.
   - [x] I can reproduce this on the current `rocketmq-studio` branch, or I have stated the exact version I am running below.
   
   ### Studio Version
   
   ```
   branch: rocketmq-studio
   git commit id: a92c2314
   deployed as: reproduced by a unit test against that commit
   ```
   
   ### Runtime Environment
   
   ```
   OS: Ubuntu on WSL2 (test host)
   MySQL: not applicable — the defect is in the email subject composition, no database involved
   browser: not applicable — backend-only path
   ```
   
   ### Connected RocketMQ Cluster
   
   ```
   not applicable — reproduced with a stubbed alert and a stubbed mail sender in a unit test
   ```
   
   ### Describe the Bug
   
   `NotificationOutboxService.sendEmail` builds the message subject from the alert title
   (`server/src/main/java/org/apache/rocketmq/studio/ops/alert/NotificationOutboxService.java:494`):
   
   ```java
   message.setSubject("[RocketMQ Studio] " + alert.getTitle());
   ```
   
   The title is the rule's name verbatim: `NativeAlertProcessor.java:197` sets
   `.title(rule.getName())`. Nothing keeps that name to one line — `AlertRuleRequestDTO.name`
   carries only `@NotBlank` — so `POST /api/alert-rules` (and with it the AI tool and the rule
   import) accepts a name such as `High lag\nBcc: attacker@example.com`. A mail subject is a
   single header line, so the break is written into the header as it stands: with the mail
   version the server ships (angus-mail, `MimeMessage.setSubject(subject, "UTF-8")` +
   `writeTo`) the raw message contains
   
   ```
   Subject: [RocketMQ Studio] High lag
    Bcc: attacker@example.com
   ```
   
   The rest of the rule name becomes a folded continuation of the header instead of subject
   text, so the delivered subject is not a line of text the operator wrote.
   
   The console's single-line rule-name input cannot type a line break, but the REST contract
   (channels `dingtalk|sms|email`, the AI tool `rmq.alert.create`, the transfer import) can.
   
   ### Steps to Reproduce
   
   1. Create an alert rule whose name contains a line break, over the REST contract:
      `POST /api/alert-rules` with `"name": "High lag\nBcc: attacker@example.com"`,
      `"metric": "consumer.lag.total"`, `"operator": ">"`, `"threshold": 1`,
      `"instanceId": "<an instance>"`, `"channels": ["email"]`.
   2. Configure email recipients under Settings, then let the rule fire (or run the test below).
   3. Read the subject handed to the mail transport; the new unit test
      `NotificationOutboxServiceTest.emailSubjectStaysOnOneLineForAMultiLineAlertTitleTest`
      records `subject=[RocketMQ Studio] High lag` + a line break + `Bcc: attacker@example.com`.
   
   ### What Did You Expect to See?
   
   A single-line subject, e.g. `[RocketMQ Studio] High lag Bcc: attacker@example.com` — the
   line break collapsed, the same way `AlertService.sanitizeCommentText` keeps an exported rule
   comment on one line.
   
   ### What Did You See Instead?
   
   The subject passed to the mail sender still contains the line break, and JavaMail writes the
   remainder of the name as a folded continuation header line
   (`Subject: …\r\n Bcc: …`). Mail clients then show only the first line of the name, and the
   delivered subject is not the text the operator stored.
   
   ### Additional Context
   
   Reproduced with the mail library the server ships, without a mail server: a standalone
   `MimeMessage` (`jakarta.mail` 2.1.5 / angus-mail 2.0.5) does not reject the value at
   `setSubject` and emits `Subject: [RocketMQ Studio] Line1\r\n Bcc: attacker@example.com` on
   `writeTo`. A fix with a regression test follows in a pull request.
   
   ### Are You Willing to Submit a Pull Request?
   
   - [x] Yes, I am willing to submit a pull request.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] A line break in an alert rule name reaches the notification email subject header [rocketmq-dashboard]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #6771: [Bug] A line break in an alert rule name reaches the notification email subject header
URL: https://github.com/apache/rocketmq-dashboard/issues/6771


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] A line break in an alert rule name reaches the notification email subject header [rocketmq-dashboard]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #6771:
URL: https://github.com/apache/rocketmq-dashboard/issues/6771#issuecomment-6391333168

   This issue has been automatically closed because there has been no activity for 7 days. If you believe this issue is still relevant, please reopen it with updated information.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org