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
Problem
configscrate relies on manualDebugimplementations to redact api keys for each config struct, however it's easy to forget.For example
IpfsConfigdoes not have it, instead it uses automatic derive, which creates secret leakage risk:Impact
Leaking a secret is critical
To reproduce
N/A
Expected behaviour
API key has to be redacted
Suggested fix
Introduce
SecretStringnewtype that implementsDebugprinting"<REDACTED>"and use it by default for all config secrets, for example:Can remove manual
Debugimpl forCoinGeckoConfig,OneInchApiandTenderlyConfigcompletelyScreenshots/logs
N/A
services version/commit hash and environment
N/A
Additional context
N/A