RockteMQ-AI commented on issue #1913:
URL:
https://github.com/apache/rocketmq-dashboard/issues/1913#issuecomment-5255717991
**Issue Evaluation**
Category: `bug` | Status: **Confirmed**
Verified against the `rocketmq-studio` branch. The bug is in
`web/src/i18n/LangContext.tsx` line 46:
```ts
text = text.replace(`{${k}}`, String(v));
```
Two problems:
1. **`String.replace()` with a string pattern only replaces the first
occurrence** — if a translation has multiple `{name}` placeholders, only the
first is substituted.
2. **Special replacement patterns (`$&`, `$'`) are interpreted** —
user-controlled values containing these sequences corrupt the output. For
example, a resource named `orders$&` interpolated into `Delete {name}?`
produces `Delete orders{name}?`.
**Severity:** medium — affects any user-controlled string displayed in
translated UI text (confirmation dialogs, labels).
**Impact:** `LangContext.t()` consumers across the Studio frontend.
Suggested fix: use `split`/`join` or a replacement callback function to
avoid pattern interpretation and handle all occurrences.
An automated fix proposal can be generated. Reply `/approve` to proceed with
PR generation.
---
*Automated evaluation by github-manager-bot*
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]