Skip to content

Commit

Permalink
add failing compliance test for SHELL canonicalization
Browse files Browse the repository at this point in the history
  • Loading branch information
squell committed Jan 21, 2025
1 parent 6c92185 commit 80772a0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test-framework/sudo-compliance-tests/src/sudo/flag_shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ echo $0";
Ok(())
}

#[test]
fn shell_is_canonicalized() -> Result<()> {
let shell_path = "/bin/bash";
let env = Env("ALL ALL=(ALL:ALL) NOPASSWD: /usr/bin/bash")
.build()?;

Command::new("env")
.arg(format!("SHELL={shell_path}"))
.args(["sudo", "-s", "true"])
.output(&env)?
.stdout()?;

Ok(())
}

#[test]
fn argument_is_invoked_with_dash_c_flag() -> Result<()> {
let shell_path = "/root/my-shell";
Expand Down

0 comments on commit 80772a0

Please sign in to comment.