Skip to content

[BUG] IPInfo token and the Redis URL reach logs and telemetry events #80

Closed

Description

@RomanPszonka

Two secrets travel further than they need to.

IPInfo token. ipinfo_handler.py:147 puts it in the query string:

url = f"{base_url}?token={self.token}"

response.raise_for_status() on a non-2xx raises aiohttp.ClientResponseError,
whose str() embeds the full URL. That string is interpolated into the failure
log and into the geo_lookup_failed telemetry event reason
(ipinfo_handler.py:103, :215). Any 401, 403 or 429 from ipinfo.io writes the
token to the log — and a 401 is precisely what a rotated or mistyped token
produces, so the failure that reveals the secret is the common one.

IPInfo accepts Authorization: Bearer <token>, which keeps it out of the URL.
The error string should be reduced to host and status either way.

Redis URL. redis_handler.py:106,118 passes
redis_url=self.config.redis_url into the connect and reconnect telemetry
events. redis://:PASSWORD@host:6379 is the documented URL form, so on a
password-protected instance the credential goes to the agent on every connect
and every reconnect — that is, most often when Redis is flapping.

Strip userinfo before including it (urlunsplit with the netloc rewritten), or
send host and port only.



Found while re-checking a private audit against the current release. Verified on guard-core 3.13.0, CPython 3.14.

Activity

  1. rennf93 commented on Aug 25, 2026

    @rennf93
    Member

    Thanks @RomanPszonka for opening the issue! By @rennf93's directive:

    Reproduced both.

    One precision: guard-core itself does not write the token to a log line. The leak is the reason of the geo download-failed and lookup-failed telemetry events (and whatever the host application logs from SecurityEvent.reason), via aiohttp.ClientResponseError.__str__ embedding the full URL. Same for the Redis URL: it rides in event metadata on connect and reconnect, and the agent transport does no redaction.

    Fix in 3.14.0: Authorization: Bearer for IPInfo, error reasons reduced to exception type plus status, and userinfo stripped from redis_url before it reaches any event.

  2. self-assigned this
    on Aug 25, 2026
  3. added
    bugConfirmed defect
    securitySecurity-related issue (use private reporting first!)
    area: handlersTouches guard_core/handlers/
    on Aug 26, 2026
  4. linked a pull request that will close this issuerelease(v3.14.0): post-3.13.0 hardening #82on Aug 26, 2026
  5. rennf93 commented on Aug 26, 2026

    @rennf93
    Member

    Shipped in guard-core 3.14.0 (PyPI), merged in #82 (500d4ef).

    The IPInfo token is sent as an Authorization: Bearer header and never echoed in logs or telemetry; RedisManager.initialize strips userinfo from redis_url before it reaches any event.

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

Metadata

Metadata

Assignees

Labels

area: handlersTouches guard_core/handlers/bugConfirmed defectsecuritySecurity-related issue (use private reporting first!)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions