123123213weqw opened a new pull request, #6696:
URL: https://github.com/apache/rocketmq-dashboard/pull/6696
Fixes #6415.
Two layers of the same parsing defect:
**Frontend** (`parseSilenceLabels` in `systemAlerts.tsx`): the dialog built
labels by assigning into a plain object — `__proto__=broker-a` names the
prototype's setter rather than an own property, so the key silently vanished
and the silence request could become unscoped; and a repeated key
(`broker=a,broker=b`) silently kept the last value. The parser now collects
into a `Map` (ordinary object-property names included) and rejects duplicate
normalized keys with the same localized message as a malformed pair.
**Backend** (`AlertSilenceService.normalizeLabels`): keys were trimmed
straight into a `LinkedHashMap`, so `{"broker":"a"," broker ":"b"}` trimmed to
the same key twice and the latter silently won, changing the requested scope. A
trim collision now refuses the window with a 400 naming the duplicated key.
- Frontend: `parseSilenceLabels` cases — every valid selector kept
(own-property `__proto__` asserted via its descriptor), duplicate normalized
keys rejected, malformed pairs still rejected with the localized message.
`SystemAlertsPage.test.tsx` is 24/24.
- Backend: `rejectsSilenceLabelsThatCollideAfterTrimmingTest` asserts the
400 and that nothing is persisted. `AlertSilenceServiceTest` is 13/13.
cc @lizhimins
--
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]