Duansg opened a new pull request, #4146:
URL: https://github.com/apache/hertzbeat/pull/4146
## What's changed?
close #4144
Fixed two logic bugs in `JmxCollectImpl#validateJmxUrl` that caused all
valid URLs to be incorrectly rejected:
- The guard condition for "rmi:" in `disallowedPatterns` is always true,
causing valid URLs to be rejected
- The `url.contains(":/")` condition at the end will match all valid JMX URLs
## Modification details
- Switch to JMXServiceURL resolution + precise validation of the path prefix.
- Switch to using Locale.ROOT case normalization to prevent bypassing.
## Checklist
- [x] I have read the [Contributing
Guide](https://hertzbeat.apache.org/docs/community/code_style_and_quality_guide)
- [ ] I have written the necessary doc or comment.
- [x] I have added the necessary unit tests and all cases have passed.
## Add or update API
- [ ] I have added the necessary [e2e
tests](https://github.com/apache/hertzbeat/tree/master/e2e) and all cases have
passed.
<img width="1507" height="831" alt="image"
src="https://github.com/user-attachments/assets/0df816f6-7577-4788-9d22-f63bc200beb5"
/>
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]