Expand description
Hardened git subprocess constructors.
Pod repositories live in user-writable data trees, so a repository’s own
.git/config and .git/hooks are attacker-influenced. Every production
git spawn in the workspace goes through hardened_git (std) or
hardened_git_async (tokio) so that:
- repo-local hooks never run (
core.hooksPath=/dev/null), core.fsmonitorcannot name a program (core.fsmonitor=false),core.sshCommandandcommit.gpgSigncannot spawn helpers,- system and global config are ignored (
GIT_CONFIG_NOSYSTEM=1,GIT_CONFIG_GLOBAL=/dev/null), - git never blocks on a credential prompt (
GIT_TERMINAL_PROMPT=0).
§Example
let mut cmd = solid_pod_rs_git::hardened_git();
cmd.arg("--version");Constants§
- HARDENED_
CONFIG -c key=valueoverrides applied before any caller arguments.- HARDENED_
ENV - Environment variables applied to every hardened invocation.
Functions§
- hardened_
cgi_ env - Environment entries that harden an externally-spawned git program (the
git-http-backendCGI) whose environment is built by hand. Uses git’sGIT_CONFIG_COUNTmechanism because the CGI cannot take-cflags. - hardened_
git - Build a
gitstd::process::Commandwith hooks, fsmonitor, ssh/gpg helpers and ambient config disabled. Append the subcommand and arguments as usual. - hardened_
git_ async - Tokio flavour of
hardened_git.