Skip to content

fix(sources): probe the health-check path under the base URL, not relative to it - #255

Merged
thiagoluga merged 1 commit into
masterfrom
fix/health-probe-url-combine
Aug 3, 2026
Merged

fix(sources): probe the health-check path under the base URL, not relative to it#255
thiagoluga merged 1 commit into
masterfrom
fix/health-probe-url-combine

Conversation

@thiagoluga

Copy link
Copy Markdown
Owner

What

HttpHealthProbe.CombineUrl resolved the configured health-check path as a relative URI. That:

  • replaces the base's last path segment when the base has no trailing slash — https://api.example.com/v1/orders + pinghttps://api.example.com/v1/**ping** (orders gone);
  • discards the base path entirely when the path starts with / — → https://api.example.com/ping.

So the HTTP and OData health checks probed a URL the author never configured: a reachable source can be reported unhealthy, or an unreachable one healthy if the wrong URL happens to answer.

The documented contract is "relative to the source's base URL", i.e. appended under it. This concatenates instead.

Why this one matters beyond its size

This is the 5th independent sighting of the same bug class in this repo. Elasticsearch (D64), HubSpot, Airtable and Salesforce each hit it separately and each rewrote their own URL builder away from new Uri(base, relative) — every one of them leaving a comment naming the trap. The shared helper was the last place still resolving relatively, and the two remaining callers of it are exactly the two health checks that never got their own builder.

Behaviour preserved

  • An absolute http(s) health-check path is still honoured as given.
  • A query on the configured path stays a query rather than being escaped into the path.
  • No path configured → the base URL itself is probed, unchanged.

Verification

  • New HttpHealthProbeUrlTests (8 cases: no trailing slash, leading /, trailing slash, host-root base, multi-segment, query, absolute override, unset).
  • 4 of the 8 fail against the old implementation — verified by reverting.
  • Http 56, OData 50, GraphQL 25 passed; full solution builds clean.

Found by a bug hunt over the nine HTTP-family source packages; the rest of that hunt's findings are in docs/STATUS-AND-BACKLOG.md §6.

…ative to it

HttpHealthProbe.CombineUrl resolved the configured health-check path as a
relative URI. That replaces the base's last path segment whenever the base has no
trailing slash (https://api.example.com/v1/orders + "ping" ->
https://api.example.com/v1/ping) and discards the base path entirely when the
path starts with "/" (-> /ping at the host root). The HTTP and OData health
checks therefore probed a URL the author never configured: a reachable source can
be reported unhealthy, or an unreachable one healthy if the wrong URL answers.

The documented contract is "relative to the source's base URL", i.e. appended
under it. Concatenate instead — the same move the Elasticsearch (D64), HubSpot,
Airtable and Salesforce packages each made after hitting this independently, each
with a comment naming it. This shared helper was the last place still resolving
relatively, and the two remaining callers of it are the HTTP and OData health
checks.

An absolute http(s) health-check path is still honoured as given, and a query on
the configured path stays a query rather than being escaped into the path.

Covered by HttpHealthProbeUrlTests; 4 of its 8 cases fail against the old
implementation.
@sonarqubecloud

sonarqubecloud Bot commented Aug 3, 2026

Copy link
Copy Markdown

@sonarqubecloud

sonarqubecloud Bot commented Aug 3, 2026

Copy link
Copy Markdown

@thiagoluga
thiagoluga merged commit d23c111 into master Aug 3, 2026
5 checks passed
@thiagoluga
thiagoluga deleted the fix/health-probe-url-combine branch August 3, 2026 21:27
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.

1 participant