Skip to content

API token revealed in logs via tracing instrumentation #1441

Closed

Description

@josecelano

Relates to: #727

When you run the tracker you see the API token MyAccessToken in the tracing logs:

2025-04-11T11:54:21.902975Z  INFO initialize{configuration=Configuration { metadata: Metadata { app: TorrustTracker, purpose: Configuration, schema_version: Version { schema_version: "2.0.0" } }, logging: Logging { threshold: Info }, core: Core { announce_policy: AnnouncePolicy { interval: 120, interval_min: 120 }, database: Database { driver: Sqlite3, path: "./storage/tracker/lib/database/sqlite3.db" }, inactive_peer_cleanup_interval: 600, listed: false, net: Network { external_ip: Some(0.0.0.0), on_reverse_proxy: false }, private: false, private_mode: None, tracker_policy: TrackerPolicy { max_peer_timeout: 900, persistent_torrent_completed_stat: false, remove_peerless_torrents: true }, tracker_usage_statistics: true }, udp_trackers: Some([UdpTracker { bind_address: 0.0.0.0:6868, cookie_lifetime: 120s, tracker_usage_statistics: true }, UdpTracker { bind_address: 0.0.0.0:6969, cookie_lifetime: 120s, tracker_usage_statistics: true }]), http_trackers: Some([HttpTracker { bind_address: 0.0.0.0:7070, tsl_config: None, tracker_usage_statistics: true }, HttpTracker { bind_address: 0.0.0.0:7171, tsl_config: None, tracker_usage_statistics: true }]), http_api: Some(HttpApi { bind_address: 0.0.0.0:1212, tsl_config: None, access_tokens: {"admin": "MyAccessToken"} }), health_check_api: HealthCheckApi { bind_address: 127.0.0.1:1313 } }}

The token "MyAccessToken" should not be included in logs.

The output is produced here:

impl AppContainer {
    #[instrument(skip())]
    pub fn initialize(configuration: &Configuration) -> AppContainer {

    // ...
    }
}

We have to change it to:

impl AppContainer {
    #[instrument(skip(configuration))]
    pub fn initialize(configuration: &Configuration) -> AppContainer {

    // ...
    }
}

Activity

  1. added
    Security
    on Apr 11, 2025
  2. self-assigned this
    on Apr 11, 2025
  3. added theissue type on Apr 11, 2025
  4. added 2 commits that reference this issue on Apr 11, 2025
  5. linked a pull request that will close this issueDo not reveal the API token in logs #1442on Apr 11, 2025
  6. josecelano commented on Apr 11, 2025

    @josecelano
    MemberAuthor

    Closed via #1442

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

Metadata

Metadata

Assignees

Labels

Security

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions