fix(fermata): a script named like a wrapper or a metadata verb hides nothing; every shell's command line is read
./do .env, scripts/time .env and ./test .env pass no more: a wrapper counts by its file name only as a bare word or an absolute path, and the word after an absolute path still counts as a path, so /home/me/scripts/env .env is stopped too. A metadata verb has to be a bare word. dash, ksh, mksh, ash, yash, fish, csh, tcsh, pwsh, powershell and cmd have their command line read, and bash --norc -c no longer hides it.
This commit is contained in:
@@ -403,16 +403,14 @@ fn a_command_that_names_the_file_in_a_form_the_check_does_not_read_passes() {
|
||||
}
|
||||
}
|
||||
|
||||
/// A shell's command line is read for `bash`, `sh` and `zsh` with the word right after
|
||||
/// their `-c`, and for `eval`'s first argument. These stay text.
|
||||
/// A shell's command line is read with the word right after its `-c`, and `eval`'s first
|
||||
/// argument. These stay text.
|
||||
#[test]
|
||||
fn a_command_line_the_check_does_not_read_as_one_passes() {
|
||||
for rule in RULES {
|
||||
let p = ruled(rule);
|
||||
assert!(denied(&p.bash("sudo bash -c 'cat .env'")), "control");
|
||||
for command in [
|
||||
"dash -c 'cat .env'",
|
||||
"ksh -c 'cat .env'",
|
||||
"bash -c -- 'cat .env'",
|
||||
"eval 'true' 'cat .env'",
|
||||
"sudo -u root bash -c 'cat .env'",
|
||||
|
||||
Reference in New Issue
Block a user