Skip to content

Commit

Permalink
Do not include URLs in ApiError::RequestError (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrgn authored Mar 18, 2024
1 parent f0d85a3 commit da20d9b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Possible log types:
- [changed] The `RecipientKey` type now implements `Debug` and a few other traits
- [changed] The `lookup_pubkey` function now returns a `RecipientKey` wrapper around `PublicKey`
- [changed] The `decrypt_incoming_message` function now accepts a `RecipientKey`, not a `PublicKey`
- [changed] Request errors no longer include the URL, as it may contain sensitive information (#74)

### v0.16.0 (2023-09-04)

Expand Down
9 changes: 8 additions & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub enum ApiError {

/// Error when sending request (via reqwest)
#[error("request error: {0}")]
RequestError(#[from] ReqwestError),
RequestError(#[source] ReqwestError),

/// Error when reading response
#[error("I/O error: {0}")]
Expand All @@ -65,6 +65,13 @@ pub enum ApiError {
Other(String),
}

impl From<ReqwestError> for ApiError {
fn from(err: ReqwestError) -> Self {
// Strip URL, as it might contain sensitive content (the API secret)
Self::RequestError(err.without_url())
}
}

/// Crypto related errors.
#[derive(Debug, PartialEq, Clone, Error)]
pub enum CryptoError {
Expand Down

0 comments on commit da20d9b

Please sign in to comment.