Skip to content

fix(healthcheck): guard missing port delimiter in _parse_host_port - #6079

Closed
vaibhavsrv wants to merge 1 commit into
Osmantic:public-betafrom
vaibhavsrv:fix/healthcheck-parse-host-port-delimiter
Closed

vaibhavsrv wants to merge 1 commit into
Osmantic:public-betafrom
vaibhavsrv:fix/healthcheck-parse-host-port-delimiter

Conversation

@vaibhavsrv

Copy link
Copy Markdown
Contributor

Why this matters

In ods/scripts/healthcheck.py, _parse_host_port() parses TCP host and port targets. When called directly with a target missing a colon delimiter (such as "localhost" or "127.0.0.1" without port, or strings with untrimmed whitespace), raw.rsplit(":", 1) unpacks into a single element, raising an unhandled ValueError: not enough values to unpack (expected 2, got 1) rather than a descriptive domain error.

This change strips surrounding whitespace and explicitly asserts ":" in raw before splitting, raising ValueError("missing port delimiter ':' in target") if no port delimiter is present. Valid hostname and IPv6 bracketed targets remain untouched.

Validation

  • Baseline reproduction: Calling _parse_host_port("localhost") raised unhandled unpacking ValueError: not enough values to unpack (expected 2, got 1).
  • Post-fix verification: Running ods/tests/test_healthcheck_host_port_delimiter.py verifies that targets without a colon raise ValueError("missing port delimiter ':' in target"), and targets with surrounding whitespace are cleanly trimmed and parsed.
  • Telemetry: Healthcheck test suite passes: test_healthcheck_host_port_delimiter.py passes cleanly (exit code 0). Wired into Linux CI workflow under healthcheck tests.

Overlap check

Risk / AI disclosure

AI-assisted investigation, implementation, and test regressions. This improves input validation and error clarity for target parsing. Independent human review and platform/runtime qualification remain gates. No running configuration, deployment or upstream merge changed.

Follow-up integration evidence

Composed with #5875, #5950, #5951, #6076, #6077, and #6078 at HEAD without conflicts. Production and test diffs passed together; healthcheck IPv6 and redirect policy suites remain intact.
Backlog composition was local-only (production/test diffs, excluding workflow/Makefile wiring); it is not an upstream merge or independent human approval. Declared live-review gates remain open.

@Lightheartdevs

Copy link
Copy Markdown
Collaborator

Thanks for this contribution. public-beta was promoted into main on 2026-09-24 and no longer receives changes, so we're closing pull requests that target it. This isn't a judgment on the change itself. If it's still needed, please rebase onto main and open a focused PR. See #7253 for details and the contribution policy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants