Skip to content

[Bug] HAProxyMessageForwarder should tolerate malformed port values #10692

Description

@Aias00

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions