Skip to content

Commit

Permalink
Fix git diff jailing
Browse files Browse the repository at this point in the history
See #216,
in particular #216 (comment)
and #216 (comment)

With this commit, git invocations by `rua` should be safe
even in presence of arbitrary .gitattributes files,
and should not be disrupted by people's local git configurations.
  • Loading branch information
vn971 committed Oct 4, 2023
1 parent 4b327ad commit a683e6f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/git_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ fn silently_run_panic_if_error(args: &[&str], dir: &Path, rua_paths: &RuaPaths)

fn git(dir: &Path, rua_paths: &RuaPaths) -> Command {
let mut command = Command::new(&rua_paths.wrapper_bwrap_script);
command.arg("--bind");
command.arg(dir);
command.arg(dir);
command.arg("git");
command.env("GIT_CONFIG", "/dev/null"); // see `man git-config`
command.env("GIT_CONFIG_NOSYSTEM", "1"); // see `man git`
command.env("XDG_CONFIG_HOME", "/dev/null"); // see `man git`
command.env("HOME", "/dev/null"); // see `man git`
command.current_dir(dir);
command
}

0 comments on commit a683e6f

Please sign in to comment.