Skip to content

tracker_client: do not write the tracker key in diagnostics or results #3004

Done

Description

@josecelano-bot

Part of EPIC #2758. Priority p1 (bug).

Goal

tracker_client never writes the key of a private HTTP tracker (the <key> in /announce/<key> and /scrape/<key>) to stdout or stderr. Where a tracker URL is needed to identify a target, the key segment is masked with a fixed string (****), as section 7 (redaction policy) of the global CLI output contract (docs/adrs/20260519000000_define_global_cli_output_contract.md) requires.

Background

A private Torrust HTTP tracker authenticates a peer with a key in the URL path. A caller of tracker_client passes that URL on the command line or in the check configuration, so the key is a credential the tool holds. Reproduced on develop (7bc30738a) with a closed local port:

  • http announce and http scrape: the runtime_failure record on stderr carries the full request URL, key and query included, inside the Debug text of a reqwest::Error.
  • check: the result on stdout echoes the configured URL, key included, in its url field; its per-request texts carry reqwest::Error Debug text.

Known sources: packages/tracker-client/src/http/client/mod.rs formats reqwest::Error with {err:?} and reqwest::Response with {response:?} (both print the URL; the Display of reqwest::Error also appends for url (<url>), so switching to {err} is not enough); console/tracker-client writes those texts unchanged (report_runtime_failure, the checker results, response.bytes().await?).

stderr and stdout of tracker_client are captured by CI and by AI agents, so a key written there can end up in shared logs. This predates #2768, where it was found. It does not overlap EPIC #2993 / #2999 (server side and rest-api-client), which touch other files.

In scope

  • Audit every output path of tracker_client (http announce, http scrape, udp announce, udp scrape, check, check monitor) that can write a tracker URL or request-error text.
  • One small function masks the key segment of an HTTP tracker URL; every output path uses it. Host, port and path prefix stay visible.
  • No reqwest::Error Debug text in any output: a failed request is reported with an error kind (connect, timeout, status, decode) and the masked URL.
  • Fix the library source in packages/tracker-client too.
  • Regression tests (masking function, library error seam, black-box tracker_client http announce against a closed port), red before the fix and green after.
  • Update console/tracker-client/docs/contracts/tracker-cli-io-contract.md with the redaction rule for tracker URLs.

Out of scope

  • The panic of check for a udp:// URL without a port.
  • A schema version for the results.
  • The checker dropping the key from the request path, and reporting a refused connection as a timeout (separate issues if wanted).
  • Other tools of the EPIC; UDP URLs carry no key.

Acceptance criteria

  • No output of tracker_client (stdout or stderr, any subcommand, success or failure) contains the key of a tracker URL; the key segment is written as ****.
  • No output contains the Debug text of a reqwest::Error.
  • The library error text of packages/tracker-client does not contain the key.
  • Regression tests fail on the unchanged code and pass after the fix.

The full specification (with the reproduction evidence) is added by the spec PR under docs/issues/open/3004-2758-tracker-client-mask-tracker-key/.

Activity

  1. added 5 commits that reference this issue on Nov 23, 2026
  2. added 2 commits that reference this issue on Nov 23, 2026
  3. added 8 commits that reference this issue on Nov 23, 2026
  4. 5 remaining items

  5. added 5 commits that reference this issue on Nov 24, 2026
  6. added a commit that references this issue on Nov 24, 2026
  7. added a commit that references this issue on Nov 24, 2026
  8. added 3 commits that reference this issue on Nov 24, 2026
  9. added a commit that references this issue on Nov 25, 2026
  10. added 3 commits that reference this issue on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions