Skip to content

bug: missing manual Debug impl for IpfsConfig in configs crate (secret leakage) #4310

Description

@isSerge

Problem

configs crate relies on manual Debug implementations to redact api keys for each config struct, however it's easy to forget.

For example IpfsConfig does not have it, instead it uses automatic derive, which creates secret leakage risk:

#[derive(Debug, Clone, Deserialize, Serialize)] <----- problem here
pub struct IpfsConfig {
    pub gateway: Url,
    #[serde(deserialize_with = "deserialize_auth_token")]
    pub auth_token: Option<String>,
}

Impact

Leaking a secret is critical

To reproduce

N/A

Expected behaviour

API key has to be redacted

Suggested fix

Introduce SecretString newtype that implements Debug printing "<REDACTED>" and use it by default for all config secrets, for example:

#[derive(Debug, Clone, Deserialize)]
pub struct IpfsConfig {
    pub gateway: Url,
    pub auth_token: Option<SecretString>,
}

Can remove manual Debug impl for CoinGeckoConfig, OneInchApi and TenderlyConfig completely

Screenshots/logs

N/A

services version/commit hash and environment

N/A

Additional context

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtrack:maintenancemaintenance track

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions