From a27e1a6ede79fbd5a683c27546681f8d7c9e0fcb Mon Sep 17 00:00:00 2001 From: anipaul2 Date: Fri, 12 May 2023 01:07:36 +0530 Subject: [PATCH] Prevent overwrite_key and force_update from being set in the config file These parameters are dangerous and should only be set via command line flags. This change causes the application to panic if they are set in the configuration file, and updates the parameters to be settable only via the command line. --- .gitignore | 3 ++- teos/src/config.rs | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3b7e0f70..481e175e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ target __pycache__ .vscode -.idea \ No newline at end of file +.idea +.DS_Store \ No newline at end of file diff --git a/teos/src/config.rs b/teos/src/config.rs index 5436725f..36e07d88 100644 --- a/teos/src/config.rs +++ b/teos/src/config.rs @@ -203,6 +203,12 @@ impl Config { self.tor_support |= options.tor_support; self.debug |= options.debug; self.deps_debug |= options.deps_debug; + if self.overwrite_key { + panic!("The 'overwrite_key' parameter cannot be set in the configuration file. Please pass it as a command-line argument if necessary."); + } + if self.force_update { + panic!("The 'force_update' parameter cannot be set in the configuration file. Please pass it as a command-line argument if necessary."); + } self.overwrite_key = options.overwrite_key; self.force_update = options.force_update; }