Skip to content

Commit

Permalink
Prevent overwrite_key and force_update from being set in the config file
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
anipaul2 committed May 11, 2023
1 parent 1a89c5d commit a27e1a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
target
__pycache__
.vscode
.idea
.idea
.DS_Store
6 changes: 6 additions & 0 deletions teos/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit a27e1a6

Please sign in to comment.