eh: add input validate to multicall dispatcher
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I6e7dc21c716b16ef1f9827eed4cdad396a6a6964
This commit is contained in:
parent
7847e8faae
commit
0d50b374bd
2 changed files with 7 additions and 1 deletions
|
|
@ -36,6 +36,12 @@ fn dispatch_multicall(
|
|||
args: std::env::Args,
|
||||
) -> Option<Result<i32>> {
|
||||
let rest: Vec<String> = args.collect();
|
||||
|
||||
// Validate arguments before processing
|
||||
if let Err(e) = util::validate_nix_args(&rest) {
|
||||
return Some(Err(e));
|
||||
}
|
||||
|
||||
let hash_extractor = util::RegexHashExtractor;
|
||||
let fixer = util::DefaultNixFileFixer;
|
||||
let classifier = util::DefaultNixErrorClassifier;
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ fn pre_evaluate(_subcommand: &str, args: &[String]) -> Result<bool> {
|
|||
Ok(false)
|
||||
}
|
||||
|
||||
fn validate_nix_args(args: &[String]) -> Result<()> {
|
||||
pub fn validate_nix_args(args: &[String]) -> Result<()> {
|
||||
const DANGEROUS_PATTERNS: &[&str] = &[
|
||||
";", "&&", "||", "|", "`", "$(", "${", ">", "<", ">>", "<<", "2>", "2>>",
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue