mirror of https://github.com/digint/btrbk
btrbk: make safe_commands more restrictive
parent
7a4a54db97
commit
7ad4ebe0af
5
btrbk
5
btrbk
|
@ -806,7 +806,6 @@ sub _safe_cmd($;$)
|
|||
# NOTE: all files must be absolute
|
||||
if($offending) {
|
||||
push @$offending, $_ unless(defined(check_file($_, { absolute => 1 })));
|
||||
push @$offending, $_ unless(!$safe_commands || /^($safe_file_match)$/);
|
||||
}
|
||||
$_ = $prefix . quoteshell($_) . $postfix;
|
||||
}
|
||||
|
@ -3787,6 +3786,10 @@ sub check_file($$;@)
|
|||
ERROR "Illegal leading/trailing whitespace ${error_statement}: \"$file\"" if(defined($error_statement));
|
||||
return undef;
|
||||
}
|
||||
if($safe_commands && $file !~ /^$safe_file_match$/) {
|
||||
ERROR "Invalid file name (restricted by \"safe_commands\" option) ${error_statement}: \"$file\"" if(defined($error_statement));
|
||||
return undef;
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue