You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "Aias00 (via GitHub)" <gi...@apache.org> on 2026/07/29 09:36:51 UTC
[I] [Bug] HAProxyMessageForwarder should tolerate malformed port values [rocketmq]
Aias00 opened a new issue, #10692:
URL: https://github.com/apache/rocketmq/issues/10692
### Bug description
`HAProxyMessageForwarder.buildHAProxyMessage` parses source and destination ports with `Integer.parseInt` from either proxy protocol channel attributes or the channel remote/local address strings.
If a port value is malformed, for example a non-numeric proxy protocol port attribute or a malformed channel address, `buildHAProxyMessage` can throw `NumberFormatException`. This makes HAProxy message forwarding fail with a runtime parsing exception instead of simply skipping an invalid proxy protocol message.
### Expected behavior
Invalid or malformed proxy protocol port values should not throw from HAProxy message construction. The forwarder should treat the HAProxy message as unavailable and return `null`, consistent with existing behavior when required attributes are missing.
### Affected area
`proxy` module, remoting HTTP/2 proxy HAProxy protocol forwarding.
### Suggested fix
- Parse proxy protocol ports through a safe helper.
- Return `null` when source or destination ports cannot be parsed.
- Keep existing behavior for valid port values.
- Add unit tests for valid channel address parsing and malformed port values.
--
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] HAProxyMessageForwarder should tolerate malformed port values [rocketmq]
Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on issue #10692:
URL: https://github.com/apache/rocketmq/issues/10692#issuecomment-5116231871
**Issue Evaluation**
Category: `type/bug` | Status: **Confirmed**
The reported issue has been verified against the current codebase (upstream `develop` @ `00e45b8`).
**Root Cause:** `HAProxyMessageForwarder.buildHAProxyMessage()` calls `Integer.parseInt()` on port values at 4 locations (lines 110, 116, 122, 126) without any exception handling. If a proxy protocol port attribute or channel address string contains a malformed (non-numeric) port value, a `NumberFormatException` is thrown, causing the entire HAProxy message construction to fail at runtime.
**Impact:** Proxy module — HTTP/2 proxy HAProxy protocol forwarding. A malformed port in proxy protocol attributes or channel addresses will crash the forwarding path instead of gracefully degrading.
**Severity:** medium — Triggered only by malformed input, but the code already has a pattern of returning `null` when required attributes are missing (e.g., empty attributes array at line 95). The fix should be consistent with this existing defensive pattern.
**Suggested approach:**
- Wrap the 4 `Integer.parseInt()` calls in a safe parsing helper that returns a sentinel value (e.g., `-1` or `0`) on failure.
- Return `null` from `buildHAProxyMessage` when source or destination port cannot be parsed, consistent with the existing null-return pattern.
- Add unit tests covering valid address parsing and malformed port values.
An automated fix proposal can be generated. Reply `/approve` to proceed with PR generation.
---
*Automated evaluation by RockteMQ-AI*
--
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] HAProxyMessageForwarder should tolerate malformed port values [rocketmq]
Posted by "Aias00 (via GitHub) via commits" <co...@rocketmq.apache.org>.
Aias00 closed issue #10692: [Bug] HAProxyMessageForwarder should tolerate malformed port values
URL: https://github.com/apache/rocketmq/issues/10692
--
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