Skip to content

Commit

Permalink
fix(logs): remove config string from deserialization error log (#1872)
Browse files Browse the repository at this point in the history
This commit removes the passed config string to mm2 while initializing from the error log if there was a deserialization error.
  • Loading branch information
shamardy authored Jun 21, 2023
1 parent 26ee4e8 commit 5917533
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mm2src/mm2_main/src/mm2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,10 @@ pub fn get_mm2config(first_arg: Option<&str>) -> Result<Json, String> {

let mut conf: Json = match json::from_str(conf) {
Ok(json) => json,
Err(err) => return ERR!("Couldn't parse.({}).{}", conf, err),
// Syntax or io errors may include the conf string in the error message so we don't want to take risks and show these errors internals in the log.
// If new variants are added to the Error enum, there can be a risk of exposing the conf string in the error message when updating serde_json so
// I think it's better to not include the serde_json::error::Error at all in the returned error message rather than selectively excluding certain variants.
Err(_) => return ERR!("Couldn't parse mm2 config to JSON format!"),
};

if conf["coins"].is_null() {
Expand Down

0 comments on commit 5917533

Please sign in to comment.