Describe the bug
Jormungandr configuration is not validated if we add some unknown fields
Mandatory Information
jcli --full-version output:jcli 0.3.3 (master-dd038ef, release, windows [x86_64]) - [rustc 1.36.0 (a53f9df32 2019-07-03)]jormungandr --full-version output:jormungandr 0.3.3 (master-dd038ef, release, windows [x86_64]) - [rustc 1.36.0 (a53f9df32 2019-07-03)]To Reproduce
Steps to reproduce the behavior:
---
rest:
listen: "127.0.0.1:8001"
p2p:
public_address: /ip4/127.0.0.1/tcp/9001
public_publig: addnkjnkjnknkjnkj
unknown field: value
id: 43594425551286079828071352457839944954
trusted_peers: []
unknown:
something: a
Expected behavior
Should return error that config has some unknown fields
Great. thanks for spotting this one.
there is a very simple way to fix it and it's documented here: https://serde.rs/container-attrs.html#deny_unknown_fields
The fix is done via updating https://github.com/input-output-hk/jormungandr/blob/37391147856220c0b338a1a2f36fc06bec9cc3e2/jormungandr/src/settings/start/config.rs#L12-L13 and every associated types that implments Serialize/Deserialize and to have that attribute added
#[derive(Debug, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Config {
pub secret_files: Option<Vec<PathBuf>>,
// ....
pub explorer: Option<Explorer>,
}
Also if the one who pick this issue can remove this field:
It is not used anymore since #757
I can get this one if no one else already started working on it.