News for hackers. Stuff that matters.
Re:How to Lose Control of Your Shell by hn92726819 on Saturday March 09, 2024 @03:33PM (#39654510)

    // Construct the command we want the $SHELL to execute
    let command = format!("cd {:?}; /usr/bin/env -0;", dir);
SQL Injection-like attacks continues to resurface. You should pass it as a parameter in the future. Untested, but something like this:

    format!("cd \"$1\"; ...");
    command.args([command, dir]);
Re:How to Lose Control of Your Shell by misternugget on Sunday March 10, 2024 @03:32AM (#39657383)
Rust's debug-print {:?} quotes the path here.
Re:How to Lose Control of Your Shell by hn92726819 on Sunday March 10, 2024 @11:28AM (#39659938)
Yes, but rust's quoting does not match shell's quoting. Imagine a path like:

    $(rm -rf /*; echo /)
That's a valid Unix path, but rust's quoting does nothing to stop it: https://play.rust-lang.org/?version=stable&mode=debug&editio...