Skip to content

fix(weather): keep the request URL out of transport errors - #137

Merged
prorochestvo merged 1 commit into
alphafrom
fix/133-redact-transport-error-url
Aug 23, 2026
Merged

fix(weather): keep the request URL out of transport errors#137
prorochestvo merged 1 commit into
alphafrom
fix/133-redact-transport-error-url

Conversation

@prorochestvo

Copy link
Copy Markdown
Owner

The status-code branch in OpenMeteo.attempt composes its message from host and path alone,
with the reason written beside it — to keep coordinates and search terms out of the logs. The
transport branch two lines above defeated it. net/http returns a *url.Error whose
Error() embeds the request URL verbatim, so

Get "https://api.open-meteo.com/v1/forecast?...&latitude=51.169392&longitude=71.449074...": dial tcp: i/o timeout

is what any caller formatting the error with %v printed. Three call sites inherited it:
Forecast and ForecastRange with coordinates, Geocode with the term the user typed.

Both are pre-approved data under beacon-data-privacy, and no line carries a user
identifier, so this is hygiene rather than a policy breach — but it defeated an intent the
code states out loud, in three places.

redactURLError rebuilds the *url.Error with host and path only. A URL that will not parse
redacts to the empty string rather than to itself: the point is that nothing unexamined
reaches the log.

Tests cover both real paths — a forecast and a geocode against a dead listener, asserting the
coordinates and the search term are gone while the path survives so the line still says what
failed — plus the non-*url.Error passthrough and the unparseable URL. Both transport cases
were verified to fail with the redaction removed.

The privacy skill gains the general rule, since the next outbound client will need it:
an outbound URL is a log field.

Refs #133

The status-code branch composes its message from host and path alone,
with the reason written beside it: to keep coordinates and search terms
out of the logs. The transport branch two lines above defeated that.
net/http returns a *url.Error whose Error() embeds the URL verbatim, so
a plain dial timeout arrived carrying every latitude, longitude and
query term the request was built with, and any caller formatting it
with %v printed them. Three call sites inherited it: Forecast, Geocode
and ForecastRange.

Rebuild the *url.Error with host and path only. A URL that will not
parse redacts to nothing rather than to itself — the point is that
nothing unexamined reaches the log.

Closes #133

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U6jNuzK5PZrhDWBxB3t2gY
@prorochestvo
prorochestvo merged commit 51e380c into alpha Aug 23, 2026
1 check passed
@prorochestvo
prorochestvo deleted the fix/133-redact-transport-error-url branch August 30, 2026 16:36
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