fix(healthcheck): strip whitespace in parse_target and validate host - #5950
Open
vaibhavsrv wants to merge 1 commit into
Open
vaibhavsrv wants to merge 1 commit into
vaibhavsrv wants to merge 1 commit into
Conversation
This was referenced Sep 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this matters
In
ods/scripts/healthcheck.py,_parse_target(raw)identifies target check types and normalizes endpoints for HTTP and TCP connectivity probes. It tests whetherrawstarts with"http://","https://", or"tcp://". When target strings are passed from environment configuration files (.env), command substitutions, or shell pipelines with leading or trailing whitespace (for example" http://127.0.0.1:8080 "or"\t127.0.0.1:5432\n"),raw.startswith(...)evaluates toFalse, causing the parser to raise an unhandledValueError("target must be http(s) URL, tcp://host:port, or host:port")and failing service health diagnostics.This change invokes
raw = raw.strip()at the start of_parse_target, stripping whitespace padding before protocol and host-port pattern matching. Cleanly formatted targets and IPv6 addresses continue to be parsed without modification.Validation
" http://127.0.0.1:8080 "raisedValueError.Overlap check
healthcheck.py.pixel_settings.upsert_env_value.routers/pixel.py.This PR solely sanitizes whitespace in
_parse_targetinhealthcheck.pyand builds directly upon the IPv6 support merged in fix(healthcheck): support bracketed IPv6 targets and strip brackets before TCP connect #5875.Risk / AI disclosure
AI-assisted investigation, implementation, and regression test authoring. This strengthens input sanitization for CLI and programmatic health checks without modifying underlying socket timeout or HTTP transport logic. Independent human review remains a gate.
Follow-up integration evidence
Composed cleanly on top of #5569, #5871, and #5875 at HEAD without conflicts. Production and test diffs passed together; adjacent pixel-agent and pixel-settings checks 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.